@@ -49,9 +49,12 @@ if [[ -z ${flatcar_hacked_systemctl:-} ]]; then
4949 flatcar_hacked_systemctl=$(command -v systemctl)
5050fi
5151systemctl() {
52+ ewarn "called our systemctl wrapper with args: ${*@Q}"
5253 if [[ ${#} -eq 4 && ${1} = '--root='* && ${2} = 'enable' && ${3} = '
[email protected] ' && ${4} = 'remote-fs.target' ]]; then
54+ ewarn "ignoring"
5355 return 0
5456 fi
57+ ewarn "forwarding to actual systemctl"
5558 "${flatcar_hacked_systemctl}" "${@}"
5659}
5760
@@ -302,6 +305,7 @@ flatcar_preset_all_enable() {
302305}
303306
304307cros_post_src_install_flatcar_stuff() {
308+ ewarn 'Dropping systemd-user pam config'
305309 # We provide our own systemd-user config file in baselayout.
306310 rm "${ED}/usr/share/pam.d/systemd-user" || die
307311
@@ -310,14 +314,23 @@ cros_post_src_install_flatcar_stuff() {
310314 # before that and will create the journal if the filesystem is
311315 # already read-write. Conveniently the systemd build system sets
312316 # this up completely wrong.
317+ ewarn 'Setting up /var/log/journal'
318+ local dirinfo=$(stat "${ED}/var/log/journal" 2>/dev/null)
319+ ewarn 'Info about existing directory:'
320+ ewarn "${dirinfo}"
313321 keepdir /var/log/journal
314322 fowners root:systemd-journal /var/log/journal
315323 fperms 2755 /var/log/journal
316324
325+ ewarn 'Setting up /var/log/journal/remote'
326+ dirinfo=$(stat "${ED}/var/log/journal/remote" 2>/dev/null)
327+ ewarn 'Info about existing directory:'
328+ ewarn "${dirinfo}"
317329 keepdir /var/log/journal/remote
318330 fowners systemd-journal-remote:systemd-journal-remote /var/log/journal/remote
319331
320332 (
333+ ewarn 'Setting up tmpfiles.d entry for resolv.conf'
321334 insopts -m 0644
322335 insinto /usr/lib/tmpfiles.d
323336 # Add tmpfiles rule for resolv.conf. This path has changed
@@ -329,41 +342,56 @@ L /run/systemd/network/resolv.conf - - - - ../resolve/resolv.conf
329342EOF
330343 )
331344
345+ ewarn 'Dropping 99-environment.conf'
332346 # Don't set any extra environment variables by default.
333347 rm "${ED}/usr/lib/environment.d/99-environment.conf" || die
334348
349+ ewarn 'Doing preset of system units'
335350 # enable system units
336351 flatcar_preset_all_enable "${ED}/usr/lib/systemd/system-preset/90-systemd.preset" system
352+ ewarn 'Doing preset of user units'
337353 # enable user units
338354 flatcar_preset_all_enable "${ED}/usr/lib/systemd/user-preset/90-systemd.preset" user
339355
356+ ewarn 'Dropping systemd presets'
340357 # Use an empty preset file, because systemctl preset-all puts
341358 # symlinks in /etc, not in /usr. We don't use /etc, because it is
342359 # not autoupdated. We do the "preset" above.
343360 rm "${ED}/usr/lib/systemd/system-preset/90-systemd.preset" || die
344361 rm "${ED}/usr/lib/systemd/user-preset/90-systemd.preset" || die
345362 (
363+ ewarn 'Inserting our own empty system preset'
346364 insinto /usr/lib/systemd/system-preset
347365 newins - 99-default.preset <<'EOF'
348366# Do not enable any services if /etc is detected as empty.
349367disable *
350368EOF
369+ ewarn 'Inserting our own empty user preset'
351370 insinto /usr/lib/systemd/user-preset
352371 newins - 99-default.preset <<'EOF'
353372# Do not enable any services if /etc is detected as empty.
354373disable *
355374EOF
356375 )
357376
377+ ewarn 'Removing /usr/share/factory'
358378 # Do not ship distro-specific files (nsswitch.conf pam.d). This
359379 # conflicts with our own configuration provided by baselayout.
360380 rm -r "${ED}"/usr/share/factory || die
381+ ewarn 'Editing etc.conf tmpfiles.d'
382+ local contents=$(cat "${ED}"/usr/lib/tmpfiles.d/etc.conf)
383+ ewarn 'Contents before edit:'
384+ ewarn "${contents}"
361385 sed -i "${ED}"/usr/lib/tmpfiles.d/etc.conf \
362386 -e '/^C!* \/etc\/nsswitch\.conf/d' \
363387 -e '/^C!* \/etc\/pam\.d/d' \
364388 -e '/^C!* \/etc\/issue/d' || die
389+ contents=$(cat "${ED}"/usr/lib/tmpfiles.d/etc.conf)
390+ ewarn 'Contents after edit:'
391+ ewarn "${contents}"
365392
366393 (
394+ ewarn 'Setting up systemd-timesyncd.service drop-in'
367395 # Some OEMs prefer chronyd, so allow them to replace
368396 # systemd-timesyncd with it.
369397 insinto "$(systemd_get_systemunitdir)/systemd-timesyncd.service.d"
375403After=ensure-sysext.service
376404EOF
377405 )
406+ ewarn 'Hook done'
378407}
0 commit comments