]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
wsdd: Compose the ARGS array only when we need it
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 11 Jan 2024 15:15:13 +0000 (16:15 +0100)
committerDaniel Weismüller <daniel.weismueller@ipfire.org>
Thu, 11 Jan 2024 15:15:13 +0000 (16:15 +0100)
Signed-off-by: Daniel Weismüller <daniel.weismueller@ipfire.org>
src/initscripts/packages/wsdd

index 22af031695a9917a2d372f58296c740edfa4773a..2a153107ef2e5ade91d8c84226e61b9ab44d6ad5 100644 (file)
@@ -29,29 +29,29 @@ mkdir -p /var/run/wsdd
 
 PIDFILE="/var/run/wsdd.pid"
 
-ARGS=(
-       # Launch as non-privileged user
-       "--user" "wsdd:wsdd"
+case "$1" in
+       start)
+               ARGS=(
+                       # Launch as non-privileged user
+                       "--user" "wsdd:wsdd"
 
-       # Launch in chroot
-       "--chroot" "/var/run/wsdd"
+                       # Launch in chroot
+                       "--chroot" "/var/run/wsdd"
 
-       # Only use IPv4
-       "--ipv4only"
+                       # Only use IPv4
+                       "--ipv4only"
 
-       # Configure the workgroup
-       "--workgroup" "$(testparm -s --parameter-name workgroup 2>/dev/null)"
-)
+                       # Configure the workgroup
+                       "--workgroup" "$(testparm -s --parameter-name workgroup 2>/dev/null)"
+               )
 
-# Conditionally add the GREEN/BLUE interface
-for intf in GREEN_DEV BLUE_DEV; do
-       if [ -n "${!intf}" ]; then
-               ARGS+=( "--interface" "${!intf}" )
-       fi
-done
+               # Conditionally add the GREEN/BLUE interface
+               for intf in GREEN_DEV BLUE_DEV; do
+                       if [ -n "${!intf}" ]; then
+                               ARGS+=( "--interface" "${!intf}" )
+                       fi
+               done
 
-case "$1" in
-       start)
                boot_mesg "Starting wsdd daemon..."
                loadproc -b -p "${PIDFILE}" /usr/bin/wsdd "${ARGS[@]}"
                ;;