summaryrefslogtreecommitdiff
path: root/package/network/services/dnsmasq/files/dnsmasq.init
diff options
context:
space:
mode:
Diffstat (limited to 'package/network/services/dnsmasq/files/dnsmasq.init')
-rw-r--r--package/network/services/dnsmasq/files/dnsmasq.init40
1 files changed, 23 insertions, 17 deletions
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index 630c07d1d8..a0aee8e02b 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -3,7 +3,8 @@
START=60
-SERVICE_USE_PID=1
+USE_PROCD=1
+PROG=/usr/sbin/dnsmasq
DNS_SERVERS=""
DOMAIN=""
@@ -479,7 +480,12 @@ dhcp_hostrecord_add() {
xappend "--host-record=$record"
}
-start() {
+service_triggers()
+{
+ procd_add_reload_trigger "dhcp"
+}
+
+start_service() {
include /lib/network
scan_interfaces
@@ -488,6 +494,10 @@ start() {
config_load dhcp
+ procd_open_instance
+ procd_set_param command $PROG -C $CONFIGFILE -k
+ procd_close_instance
+
# before we can call xappend
mkdir -p $(dirname $CONFIGFILE)
@@ -528,23 +538,19 @@ start() {
config_foreach dhcp_cname_add cname
echo >> $CONFIGFILE
- service_start /usr/sbin/dnsmasq -C $CONFIGFILE && {
- rm -f /tmp/resolv.conf
- [ $ADD_LOCAL_DOMAIN -eq 1 ] && [ -n "$DOMAIN" ] && {
- echo "search $DOMAIN" >> /tmp/resolv.conf
- }
- DNS_SERVERS="$DNS_SERVERS 127.0.0.1"
- for DNS_SERVER in $DNS_SERVERS ; do
- echo "nameserver $DNS_SERVER" >> /tmp/resolv.conf
- done
+ rm -f /tmp/resolv.conf
+ [ $ADD_LOCAL_DOMAIN -eq 1 ] && [ -n "$DOMAIN" ] && {
+ echo "search $DOMAIN" >> /tmp/resolv.conf
}
+ DNS_SERVERS="$DNS_SERVERS 127.0.0.1"
+ for DNS_SERVER in $DNS_SERVERS ; do
+ echo "nameserver $DNS_SERVER" >> /tmp/resolv.conf
+ done
}
-stop() {
- service_stop /usr/sbin/dnsmasq && {
- [ -f /tmp/resolv.conf ] && {
- rm -f /tmp/resolv.conf
- ln -s /tmp/resolv.conf.auto /tmp/resolv.conf
- }
+stop_service() {
+ [ -f /tmp/resolv.conf ] && {
+ rm -f /tmp/resolv.conf
+ ln -s /tmp/resolv.conf.auto /tmp/resolv.conf
}
}