Debian Codegraph @

debian/is-configured

raw
1 #! /bin/sh
2 # Check if the given service (smb|nmb|winbind|samba)
3 # should be run according to the settings in smb.conf
4
5 [ -f /etc/samba/smb.conf ] || exit 1
6
7 server_role=$(testparm -s --parameter-name="server role" 2>/dev/null)
8 [ "active directory domain controller" = "$server_role" ] \
9 && addc=1 || addc=0
10
11 case "$1" in
12 ( smb | smbd )
13 exit $addc
14 ;;
15 ( winbind | winbindd )
16 exit $addc
17 ;;
18 ( nmb | nmbd )
19 [ "$addc" = 1 ] && exit 1
20 disable_netbios=$(testparm -s --parameter-name="disable netbios" 2>/dev/null)
21 [ Yes = "$disable_netbios" ] && exit 1 || exit 0
22 ;;
23 ( samba | samba-ad-dc )
24 # source4/samba/server.c checks for other parameters too, even if !AD-DC
25 # Should we support these?
26 exit $((!$addc))
27 ;;
28 ( * )
29 echo "Wrong usage: should be smb|nmb|winbind|samba" >&2
30 exit 255
31 ;;
32 esac