r11395: Update the Debian packaging.
[Samba.git] / packaging / Debian / debian-sarge / samba-common.dhcp
blob3b5a05ff5732473d4b9834f2e9d27efdb143dbe2
1 #!/bin/sh
3 SAMBA_DHCP_CONF=/etc/samba/dhcp.conf
5 netbios_setup() {
6 # No need to continue if we're called with an unsupported option
8 if [ "$reason" != BOUND ] && [ "$reason" != RENEW ] \
9 && [ "$reason" != REBIND ] && [ "$reason" != REBOOT ] \
10 && [ "$reason" != EXPIRE ] && [ "$reason" != FAIL ]
11 then
12 return
15 # Nor should we continue if no settings have changed
16 if [ "$new_netbios_name_servers" = "$old_netbios_name_servers" ] \
17 && [ "$new_netbios_scope" = "$old_netbios_scope" ]
18 then
19 return
22 # reparse our own file
23 local other_servers=`sed -n -e"s/[[:space:]]$interface:[^[:space:]]*//g; \
24 s/^[[:space:]]*wins server[[:space:]]*=[[:space:]]*//pi" \
25 $SAMBA_DHCP_CONF`
27 umask 022
29 local serverlist="$other_servers"
30 for server in $new_netbios_name_servers
32 serverlist="$serverlist $interface:$server"
33 done
35 echo -n > $SAMBA_DHCP_CONF
37 # If we're updating on failure/expire, AND there are no WINS
38 # servers for other interfaces, leave the file empty.
39 if [ -z "$other_servers" ]
40 then
41 if [ "$reason" = FAIL ] || [ "$reason" = EXPIRE ]
42 then
43 return
47 if [ -n "$serverlist" ]
48 then
49 echo " wins server =$serverlist" >> $SAMBA_DHCP_CONF
51 if [ -n "$new_netbios_scope" ]
52 then
53 echo " netbios scope = $new_netbios_scope" >> $SAMBA_DHCP_CONF
57 netbios_setup