]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(network-wicked): shellcheck for modules.d/35network-wicked
authorHarald Hoyer <harald@redhat.com>
Fri, 26 Mar 2021 09:29:14 +0000 (10:29 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Mon, 29 Mar 2021 07:57:23 +0000 (09:57 +0200)
modules.d/35network-wicked/.shchkdir [new file with mode: 0644]
modules.d/35network-wicked/module-setup.sh

diff --git a/modules.d/35network-wicked/.shchkdir b/modules.d/35network-wicked/.shchkdir
new file mode 100644 (file)
index 0000000..e69de29
index 68c43ae898f378f01cef842104ba28447b11d38b..5325a23d21bc657db7906e804151039928373e6b 100755 (executable)
@@ -2,8 +2,6 @@
 
 # called by dracut
 check() {
-    local _program
-
     require_binaries wicked || return 1
 
     # do not add this module by default
@@ -23,6 +21,8 @@ installkernel() {
 
 # called by dracut
 install() {
+    local -a wicked_units
+
     inst_hook cmdline 99 "$moddir/wicked-config.sh"
 
     # Seems to not execute if in initqueue/settled
@@ -44,23 +44,25 @@ install() {
     inst_multiple "/usr/libexec/wicked/bin/*"
     inst_multiple "/usr/sbin/wicked*"
 
-    wicked_units="
-        $systemdsystemunitdir/wickedd.service \
-        $systemdsystemunitdir/wickedd-auto4.service \
-        $systemdsystemunitdir/wickedd-dhcp4.service \
-        $systemdsystemunitdir/wickedd-dhcp6.service \
-        $systemdsystemunitdir/wickedd-nanny.service"
+    wicked_units=(
+        "$systemdsystemunitdir"/wickedd.service
+        "$systemdsystemunitdir"/wickedd-auto4.service
+        "$systemdsystemunitdir"/wickedd-dhcp4.service
+        "$systemdsystemunitdir"/wickedd-dhcp6.service
+        "$systemdsystemunitdir"/wickedd-nanny.service
+    )
 
-    inst_multiple $wicked_units
+    inst_multiple "${wicked_units[@]}"
 
-    for unit in $wicked_units; do
-        sed -i 's/^After=.*/After=dbus.service/g' $initdir/$unit
-        sed -i 's/^Before=\(.*\)/Before=\1 dracut-pre-udev.service/g' $initdir/$unit
-        sed -i 's/^Wants=\(.*\)/Wants=\1 dbus.service/g' $initdir/$unit
+    for unit in "${wicked_units[@]}"; do
+        sed -i 's/^After=.*/After=dbus.service/g' "$initdir/$unit"
+        sed -i 's/^Before=\(.*\)/Before=\1 dracut-pre-udev.service/g' "$initdir/$unit"
+        sed -i 's/^Wants=\(.*\)/Wants=\1 dbus.service/g' "$initdir/$unit"
+        # shellcheck disable=SC1004
         sed -i -e \
             '/^\[Unit\]/aDefaultDependencies=no\
             Conflicts=shutdown.target\
             Before=shutdown.target' \
-            "$initdir"$unit
+            "$initdir/$unit"
     done
 }