Annotation of embedaddon/dnsmasq/contrib/openvpn/dhclient-enter-hooks, revision 1.1.1.1
1.1 misho 1: #!/bin/bash
2:
3: function save_previous() {
4: if [ -e $1 -a ! -e $1.predhclient ]; then
5: mv $1 $1.predhclient
6: fi
7: }
8:
9: function write_resolv_conf() {
10: RESOLVCONF=$1
11: if [ -n "$new_domain_name" ] || [ -n "$new_domain_name_servers" ]; then
12: save_previous $RESOLVCONF
13: echo '; generated by /etc/dhclient-enter-hooks' > $RESOLVCONF
14: if [ -n "$SEARCH" ]; then
15: echo search $SEARCH >> $RESOLVCONF
16: else
17: if [ -n "$new_domain_name" ]; then
18: echo search $new_domain_name >> $RESOLVCONF
19: fi
20: fi
21: chmod 644 $RESOLVCONF
22: for nameserver in $new_domain_name_servers; do
23: echo nameserver $nameserver >>$RESOLVCONF
24: done
25: fi
26: }
27:
28: make_resolv_conf() {
29: write_resolv_conf /etc/resolv.conf
30: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>