From: nbd Date: Sun, 20 Dec 2009 18:23:24 +0000 (+0000) Subject: ahcpd: rework init script (based on a patch by alx) X-Git-Url: http://207.154.207.93/?a=commitdiff_plain;h=87340f10d99548248b1e6a0a4a3ed4d20fb0f183;p=packages.git ahcpd: rework init script (based on a patch by alx) - use uci network interface names instead of direct interface names - start multiple instances if configured to do so git-svn-id: svn://svn.openwrt.org/openwrt/packages@18862 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- diff --git a/ipv6/ahcpd/files/ahcpd.config b/ipv6/ahcpd/files/ahcpd.config old mode 100755 new mode 100644 index dc9186c6f..c70b71d83 --- a/ipv6/ahcpd/files/ahcpd.config +++ b/ipv6/ahcpd/files/ahcpd.config @@ -1,6 +1,6 @@ -config ahcpd - option interfaces "wl0" - option no_config true - option no_dns false - option ipv4_only false - option ipv6_only false +config 'ahcpd' + option 'no_dns' 'false' + option 'ipv4_only' 'false' + option 'ipv6_only' 'false' + option 'no_config' 'false' + #list 'interface' 'wlan' diff --git a/ipv6/ahcpd/files/ahcpd.init b/ipv6/ahcpd/files/ahcpd.init index 5b0fe1965..12a845216 100644 --- a/ipv6/ahcpd/files/ahcpd.init +++ b/ipv6/ahcpd/files/ahcpd.init @@ -3,20 +3,20 @@ START=71 pidfile=/var/run/ahcpd.pid +addif() { + config_get ifname $1 ifname + append interfaces "$ifname" +} ahcpd_config() { local cfg="$1" - config_get interfaces "$cfg" interfaces + interfaces= + config_list_foreach $cfg interface addif + [ -z "$interfaces" ] && return 0 config_get_bool no_config "$cfg" no_config 0 config_get_bool ipv4_only "$cfg" ipv4_only 0 config_get_bool ipv6_only "$cfg" ipv6_only 0 config_get_bool no_dns "$cfg" no_dns 0 -} - -start() { - config_load ahcpd - config_foreach ahcpd_config ahcpd - mkdir -p /var/lib if [ "$no_config" -eq 0 ]; then unset no_config fi @@ -38,6 +38,14 @@ start() { fi } +start() { + include /lib/network + scan_interfaces + config_load ahcpd + mkdir -p /var/lib + config_foreach ahcpd_config ahcpd +} + stop() { [ -e $pidfile ] && kill $(cat $pidfile) [ -e $pidfile ] && sleep 2