@@ -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
@@ -304,6 +307,7 @@ flatcar_preset_all_enable() {
304307}
305308
306309cros_post_src_install_flatcar_stuff() {
310+ ewarn 'Dropping systemd-user pam config'
307311 # We provide our own systemd-user config file in baselayout.
308312 rm "${ED}/usr/share/pam.d/systemd-user" || die
309313
@@ -312,14 +316,23 @@ cros_post_src_install_flatcar_stuff() {
312316 # before that and will create the journal if the filesystem is
313317 # already read-write. Conveniently the systemd build system sets
314318 # this up completely wrong.
319+ ewarn 'Setting up /var/log/journal'
320+ local dirinfo=$(stat "${ED}/var/log/journal" 2>/dev/null)
321+ ewarn 'Info about existing directory:'
322+ ewarn "${dirinfo}"
315323 keepdir /var/log/journal
316324 fowners root:systemd-journal /var/log/journal
317325 fperms 2755 /var/log/journal
318326
327+ ewarn 'Setting up /var/log/journal/remote'
328+ dirinfo=$(stat "${ED}/var/log/journal/remote" 2>/dev/null)
329+ ewarn 'Info about existing directory:'
330+ ewarn "${dirinfo}"
319331 keepdir /var/log/journal/remote
320332 fowners systemd-journal-remote:systemd-journal-remote /var/log/journal/remote
321333
322334 (
335+ ewarn 'Setting up tmpfiles.d entry for resolv.conf'
323336 insopts -m 0644
324337 insinto /usr/lib/tmpfiles.d
325338 # Add tmpfiles rule for resolv.conf. This path has changed
@@ -331,41 +344,56 @@ L /run/systemd/network/resolv.conf - - - - ../resolve/resolv.conf
331344EOF
332345 )
333346
347+ ewarn 'Dropping 99-environment.conf'
334348 # Don't set any extra environment variables by default.
335349 rm "${ED}/usr/lib/environment.d/99-environment.conf" || die
336350
351+ ewarn 'Doing preset of system units'
337352 # enable system units
338353 flatcar_preset_all_enable "${ED}/usr/lib/systemd/system-preset/90-systemd.preset" system
354+ ewarn 'Doing preset of user units'
339355 # enable user units
340356 flatcar_preset_all_enable "${ED}/usr/lib/systemd/user-preset/90-systemd.preset" user
341357
358+ ewarn 'Dropping systemd presets'
342359 # Use an empty preset file, because systemctl preset-all puts
343360 # symlinks in /etc, not in /usr. We don't use /etc, because it is
344361 # not autoupdated. We do the "preset" above.
345362 rm "${ED}/usr/lib/systemd/system-preset/90-systemd.preset" || die
346363 rm "${ED}/usr/lib/systemd/user-preset/90-systemd.preset" || die
347364 (
365+ ewarn 'Inserting our own empty system preset'
348366 insinto /usr/lib/systemd/system-preset
349367 newins - 99-default.preset <<'EOF'
350368# Do not enable any services if /etc is detected as empty.
351369disable *
352370EOF
371+ ewarn 'Inserting our own empty user preset'
353372 insinto /usr/lib/systemd/user-preset
354373 newins - 99-default.preset <<'EOF'
355374# Do not enable any services if /etc is detected as empty.
356375disable *
357376EOF
358377 )
359378
379+ ewarn 'Removing /usr/share/factory'
360380 # Do not ship distro-specific files (nsswitch.conf pam.d). This
361381 # conflicts with our own configuration provided by baselayout.
362382 rm -r "${ED}"/usr/share/factory || die
383+ ewarn 'Editing etc.conf tmpfiles.d'
384+ local contents=$(cat "${ED}"/usr/lib/tmpfiles.d/etc.conf)
385+ ewarn 'Contents before edit:'
386+ ewarn "${contents}"
363387 sed -i "${ED}"/usr/lib/tmpfiles.d/etc.conf \
364388 -e '/^C!* \/etc\/nsswitch\.conf/d' \
365389 -e '/^C!* \/etc\/pam\.d/d' \
366390 -e '/^C!* \/etc\/issue/d' || die
391+ contents=$(cat "${ED}"/usr/lib/tmpfiles.d/etc.conf)
392+ ewarn 'Contents after edit:'
393+ ewarn "${contents}"
367394
368395 (
396+ ewarn 'Setting up systemd-timesyncd.service drop-in'
369397 # Some OEMs prefer chronyd, so allow them to replace
370398 # systemd-timesyncd with it.
371399 insinto "$(systemd_get_systemunitdir)/systemd-timesyncd.service.d"
377405After=ensure-sysext.service
378406EOF
379407 )
408+ ewarn 'Hook done'
380409}
0 commit comments