p910nd: init: only run mDNS changes if mdns is set to on
authorPaul Donald <newtwen@gmail.com>
Sat, 10 Feb 2024 17:37:00 +0000 (18:37 +0100)
committerPaul Donald <newtwen@gmail.com>
Wed, 14 Feb 2024 23:05:59 +0000 (00:05 +0100)
i.e. don't do the extra work unless mdns setting is enabled

Signed-off-by: Paul Donald <newtwen@gmail.com>
(cherry picked from commit 2c5927cfac6aa867bc892d499170fdf4d7d1f5d8)

net/p910nd/files/p910nd.init

index 2332d917535d452910ffebadc65742a8efb81963..ad0ddfe11c9bf55d6fc791fe9fc468794c8b2255 100644 (file)
@@ -47,14 +47,15 @@ start_p910nd() {
                [ "$runas_root" -ne 1 ] && procd_set_param user $DAEMON_NAME
 
                config_get_bool "mdns" "$section" "mdns" '0'
-               config_get mdns_note "$section" mdns_note
-               config_get mdns_ty "$section" mdns_ty
-               config_get mdns_product "$section" mdns_product
-               config_get mdns_mfg "$section" mdns_mfg
-               config_get mdns_mdl "$section" mdns_mdl
-               config_get mdns_cmd "$section" mdns_cmd
-               [ "$mdns" -gt 0 ] && procd_add_mdns "pdl-datastream" "tcp" "$((port+9100))" "note=$mdns_note" "ty=$mdns_ty" "product=$mdns_product" "usb_MFG=$mdns_mfg" "usb_MDL=$mdns_mdl" "usb_CMD=$mdns_cmd"
-
+               if [ "$mdns" -gt 0 ]; then
+                       config_get mdns_note "$section" mdns_note
+                       config_get mdns_ty "$section" mdns_ty
+                       config_get mdns_product "$section" mdns_product
+                       config_get mdns_mfg "$section" mdns_mfg
+                       config_get mdns_mdl "$section" mdns_mdl
+                       config_get mdns_cmd "$section" mdns_cmd
+                       procd_add_mdns "pdl-datastream" "tcp" "$((port+9100))" "note=$mdns_note" "ty=$mdns_ty" "product=$mdns_product" "usb_MFG=$mdns_mfg" "usb_MDL=$mdns_mdl" "usb_CMD=$mdns_cmd"
+               fi
                procd_close_instance
        fi
 }