diff options
author | John Crispin <john@openwrt.org> | 2013-09-17 21:45:30 +0000 |
---|---|---|
committer | John Crispin <john@openwrt.org> | 2013-09-17 21:45:30 +0000 |
commit | f87409440298121ae1fbd718a17267cc180438e4 (patch) | |
tree | 2ceea2187fddf2c9fb21cb43a27d69afdd55e81f /package/network/services/dnsmasq | |
parent | 4f62127dea854024116383c84fedb673baaae9cd (diff) | |
download | mtk-20170518-f87409440298121ae1fbd718a17267cc180438e4.zip mtk-20170518-f87409440298121ae1fbd718a17267cc180438e4.tar.gz mtk-20170518-f87409440298121ae1fbd718a17267cc180438e4.tar.bz2 |
procd: convert various packages to procd style init.d scripts
Signed-off-by: John Crispin <blogic@openwrt.org>
SVN-Revision: 38023
Diffstat (limited to 'package/network/services/dnsmasq')
-rw-r--r-- | package/network/services/dnsmasq/files/dnsmasq.init | 40 |
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 630c07d..a0aee8e 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 } } |