logger -p daemon.error -t 'wsdd2' "samba36/4 or ksmbd is not running, can't start wsdd2!"
exit 1
}
+
+ # cleanup comments
+ local smb_conf
+ smb_conf="$(grep '^[[:blank:]]*[^[:blank:]#;]' $SMB_CONF)"
local nb_name
- nb_name="$(grep -i 'netbios name' $SMB_CONF | awk -F'=' '{print $2}' | tr -d ' \n')"
+ nb_name="$(echo "$smb_conf" | grep -i 'netbios name' | awk -F'=' '{print $2}' | tr -d ' \n')"
[ -n "$nb_name" ] && NB_PARM="$nb_name"
+ # use uppercase for none mdns option
+ local nb_option
+ nb_option="$(echo "$smb_conf" | grep -i 'mdns name' | awk -F'=' '{print $2}' | tr -d ' \n')"
+ [ "$nb_option" != "mdns" ] && NB_PARM="$(echo "$nb_name" | awk '{print toupper($0)}')"
+
local wg_name
- wg_name="$(grep -i 'workgroup' $SMB_CONF | awk -F'=' '{print $2}' | tr -d ' \n')"
+ wg_name="$(echo "$smb_conf" | grep -i 'workgroup' | awk -F'=' '{print $2}' | tr -d ' \n')"
[ -n "$wg_name" ] && WG_PARM="$wg_name"
# resolve lan interface (BUG: No multi-interface binds atm)