From 3ba3a0ba4af8fc2919271495e7df67ee900e338c Mon Sep 17 00:00:00 2001 From: Andy Walsh Date: Sat, 18 Jul 2020 13:00:22 +0200 Subject: [PATCH] wsdd2: Uppercase NB_PARM * Uppercase NB_PARM if mdns option is not set * filter commented lines Signed-off-by: Andy Walsh --- net/wsdd2/Makefile | 2 +- net/wsdd2/files/wsdd2.init | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/net/wsdd2/Makefile b/net/wsdd2/Makefile index ac910fe6d5..ef09983516 100644 --- a/net/wsdd2/Makefile +++ b/net/wsdd2/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wsdd2 -PKG_RELEASE:=8 +PKG_RELEASE:=9 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/Andy2244/wsdd2.git diff --git a/net/wsdd2/files/wsdd2.init b/net/wsdd2/files/wsdd2.init index ca9653d6c7..d86c658611 100644 --- a/net/wsdd2/files/wsdd2.init +++ b/net/wsdd2/files/wsdd2.init @@ -29,13 +29,22 @@ start_service() { 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) -- 2.30.2