]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
units: condition out a few services in the initrd
authorLennart Poettering <lennart@poettering.net>
Tue, 4 Jul 2023 20:31:11 +0000 (22:31 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 5 Jul 2023 01:58:47 +0000 (10:58 +0900)
Let's make our units more robust to being added to an initrd:

1. systemd-boot-update only makes sense if sd-boot is available in /usr/
   to copy into the ESP. This is generally not the case in initrds, and
   even if it was, we shouldn't update the ESP from the initrd, but from
   the host instead.

2. The rfkill services save/restore rfkill state, but that information
   is only available once /var/ is mounted, which generally happens
   after the initrd transition.

3. utmp management is partly in /var/, and legacy anyway, hence don't
   bother with it in the initrd.

units/systemd-boot-update.service
units/systemd-rfkill.service.in
units/systemd-rfkill.socket
units/systemd-update-utmp-runlevel.service.in
units/systemd-update-utmp.service.in

index ce9187bbfedd8844ed78a829954018406b4944d3..f234184d78070c88c0a1f196c4eceb7da5efdb31 100644 (file)
@@ -10,6 +10,7 @@
 [Unit]
 Description=Automatic Boot Loader Update
 Documentation=man:bootctl(1)
+ConditionPathExists=!/etc/initrd-release
 
 DefaultDependencies=no
 After=local-fs.target
index 56de1a15379fb4759218959467d3041ce8d8c6d2..4034d7a557f5f0463613de0d2c43d3871d58718a 100644 (file)
@@ -10,6 +10,8 @@
 [Unit]
 Description=Load/Save RF Kill Switch Status
 Documentation=man:systemd-rfkill.service(8)
+ConditionPathExists=!/etc/initrd-release
+
 DefaultDependencies=no
 BindsTo=sys-devices-virtual-misc-rfkill.device
 Conflicts=shutdown.target
index 81c0e8c9c6caaa60152a8d475ef676bfc9db50e0..588ecd26f464b99fd4000bfecc0f5d3d2eae37c6 100644 (file)
@@ -10,6 +10,7 @@
 [Unit]
 Description=Load/Save RF Kill Switch Status /dev/rfkill Watch
 Documentation=man:systemd-rfkill.socket(8)
+ConditionPathExists=!/etc/initrd-release
 
 DefaultDependencies=no
 BindsTo=sys-devices-virtual-misc-rfkill.device
index 11177dc621f850ba19a05737225849120f4c808b..18c92f9b5a4c35c4d2effc027bd34ea5f0b20d83 100644 (file)
@@ -10,6 +10,8 @@
 [Unit]
 Description=Record Runlevel Change in UTMP
 Documentation=man:systemd-update-utmp-runlevel.service(8) man:utmp(5)
+ConditionPathExists=!/etc/initrd-release
+
 DefaultDependencies=no
 RequiresMountsFor=/var/log/wtmp
 Conflicts=shutdown.target
index f1278fae32e4aed7fbd2c0e8dc5c95f048345662..73a848390e95dabcca981272d22840bc1177633c 100644 (file)
@@ -10,6 +10,7 @@
 [Unit]
 Description=Record System Boot/Shutdown in UTMP
 Documentation=man:systemd-update-utmp.service(8) man:utmp(5)
+ConditionPathExists=!/etc/initrd-release
 
 DefaultDependencies=no
 After=systemd-remount-fs.service systemd-tmpfiles-setup.service auditd.service