1 --- dnsmasq-2.22/rpm/dnsmasq.rh 2005-03-24 09:51:18.000000000 -0500 2 +++ dnsmasq-2.22/rpm/dnsmasq.rh.new 2005-08-25 10:52:04.310568784 -0400 3 @@ -2,7 +2,7 @@ 4 # 5 # Startup script for the DNS caching server 6 # 7 -# chkconfig: 2345 99 01 8 +# chkconfig: 2345 07 89 9 # description: This script starts your DNS caching server 10 # processname: dnsmasq 11 # pidfile: /var/run/dnsmasq.pid 12 @@ -10,6 +10,25 @@ 13 # Source function library. 14 . /etc/rc.d/init.d/functions 15 16 +function setup_dhclient_enter_hooks() { 17 + if [ -f /etc/dhclient-enter-hooks ]; then 18 + . /etc/dhclient-enter-hooks 19 + cp /etc/resolv.conf /etc/resolv.conf.dnsmasq 20 + cp /etc/dhclient-enter-hooks /etc/dhclient-enter-hooks.dnsmasq 21 + sed -e 's/resolv\.conf$/resolv.conf.dnsmasq/' /etc/dhclient-enter-hooks.dnsmasq > /etc/dhclient-enter-hooks 22 + sed -e 's/\(nameserver[ tab]\+\)[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+$/\1127.0.0.1/' /etc/resolv.conf.dnsmasq > /etc/resolv.conf 23 + fi 24 +} 25 + 26 +function teardown_dhclient_enter_hooks() { 27 + if [ -f /etc/dhclient-enter-hooks -a -f /etc/dhclient-enter-hooks.dnsmasq ]; then 28 + if [ -f /etc/resolv.conf.dnsmasq ]; then 29 + mv /etc/resolv.conf.dnsmasq /etc/resolv.conf 30 + fi 31 + mv /etc/dhclient-enter-hooks.dnsmasq /etc/dhclient-enter-hooks 32 + fi 33 +} 34 + 35 # Source networking configuration. 36 . /etc/sysconfig/network 37 38 @@ -24,7 +43,7 @@ 39 MAILHOSTNAME="" 40 # change this line if you want dns to get its upstream servers from 41 # somewhere other that /etc/resolv.conf 42 -RESOLV_CONF="" 43 +RESOLV_CONF="/etc/resolv.conf.dnsmasq" 44 # change this if you want dnsmasq to cache any "hostname" or "client-hostname" from 45 # a dhcpd's lease file 46 @@ -54,6 +73,7 @@ 47 case "$1" in 48 start) 49 echo -n "Starting dnsmasq: " 50 + setup_dhclient_enter_hooks 51 daemon $dnsmasq $OPTIONS 52 RETVAL=$? 53 echo 54 @@ -62,6 +82,7 @@ 55 stop) 56 if test "x`pidof dnsmasq`" != x; then 57 echo -n "Shutting down dnsmasq: " 58 + teardown_dhclient_enter_hooks 59 killproc dnsmasq 60 fi 61 RETVAL=$? 62