mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-22 23:11:07 +02:00
sys-apps/systemd: Drop the handling of ENABLED_UNITS
We are installing systemd from scratch in the image, so there are no previously enabled units to enable or reenable after installation. Also, this code would enable the services in /etc, which we don't want, because /etc is not autoupdated, so the enabled services could end up still being disabled after the update.
This commit is contained in:
parent
393a645c38
commit
a65e2ade5b
@ -505,20 +505,14 @@ migrate_locale() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
save_enabled_units() {
|
# Flatcar: save_enabled_units function is dropped, because it's
|
||||||
ENABLED_UNITS=()
|
# unused. When building releases, we assume that there was no systemd
|
||||||
type systemctl &>/dev/null || return
|
# previously, so there are no units to remember.
|
||||||
for x; do
|
|
||||||
if systemctl --quiet --root="${ROOT:-/}" is-enabled "${x}"; then
|
|
||||||
ENABLED_UNITS+=( "${x}" )
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
pkg_preinst() {
|
pkg_preinst() {
|
||||||
# Flatcar: We enable getty and remote-fs unconditionally, so
|
# Flatcar: When building releases, we assume that there was no
|
||||||
# no need to find out whether those are enabled or not here.
|
# systemd previously, so there are no units to remember, so
|
||||||
save_enabled_units {machines,remote-cryptsetup}.target
|
# there is no point in calling save_enabled_units.
|
||||||
|
|
||||||
if ! use split-usr; then
|
if ! use split-usr; then
|
||||||
local dir
|
local dir
|
||||||
@ -567,28 +561,16 @@ pkg_postinst() {
|
|||||||
# between OpenRC & systemd
|
# between OpenRC & systemd
|
||||||
migrate_locale
|
migrate_locale
|
||||||
|
|
||||||
# Flatcar: Reenabling systemd-timesyncd service too.
|
# Flatcar: Dropping the reenabling, since there earlier there
|
||||||
systemd_reenable systemd-networkd.service systemd-resolved.service systemd-timesyncd.service
|
# was no systemd (we are building the release from scratch
|
||||||
|
# here). The function checks if the unit is enabled before
|
||||||
|
# running reenable, which in our case results in no action at
|
||||||
|
# all (because no service is enabled).
|
||||||
|
|
||||||
# Flatcar: TODO: Possibly replace `systemctl enable` with
|
# Flatcar: Dropping handling of ENABLED_UNITS.
|
||||||
# `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
|
|
||||||
|
|
||||||
# Flatcar: We enable getty and remote-fs targets ourselves
|
# Flatcar: We enable getty and remote-fs targets in /usr
|
||||||
# above. The code below would modify /etc, which we don't
|
# ourselves above.
|
||||||
# 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
|
|
||||||
elog "To enable a useful set of services, run the following:"
|
|
||||||
elog " systemctl preset-all --preset-mode=enable-only"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -L ${EROOT}/var/lib/systemd/timesync ]]; then
|
if [[ -L ${EROOT}/var/lib/systemd/timesync ]]; then
|
||||||
rm "${EROOT}/var/lib/systemd/timesync"
|
rm "${EROOT}/var/lib/systemd/timesync"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user