Contents of /trunk/ppp/ip-upd-30-wins.sh
Parent Directory | Revision Log
Revision 796 -
(show annotations)
(download)
(as text)
Mon May 11 09:39:21 2009 UTC (15 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 1122 byte(s)
Mon May 11 09:39:21 2009 UTC (15 years, 4 months ago) by niro
File MIME type: application/x-sh
File size: 1122 byte(s)
new ip up down from gentoo
1 | #!/bin/sh |
2 | |
3 | # Handle smb.conf updating when the usepeerwins pppd option is being used. |
4 | # Used parameters and environment variables: |
5 | # $1 - interface name (e.g. ppp0) |
6 | # $USEPEERWINS - set if user specified usepeerdns |
7 | # $WINS1 and $WINS2 - WINS servers reported by peer |
8 | # Will additionally "tag" the wins servers, as explained in smb.conf(5), using the $1 value. |
9 | |
10 | if [ "$USEPEERWINS" = 1 -a -f /etc/samba/smb.conf ]; then |
11 | # Add global section if it is needed |
12 | grep -qi '\[[[:space:]]*global[[:space:]]*\]' /etc/samba/smb.conf \ |
13 | || sed -i -e '1i[global]' /etc/samba/smb.conf |
14 | |
15 | # Add wins server line if is missing |
16 | grep -qi '^[[:space:]]*wins[[:space:]]*server[[:space:]]*=' /etc/samba/smb.conf \ |
17 | || sed -i -e '/\[[[:space:]]*global[[:space:]]*\]/a\ wins server =' /etc/samba/smb.conf |
18 | |
19 | # Set the WINS servers |
20 | winsservers= |
21 | [ -n "$WINS1" ] && winsservers="$winsservers $1:$WINS1" |
22 | [ -n "$WINS2" ] && winsservers="$winsservers $1:$WINS2" |
23 | sed -i -e "s/^\([[:space:]]*wins[[:space:]]*server[[:space:]]*=[^#]*\)/\1 $winsservers /i" /etc/samba/smb.conf |
24 | |
25 | # Reload nmbd configuration |
26 | smbcontrol nmbd reload-config |
27 | fi |