]>
Commit | Line | Data |
---|---|---|
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 | ||
18 | SHOW_SRV=1 | |
19 | ||
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= | |
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" | |
38 | ||
39 | loadproc /usr/sbin/dnsmasq -l /var/state/dhcp/dhcpd.leases $ARGS | |
40 | ||
41 | if [ "${SHOW_SRV}" -eq 1 ] && [ "${DNS1}" != "" -o "${DNS2}" != "" ]; then | |
42 | boot_mesg "Using DNS server(s): ${DNS1} ${DNS2}" | |
43 | boot_mesg_flush | |
44 | fi | |
45 | ;; | |
46 | ||
47 | stop) | |
48 | boot_mesg "Stopping Domain Name Service Proxy..." | |
49 | killproc /usr/sbin/dnsmasq | |
50 | ;; | |
51 | ||
52 | restart) | |
53 | ${0} stop | |
54 | sleep 1 | |
55 | ${0} start | |
56 | ;; | |
57 | ||
58 | status) | |
59 | statusproc /usr/sbin/dnsmasq | |
60 | ;; | |
61 | ||
62 | *) | |
63 | echo "Usage: ${0} {start|stop|restart|status}" | |
64 | exit 1 | |
65 | ;; | |
66 | esac | |
67 | ||
68 | # End $rc_base/init.d/dnsmasq |