]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
refactor: use inst_sysusers to install sysusers files
authorLaszlo Gombos <laszlo.gombos@gmail.com>
Mon, 27 May 2024 22:55:59 +0000 (18:55 -0400)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Wed, 19 Jun 2024 16:06:59 +0000 (12:06 -0400)
dracut-init.sh
modules.d/01systemd-coredump/module-setup.sh
modules.d/01systemd-journald/module-setup.sh
modules.d/01systemd-networkd/module-setup.sh
modules.d/01systemd-resolved/module-setup.sh
modules.d/01systemd-sysusers/module-setup.sh
modules.d/01systemd-timesyncd/module-setup.sh
modules.d/06dbus-broker/module-setup.sh
modules.d/91tpm2-tss/module-setup.sh

index ce1371ffe7276cfa24464cc26ca35c6f09474d53..1181397511c970eb971f527df868fe4969431449 100755 (executable)
@@ -709,6 +709,15 @@ inst_libdir_file() {
     [[ ${#_files[@]} -gt 0 ]] && inst_multiple "${_files[@]}"
 }
 
+# install sysusers files
+inst_sysusers() {
+    inst_multiple -o "$sysusers/$*"
+
+    if [[ $hostonly ]]; then
+        inst_multiple -H -o "$sysusersconfdir/$*"
+    fi
+}
+
 # get a command to decompress the given file
 get_decompress_cmd() {
     case "$1" in
index 47666b6ca3c9af27d01f549a091e2a13064c4bf5..0c5cbcfb1869be734a2a435309065b9650e3c162 100755 (executable)
@@ -30,6 +30,8 @@ depends() {
 install() {
 
     inst_dir /var/lib/systemd/coredump
+    inst_sysusers systemd-coredump.conf
+
     inst_multiple -o \
         "$sysctld"/50-coredump.conf \
         "$systemdutildir"/coredump.conf \
@@ -37,7 +39,6 @@ install() {
         "$systemdsystemunitdir"/systemd-coredump.socket \
         "$systemdsystemunitdir"/systemd-coredump@.service \
         "$systemdsystemunitdir"/sockets.target.wants/systemd-coredump.socket \
-        "$sysusers"/systemd-coredump.conf \
         coredumpctl
 
     # Install library file(s)
@@ -56,7 +57,6 @@ install() {
             "$systemdsystemconfdir/systemd-coredump.socket.d/*.conf" \
             "$systemdsystemconfdir"/systemd-coredump@.service \
             "$systemdsystemconfdir/systemd-coredump@.service.d/*.conf" \
-            "$systemdsystemconfdir"/sockets.target.wants/systemd-coredump.socket \
-            "$sysusersconfdir"/systemd-coredump.conf
+            "$systemdsystemconfdir"/sockets.target.wants/systemd-coredump.socket
     fi
 }
index e0944d21cd68c1558522df711fe38039467e8f70..77d6a2e9315bde2098bd81b855e03b5698d633c4 100755 (executable)
@@ -31,6 +31,8 @@ install() {
 
     inst_simple "$moddir/initrd.conf" "$systemdutildir/journald.conf.d/initrd.conf"
 
+    inst_sysusers systemd-journal.conf
+
     inst_multiple -o \
         "$systemdutildir"/journald.conf \
         "$systemdutildir/journald.conf.d/*.conf" \
@@ -47,7 +49,6 @@ install() {
         "$systemdsystemunitdir"/sockets.target.wants/systemd-journald-dev-log.socket \
         "$systemdsystemunitdir"/sockets.target.wants/systemd-journald.socket \
         "$systemdsystemunitdir"/sysinit.target.wants/systemd-journald.service \
-        "$sysusers"/systemd-journal.conf \
         journalctl
 
     # Install library file(s)
@@ -66,8 +67,7 @@ install() {
             "$systemdsystemconfdir"/systemd-journald.service \
             "$systemdsystemconfdir/systemd-journald.service.d/*.conf" \
             "$systemdsystemconfdir"/systemd-journal-catalog-update.service \
-            "$systemdsystemconfdir/systemd-journal-catalog-update.service.d/*.conf" \
-            "$sysusersconfdir"/systemd-journal.conf
+            "$systemdsystemconfdir/systemd-journal-catalog-update.service.d/*.conf"
     fi
 
 }
index f564242cb6f4e1650a334d123453b18e0eeb8f8a..ccc9133d8e06c5abc5fde9500e114dca491f695b 100755 (executable)
@@ -31,6 +31,8 @@ depends() {
 # Install the required file(s) and directories for the module in the initramfs.
 install() {
 
+    inst_sysusers systemd-network.conf
+
     inst_multiple -o \
         "$tmpfilesdir"/systemd-network.conf \
         "$dbussystem"/org.freedesktop.network1.conf \
@@ -55,7 +57,6 @@ install() {
         "$systemdsystemunitdir"/systemd-networkd-wait-online.service \
         "$systemdsystemunitdir"/systemd-networkd-wait-online@.service \
         "$systemdsystemunitdir"/systemd-network-generator.service \
-        "$sysusers"/systemd-network.conf \
         ip
 
     # Enable systemd type units
@@ -82,7 +83,6 @@ install() {
             "$systemdsystemconfdir"/systemd-networkd-wait-online.service \
             "$systemdsystemconfdir/systemd-networkd-wait-online.service.d/*.conf" \
             "$systemdsystemconfdir"/systemd-networkd-wait-online@.service \
-            "$systemdsystemconfdir/systemd-networkd-wait-online@.service.d/*.conf" \
-            "$sysusersconfdir"/systemd-network.conf
+            "$systemdsystemconfdir/systemd-networkd-wait-online@.service.d/*.conf"
     fi
 }
index 0c2e8c2827a6ed216299c881bda2a5e26e877079..b354bc6cc04c9da81d621552cfc3efc27e38525e 100755 (executable)
@@ -31,6 +31,8 @@ install() {
 
     inst_simple "$moddir/resolved-tmpfile-dracut.conf" "$tmpfilesdir/resolved-tmpfile-dracut.conf"
 
+    inst_sysusers systemd-resolve.conf
+
     inst_multiple -o \
         "$dbussystem"/org.freedesktop.resolve1.conf \
         "$dbussystemservices"/org.freedesktop.resolve1.service \
@@ -40,7 +42,6 @@ install() {
         "$systemdutildir"/systemd-resolved \
         "$systemdsystemunitdir"/systemd-resolved.service \
         "$systemdsystemunitdir/systemd-resolved.service.d/*.conf" \
-        "$sysusers"/systemd-resolve.conf \
         resolvectl
 
     # Enable systemd type unit(s)
@@ -52,7 +53,6 @@ install() {
             "$systemdutilconfdir"/resolved.conf \
             "$systemdutilconfdir/resolved.conf.d/*.conf" \
             "$systemdsystemconfdir"/systemd-resolved.service \
-            "$systemdsystemconfdir/systemd-resolved.service.d/*.conf" \
-            "$sysusersconfdir"/systemd-resolve.conf
+            "$systemdsystemconfdir/systemd-resolved.service.d/*.conf"
     fi
 }
index 4ec48dc69d0d17d932dee3990b29ad6929d85c6d..351f45c01bafd68706ff2f7b8f923bea061db3de 100755 (executable)
@@ -26,9 +26,10 @@ install() {
 
     inst_simple "$moddir/sysusers-dracut.conf" "$systemdsystemunitdir/systemd-sysusers.service.d/sysusers-dracut.conf"
 
+    inst_sysusers basic.conf
+    inst_sysusers systemd.conf
+
     inst_multiple -o \
-        "$sysusers"/basic.conf \
-        "$sysusers"/systemd.conf \
         "$systemdsystemunitdir"/systemd-sysusers.service \
         "$systemdsystemunitdir"/sysinit.target.wants/systemd-sysusers.service \
         systemd-sysusers
@@ -36,8 +37,6 @@ install() {
     # Install the hosts local user configurations if enabled.
     if [[ $hostonly ]]; then
         inst_multiple -H -o \
-            "$sysusersconfdir"/basic.conf \
-            "$sysusersconfdir"/systemd.conf \
             "$systemdsystemconfdir"/systemd-sysusers.service \
             "$systemdsystemconfdir/systemd-sysusers.service.d/*.conf"
     fi
index a2c675408662fa3573d75a687bafd6173d186363..0c065af6cdda13c8d19609a597c384667a244622 100755 (executable)
@@ -32,6 +32,8 @@ install() {
     # Enable this if networkd ( not the module ) is disabled at build time and you want to use timesyncd
     # inst_simple "$moddir/timesyncd-tmpfile-dracut.conf" "$tmpfilesdir/timesyncd-tmpfile-dracut.conf"
 
+    inst_sysusers systemd-timesync.conf
+
     inst_multiple -o \
         "$dbussystem"/org.freedesktop.timesync1.conf \
         "$dbussystemservices"/org.freedesktop.timesync1.service \
@@ -42,8 +44,7 @@ install() {
         "$systemdsystemunitdir"/systemd-timesyncd.service \
         "$systemdsystemunitdir/systemd-timesyncd.service.d/*.conf" \
         "$systemdsystemunitdir"/systemd-time-wait-sync.service \
-        "$systemdsystemunitdir/systemd-time-wait-sync.service.d/*.conf" \
-        "$sysusers"/systemd-timesync.conf
+        "$systemdsystemunitdir/systemd-time-wait-sync.service.d/*.conf"
 
     # Enable systemd type unit(s)
     for i in \
@@ -61,7 +62,6 @@ install() {
             "$systemdsystemconfdir"/systemd-timesyncd.service \
             "$systemdsystemconfdir/systemd-timesyncd.service.d/*.conf" \
             "$systemdsystemconfdir"/systemd-time-wait-sync.service \
-            "$systemdsystemconfdir/systemd-time-wait-sync.service.d/*.conf" \
-            "$sysusersconfdir"/systemd-timesync.conf
+            "$systemdsystemconfdir/systemd-time-wait-sync.service.d/*.conf"
     fi
 }
index a38fce8d55eab2d9c43fc8095f0e7c4ec495b395..2128c2805d8346a5d452cd1b2fa34db30e2f52bb 100755 (executable)
@@ -41,13 +41,14 @@ install() {
     inst_dir "$dbussystemconfdir"
     inst_dir "$dbussystemservicesconfdir"
 
+    inst_sysusers dbus.conf
+
     inst_multiple -o \
         "$dbus"/session.conf \
         "$dbus"/system.conf \
         "$dbussystem"/org.freedesktop.systemd1.conf \
         "$dbusservicesconfdir"/org.freedesktop.systemd1.service \
         "$dbussystemservices"/org.freedesktop.systemd1.service \
-        "$sysusers"/dbus.conf \
         "$systemdcatalog"/dbus-broker.catalog \
         "$systemdcatalog"/dbus-broker-launch.catalog \
         "$systemdsystemunitdir"/dbus-broker.service \
@@ -75,7 +76,6 @@ install() {
         inst_multiple -H -o \
             "$dbusconfdir"/session.conf \
             "$dbusconfdir"/system.conf \
-            "$sysusersconfdir"/dbus.conf \
             "$systemdsystemconfdir"/dbus.socket \
             "$systemdsystemconfdir"/dbus.socket.d/*.conf \
             "$systemdsystemconfdir"/dbus-broker.service \
index 4106e3e0a7103516bf381425d6a3eaad007613e4..4441f55283ec3e99d7470f97671240382406fdc3 100755 (executable)
@@ -30,9 +30,9 @@ installkernel() {
 
 # Install the required file(s) and directories for the module in the initramfs.
 install() {
+    inst_sysusers tpm2-tss.conf
 
     inst_multiple -o \
-        "$sysusers"/tpm2-tss.conf \
         "$tmpfilesdir"/tpm2-tss-fapi.conf \
         "$udevrulesdir"/60-tpm-udev.rules \
         "$systemdutildir"/system-generators/systemd-tpm2-generator \