From 8a64463b042983fedc38dcb51552ba232b109e8b Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Fri, 25 Sep 2020 09:40:16 +0200 Subject: [PATCH] sys-apps/systemd: Try harder at not enabling services through /etc At installation time, we usually want to enable services through /lib. This change will stop making the installation to put symlinks for getty in /etc, since we already do it in /lib. --- .../sys-apps/systemd/systemd-9999.ebuild | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/systemd-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/systemd-9999.ebuild index 08cc451ea9..61b6478241 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/systemd-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-apps/systemd/systemd-9999.ebuild @@ -507,7 +507,9 @@ save_enabled_units() { } pkg_preinst() { - save_enabled_units {machines,remote-{cryptsetup,fs}}.target getty@tty1.service + # Flatcar: We enable getty and remote-fs unconditionally, so + # no need to find out whether those are enabled or not here. + save_enabled_units {machines,remote-cryptsetup}.target if ! use split-usr; then local dir @@ -559,11 +561,19 @@ pkg_postinst() { # Flatcar: Reenabling systemd-timesyncd service too. systemd_reenable systemd-networkd.service systemd-resolved.service systemd-timesyncd.service + # Flatcar: TODO: Possibly replace `systemctl enable` with + # `systemd_enable_service`, so it potentially could enable the + # services by making symlinks in /lib, instead of /etc? + # Currently does nothing, because ENABLED_UNITS end up being + # empty, but might not be true in future. if [[ ${ENABLED_UNITS[@]} ]]; then systemctl --root="${ROOT:-/}" enable "${ENABLED_UNITS[@]}" fi - if [[ -z ${REPLACING_VERSIONS} ]]; then + # Flatcar: We enable getty and remote-fs targets ourselves + # above. The code below would modify /etc, which we don't + # want. + if false && [[ -z ${REPLACING_VERSIONS} ]]; then if type systemctl &>/dev/null; then systemctl --root="${ROOT:-/}" enable getty@.service remote-fs.target || FAIL=1 fi