]> git.ipfire.org Git - ipfire-2.x.git/blame - src/initscripts/init.d/dnsmasq
Remove python2.4 files at core update.
[ipfire-2.x.git] / src / initscripts / init.d / dnsmasq
CommitLineData
d1e90efc
MT
1#!/bin/sh
2########################################################################
3# Begin $rc_base/init.d/dnsmasq
4#
5# Description : dnsmasq init script
6#
7# Authors : Michael Tremer - mitch@ipfire.org
8#
9# Version : 01.00
10#
11# Notes :
12#
13########################################################################
14
15. /etc/sysconfig/rc
16. ${rc_functions}
17
f480386f
MT
18SHOW_SRV=1
19
d1e90efc
MT
20case "${1}" in
21 start)
22 boot_mesg "Starting Domain Name Service Proxy..."
23
24 eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
25 ARGS=
f480386f
MT
26 [ "$DOMAIN_NAME_GREEN" != "" ] && ARGS="-s $DOMAIN_NAME_GREEN"
27
28 echo > /var/ipfire/red/resolv.conf # Clear it
29 if [ -e "/var/ipfire/red/dns1" ]; then
30 DNS1=$(cat /var/ipfire/red/dns1 2>/dev/null)
2789f357
AF
31 if [ ! -z ${DNS1} ]; then
32 echo "nameserver ${DNS1}" >> /var/ipfire/red/resolv.conf
33 fi
f480386f
MT
34 fi
35 if [ -e "/var/ipfire/red/dns2" ]; then
36 DNS2=$(cat /var/ipfire/red/dns2 2>/dev/null)
2789f357
AF
37 if [ ! -z ${DNS2} ]; then
38 echo "nameserver ${DNS2}" >> /var/ipfire/red/resolv.conf
39 fi
f480386f
MT
40 fi
41 [ -e "/var/ipfire/red/active" ] && ARGS="$ARGS -r /var/ipfire/red/resolv.conf"
d1e90efc 42
63aceb22
CS
43 ARGS="$ARGS --domain=`cat /var/ipfire/main/settings |grep DOMAIN |cut -d = -f 2`"
44
d1e90efc 45 loadproc /usr/sbin/dnsmasq -l /var/state/dhcp/dhcpd.leases $ARGS
f480386f
MT
46
47 if [ "${SHOW_SRV}" -eq 1 ] && [ "${DNS1}" != "" -o "${DNS2}" != "" ]; then
48 boot_mesg "Using DNS server(s): ${DNS1} ${DNS2}"
49 boot_mesg_flush
50 fi
d1e90efc
MT
51 ;;
52
53 stop)
54 boot_mesg "Stopping Domain Name Service Proxy..."
55 killproc /usr/sbin/dnsmasq
56 ;;
57
58 restart)
59 ${0} stop
60 sleep 1
61 ${0} start
62 ;;
63
64 status)
65 statusproc /usr/sbin/dnsmasq
66 ;;
67
68 *)
69 echo "Usage: ${0} {start|stop|restart|status}"
70 exit 1
71 ;;
72esac
73
74# End $rc_base/init.d/dnsmasq