@@ -51,9 +51,12 @@ if [[ -z ${flatcar_hacked_systemctl:-} ]]; then
5151 flatcar_hacked_systemctl=$(command -v systemctl)
5252fi
5353systemctl() {
54+ ewarn "called our systemctl wrapper with args: ${*@Q}"
5455 if [[ ${#} -eq 4 && ${1} = '--root='* && ${2} = 'enable' && ${3} = '
[email protected] ' && ${4} = 'remote-fs.target' ]]; then
56+ ewarn "ignoring"
5557 return 0
5658 fi
59+ ewarn "forwarding to actual systemctl"
5760 "${flatcar_hacked_systemctl}" "${@}"
5861}
5962
@@ -287,6 +290,7 @@ flatcar_preset_all_enable() {
287290}
288291
289292cros_post_src_install_flatcar_stuff() {
293+ ewarn 'Dropping systemd-user pam config'
290294 # We provide our own systemd-user config file in baselayout.
291295 rm "${ED}/usr/share/pam.d/systemd-user" || die
292296
@@ -295,14 +299,23 @@ cros_post_src_install_flatcar_stuff() {
295299 # before that and will create the journal if the filesystem is
296300 # already read-write. Conveniently the systemd build system sets
297301 # this up completely wrong.
302+ ewarn 'Setting up /var/log/journal'
303+ local dirinfo=$(stat "${ED}/var/log/journal" 2>/dev/null)
304+ ewarn 'Info about existing directory:'
305+ ewarn "${dirinfo}"
298306 keepdir /var/log/journal
299307 fowners root:systemd-journal /var/log/journal
300308 fperms 2755 /var/log/journal
301309
310+ ewarn 'Setting up /var/log/journal/remote'
311+ dirinfo=$(stat "${ED}/var/log/journal/remote" 2>/dev/null)
312+ ewarn 'Info about existing directory:'
313+ ewarn "${dirinfo}"
302314 keepdir /var/log/journal/remote
303315 fowners systemd-journal-remote:systemd-journal-remote /var/log/journal/remote
304316
305317 (
318+ ewarn 'Setting up tmpfiles.d entry for resolv.conf'
306319 insopts -m 0644
307320 insinto /usr/lib/tmpfiles.d
308321 # Add tmpfiles rule for resolv.conf. This path has changed
@@ -314,41 +327,56 @@ L /run/systemd/network/resolv.conf - - - - ../resolve/resolv.conf
314327EOF
315328 )
316329
330+ ewarn 'Dropping 99-environment.conf'
317331 # Don't set any extra environment variables by default.
318332 rm "${ED}/usr/lib/environment.d/99-environment.conf" || die
319333
334+ ewarn 'Doing preset of system units'
320335 # enable system units
321336 flatcar_preset_all_enable "${ED}/usr/lib/systemd/system-preset/90-systemd.preset" system
337+ ewarn 'Doing preset of user units'
322338 # enable user units
323339 flatcar_preset_all_enable "${ED}/usr/lib/systemd/user-preset/90-systemd.preset" user
324340
341+ ewarn 'Dropping systemd presets'
325342 # Use an empty preset file, because systemctl preset-all puts
326343 # symlinks in /etc, not in /usr. We don't use /etc, because it is
327344 # not autoupdated. We do the "preset" above.
328345 rm "${ED}/usr/lib/systemd/system-preset/90-systemd.preset" || die
329346 rm "${ED}/usr/lib/systemd/user-preset/90-systemd.preset" || die
330347 (
348+ ewarn 'Inserting our own empty system preset'
331349 insinto /usr/lib/systemd/system-preset
332350 newins - 99-default.preset <<'EOF'
333351# Do not enable any services if /etc is detected as empty.
334352disable *
335353EOF
354+ ewarn 'Inserting our own empty user preset'
336355 insinto /usr/lib/systemd/user-preset
337356 newins - 99-default.preset <<'EOF'
338357# Do not enable any services if /etc is detected as empty.
339358disable *
340359EOF
341360 )
342361
362+ ewarn 'Removing /usr/share/factory'
343363 # Do not ship distro-specific files (nsswitch.conf pam.d). This
344364 # conflicts with our own configuration provided by baselayout.
345365 rm -r "${ED}"/usr/share/factory || die
366+ ewarn 'Editing etc.conf tmpfiles.d'
367+ local contents=$(cat "${ED}"/usr/lib/tmpfiles.d/etc.conf)
368+ ewarn 'Contents before edit:'
369+ ewarn "${contents}"
346370 sed -i "${ED}"/usr/lib/tmpfiles.d/etc.conf \
347371 -e '/^C!* \/etc\/nsswitch\.conf/d' \
348372 -e '/^C!* \/etc\/pam\.d/d' \
349373 -e '/^C!* \/etc\/issue/d' || die
374+ contents=$(cat "${ED}"/usr/lib/tmpfiles.d/etc.conf)
375+ ewarn 'Contents after edit:'
376+ ewarn "${contents}"
350377
351378 (
379+ ewarn 'Setting up systemd-timesyncd.service drop-in'
352380 # Some OEMs prefer chronyd, so allow them to replace
353381 # systemd-timesyncd with it.
354382 insinto "$(systemd_get_systemunitdir)/systemd-timesyncd.service.d"
360388After=ensure-sysext.service
361389EOF
362390 )
391+ ewarn 'Hook done'
363392}
0 commit comments