packages/ipv6/ahcpd/files/ahcpd.init
jow e242637f78 [PATCH] ahcpd: fix ticket 3550
Signed-off-by: Gabriel Kerneis <kerneis@pps.jussieu.fr>

git-svn-id: svn://svn.openwrt.org/openwrt/packages@15266 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-04-19 16:06:57 +00:00

38 lines
836 B
Bash

#!/bin/sh /etc/rc.common
START=71
pidfile=/var/run/ahcpd.pid
ahcpd_config() {
local cfg="$1"
config_get interfaces "$cfg" interfaces
config_get_bool no_ipv4 "$cfg" no_ipv4 0
config_get_bool no_dns "$cfg" no_dns 0
}
start() {
config_load ahcpd
config_foreach ahcpd_config ahcpd
mkdir -p /var/lib
[ -r /usr/lib/ahcp/ahcp.dat ] && authority="-a /usr/lib/ahcp/ahcp.dat"
if [ "$no_ipv4" -eq 0 ]; then
unset no_ipv4
fi
if [ "$no_dns" -eq 0 ]; then
unset no_dns
fi
if [ -e $pidfile ] ; then
echo "$pidfile exists -- not starting ahcpd." >&2
else
/usr/sbin/ahcpd -D -I $pidfile ${no_ipv4:+-s} ${no_dns:+-N} $authority $interfaces
fi
}
stop() {
[ -e $pidfile ] && kill $(cat $pidfile)
[ -e $pidfile ] && sleep 2
[ -e $pidfile ] && sleep 4
[ -e $pidfile ] && echo "Failed to stop ahcpd ($pidfile still exists)."
}