From: Paul Donald Date: Sun, 11 Feb 2024 02:30:56 +0000 (+0100) Subject: p910nd: init: line-break and conditionalize mDNS properties X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=ffa1bbbe7844aca3ae465cc7f1ba018cc4590579;p=openwrt-packages.git p910nd: init: line-break and conditionalize mDNS properties Signed-off-by: Paul Donald --- diff --git a/net/p910nd/files/p910nd.init b/net/p910nd/files/p910nd.init index ad0ddfe11..1c305a80f 100644 --- a/net/p910nd/files/p910nd.init +++ b/net/p910nd/files/p910nd.init @@ -54,7 +54,19 @@ start_p910nd() { 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" + + # Set initial arguments + set -- "pdl-datastream" "tcp" "$((port+9100))" + # bonjourprinting-1.2.1.pdf spec mandates (at least) MFG, MDL, CMD for Socket type + [ -n "$mdns_note" ] && set -- "$@" "note=$mdns_note" + [ -n "$mdns_ty" ] && set -- "$@" "ty=$mdns_ty" + [ -n "$mdns_product" ] && set -- "$@" "product=$mdns_product" + [ -n "$mdns_mfg" ] && set -- "$@" "usb_MFG=$mdns_mfg" + [ -n "$mdns_mdl" ] && set -- "$@" "usb_MDL=$mdns_mdl" + [ -n "$mdns_cmd" ] && set -- "$@" "usb_CMD=$mdns_cmd" + + # Call procd_add_mdns with the positional parameters + procd_add_mdns "$@" fi procd_close_instance fi