]>
Commit | Line | Data |
---|---|---|
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 |
18 | SHOW_SRV=1 |
19 | ||
d1e90efc MT |
20 | case "${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) | |
31 | echo "nameserver ${DNS1}" >> /var/ipfire/red/resolv.conf | |
32 | fi | |
33 | if [ -e "/var/ipfire/red/dns2" ]; then | |
34 | DNS2=$(cat /var/ipfire/red/dns2 2>/dev/null) | |
35 | echo "nameserver ${DNS2}" >> /var/ipfire/red/resolv.conf | |
36 | fi | |
37 | [ -e "/var/ipfire/red/active" ] && ARGS="$ARGS -r /var/ipfire/red/resolv.conf" | |
d1e90efc | 38 | |
63aceb22 CS |
39 | ARGS="$ARGS --domain=`cat /var/ipfire/main/settings |grep DOMAIN |cut -d = -f 2`" |
40 | ||
d1e90efc | 41 | loadproc /usr/sbin/dnsmasq -l /var/state/dhcp/dhcpd.leases $ARGS |
f480386f MT |
42 | |
43 | if [ "${SHOW_SRV}" -eq 1 ] && [ "${DNS1}" != "" -o "${DNS2}" != "" ]; then | |
44 | boot_mesg "Using DNS server(s): ${DNS1} ${DNS2}" | |
45 | boot_mesg_flush | |
46 | fi | |
d1e90efc MT |
47 | ;; |
48 | ||
49 | stop) | |
50 | boot_mesg "Stopping Domain Name Service Proxy..." | |
51 | killproc /usr/sbin/dnsmasq | |
52 | ;; | |
53 | ||
54 | restart) | |
55 | ${0} stop | |
56 | sleep 1 | |
57 | ${0} start | |
58 | ;; | |
59 | ||
60 | status) | |
61 | statusproc /usr/sbin/dnsmasq | |
62 | ;; | |
63 | ||
64 | *) | |
65 | echo "Usage: ${0} {start|stop|restart|status}" | |
66 | exit 1 | |
67 | ;; | |
68 | esac | |
69 | ||
70 | # End $rc_base/init.d/dnsmasq |