|
Added
Link Here
|
| 1 |
--- etc/rc.d/wsdd.orig 2020-06-28 19:10:44 UTC |
| 2 |
+++ etc/rc.d/wsdd |
| 3 |
@@ -5,25 +5,61 @@ |
| 4 |
# BEFORE: login |
| 5 |
# KEYWORD: shutdown |
| 6 |
|
| 7 |
+# Add the following line in /etc/rc.conf to enable wsdd: |
| 8 |
+# |
| 9 |
+# wsdd_enable="YES" |
| 10 |
+# wsdd_flags="<set as needed>" |
| 11 |
+# wsdd_domain="<set if your host is an AD member>" |
| 12 |
+# wsdd_group="<set if you want to set the workgroup manually>" |
| 13 |
+# |
| 14 |
+# Do not specify -d DOMAIN or -w WORKGROUP in wsdd_flags. Instead, set |
| 15 |
+# wsdd_domain="DOMAIN" or wsdd_group="WORKGROUP", otherwise it will be |
| 16 |
+# overridden by automatically detected workgroup. |
| 17 |
+# |
| 18 |
+ |
| 19 |
. /etc/rc.subr |
| 20 |
|
| 21 |
name=wsdd |
| 22 |
rcvar=wsdd_enable |
| 23 |
-wsdd_group=$(/usr/local/bin/testparm -s --parameter-name workgroup 2>/dev/null) |
| 24 |
|
| 25 |
-: ${wsdd_smb_config_file="/usr/local/etc/smb4.conf"} |
| 26 |
+load_rc_config ${name} |
| 27 |
|
| 28 |
-# try to manually extract workgroup from samba configuration if testparm failed |
| 29 |
-if [ -z "$wsdd_group" ] && [ -r $wsdd_smb_config_file ]; then |
| 30 |
- wsdd_group="$(grep -i '^[[:space:]]*workgroup[[:space:]]*=' $wsdd_smb_config_file | cut -f2 -d= | tr -d '[:blank:]')" |
| 31 |
+: ${wsdd_enable:="NO"} |
| 32 |
+: ${wsdd_flags:=""} |
| 33 |
+: ${wsdd_domain:=""} |
| 34 |
+: ${wsdd_group:=""} |
| 35 |
+: ${wsdd_smb_config_file:="/usr/local/etc/smb4.conf"} |
| 36 |
+ |
| 37 |
+if [ -z "${wsdd_group}" ]; then |
| 38 |
+ # automatic detection of workgroup |
| 39 |
+ wsdd_group=$(/usr/local/bin/testparm -s --parameter-name workgroup 2>/dev/null) |
| 40 |
+ |
| 41 |
+ # try to manually extract workgroup from samba configuration if testparm failed |
| 42 |
+ if [ -z "$wsdd_group" ] && [ -r $wsdd_smb_config_file ]; then |
| 43 |
+ wsdd_group="$(grep -i '^[[:space:]]*workgroup[[:space:]]*=' $wsdd_smb_config_file | cut -f2 -d= | tr -d '[:blank:]')" |
| 44 |
+ fi |
| 45 |
fi |
| 46 |
|
| 47 |
-if [ -n "$wsdd_group" ]; then |
| 48 |
- wsdd_opts="-w ${wsdd_group}" |
| 49 |
+wsdd_opts="" |
| 50 |
+if [ -n "${wsdd_suppflags}" ]; then |
| 51 |
+ wsdd_opts="${wsdd_flags}" |
| 52 |
fi |
| 53 |
+if [ -n "$wsdd_domain" ]; then |
| 54 |
+ wsdd_opts="${wsdd_opts} -d ${wsdd_domain}" |
| 55 |
+elif [ -n "$wsdd_group" ]; then |
| 56 |
+ wsdd_opts="${wsdd_opts} -w ${wsdd_group}" |
| 57 |
+fi |
| 58 |
|
| 59 |
-command="/usr/sbin/daemon" |
| 60 |
-command_args="-u daemon -S /usr/local/bin/wsdd $wsdd_opts" |
| 61 |
+command="/usr/local/bin/wsdd" |
| 62 |
+procname="PYTHON" |
| 63 |
+pidfile="/var/run/${name}.pid" |
| 64 |
|
| 65 |
-load_rc_config $name |
| 66 |
+start_cmd="${name}_start" |
| 67 |
+ |
| 68 |
+wsdd_start() |
| 69 |
+{ |
| 70 |
+ echo -n "Starting ${name}." |
| 71 |
+ /usr/sbin/daemon -u daemon -S -p ${pidfile} ${command} ${wsdd_opts} |
| 72 |
+} |
| 73 |
+ |
| 74 |
run_rc_command "$1" |