summaryrefslogtreecommitdiff
path: root/samba-common.dhcp
diff options
context:
space:
mode:
authorvorlon <vorlon@alioth.debian.org>2003-06-12 20:08:08 +0000
committervorlon <vorlon@alioth.debian.org>2003-06-12 20:08:08 +0000
commit2bd722e4dcc2a504905c808fb1b833d37e5a69da (patch)
tree11d59faff4662fcc1cb8bc7ddbf6977beb092566 /samba-common.dhcp
parentf2984a335749f99d4e4015363ad6996bdc48bad1 (diff)
downloadsamba-2bd722e4dcc2a504905c808fb1b833d37e5a69da.tar.gz
make the dhcp hook script sourceable
git-svn-id: svn://svn.debian.org/svn/pkg-samba/trunk@537 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'samba-common.dhcp')
-rw-r--r--samba-common.dhcp53
1 files changed, 29 insertions, 24 deletions
diff --git a/samba-common.dhcp b/samba-common.dhcp
index 0ec8a0ff80..498f3fa0f0 100644
--- a/samba-common.dhcp
+++ b/samba-common.dhcp
@@ -1,29 +1,34 @@
#!/bin/sh
-# No need to continue if we're called with an unsupported option
+netbios_setup() {
+ # No need to continue if we're called with an unsupported option
-if [ "$reason" != BOUND ] && [ "$reason" != RENEW ] \
- && [ "$reason" != REBIND ] && [ "$reason" != REBOOT ] \
- && [ "$reason" != EXPIRE ] && [ "$reason" != FAIL ]
-then
- exit 0
-fi
+ if [ "$reason" != BOUND ] && [ "$reason" != RENEW ] \
+ && [ "$reason" != REBIND ] && [ "$reason" != REBOOT ] \
+ && [ "$reason" != EXPIRE ] && [ "$reason" != FAIL ]
+ then
+ return
+ fi
-umask 022
+ umask 022
-if [ -z "$new_netbios_name_servers" ] || [ "$reason" = FAIL ] \
- || [ "$reason" = EXPIRE ]
-then
- # FIXME: add sed magic to only remove wins servers
- # associated with this interface
- echo -n > /etc/samba/dhcp.conf
-elif [ "$new_netbios_name_servers" != "old_netbios_name_servers" ]
-then
- for server in $new_netbios_name_servers
- do
- serverlist="$serverlist $interface:$server"
- done
- # FIXME: add sed magic to only update wins servers
- # associated with this interface
- echo " wins server =$serverlist" > /etc/samba/dhcp.conf
-fi
+ if [ -z "$new_netbios_name_servers" ] || [ "$reason" = FAIL ] \
+ || [ "$reason" = EXPIRE ]
+ then
+ # FIXME: add sed magic to only remove wins servers
+ # associated with this interface
+ echo -n > /etc/samba/dhcp.conf
+ elif [ "$new_netbios_name_servers" != "old_netbios_name_servers" ]
+ then
+ local serverlist=""
+ for server in $new_netbios_name_servers
+ do
+ serverlist="$serverlist $interface:$server"
+ done
+ # FIXME: add sed magic to only update wins servers
+ # associated with this interface
+ echo " wins server =$serverlist" > /etc/samba/dhcp.conf
+ fi
+}
+
+netbios_setup