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,54 @@ |
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 |
+load_rc_config ${name} |
26 |
+ |
27 |
+: ${wsdd_suppflags=""} |
28 |
+: ${wsdd_domain=""} |
29 |
+: ${wsdd_group=""} |
30 |
: ${wsdd_smb_config_file="/usr/local/etc/smb4.conf"} |
31 |
|
32 |
-# try to manually extract workgroup from samba configuration if testparm failed |
33 |
-if [ -z "$wsdd_group" ] && [ -r $wsdd_smb_config_file ]; then |
34 |
- wsdd_group="$(grep -i '^[[:space:]]*workgroup[[:space:]]*=' $wsdd_smb_config_file | cut -f2 -d= | tr -d '[:blank:]')" |
35 |
+if [ -z "${wsdd_group}" ]; then |
36 |
+ # automatic detection of workgroup |
37 |
+ wsdd_group=$(/usr/local/bin/testparm -s --parameter-name workgroup 2>/dev/null) |
38 |
+ |
39 |
+ # try to manually extract workgroup from samba configuration if testparm failed |
40 |
+ if [ -z "$wsdd_group" ] && [ -r $wsdd_smb_config_file ]; then |
41 |
+ wsdd_group="$(grep -i '^[[:space:]]*workgroup[[:space:]]*=' $wsdd_smb_config_file | cut -f2 -d= | tr -d '[:blank:]')" |
42 |
+ fi |
43 |
fi |
44 |
|
45 |
-if [ -n "$wsdd_group" ]; then |
46 |
- wsdd_opts="-w ${wsdd_group}" |
47 |
+wsdd_opts="" |
48 |
+if [ -n "${wsdd_suppflags}" ]; then |
49 |
+ wsdd_opts="${wsdd_suppflags}" |
50 |
fi |
51 |
+if [ -n "$wsdd_domain" ]; then |
52 |
+ wsdd_opts="${wsdd_opts} -d ${wsdd_domain}" |
53 |
+elif [ -n "$wsdd_group" ]; then |
54 |
+ wsdd_opts="${wsdd_opts} -w ${wsdd_group}" |
55 |
+fi |
56 |
|
57 |
command="/usr/sbin/daemon" |
58 |
-command_args="-u daemon -S /usr/local/bin/wsdd $wsdd_opts" |
59 |
+procname="PYTHON" |
60 |
+pidfile="/var/run/${name}.pid" |
61 |
+command_args="-u daemon -S -p $pidfile /usr/local/bin/wsdd $wsdd_opts" |
62 |
|
63 |
load_rc_config $name |
64 |
run_rc_command "$1" |