7419c6ce1d
- upgrades ahcpd to the latest release (0.50), - adds librt dependency to the Makefile, - removes the installation of the obsolete ahcp-dummy-config.sh file, - fixes the ahcpd.init file to ensure compatibility with ahcpd 0.50, options, and provide a sane default behaviour (forward ahcpd messages without performing any configuration). Signed-off-by: Gabriel Kerneis <kerneis@pps.jussieu.fr> git-svn-id: svn://svn.openwrt.org/openwrt/packages@18460 3c298f89-4303-0410-b956-a3cf2f4a3e73
47 lines
1.0 KiB
Bash
47 lines
1.0 KiB
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_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
|
|
if [ "$ipv4_only" -eq 0 ]; then
|
|
unset ipv4_only
|
|
fi
|
|
if [ "$ipv6_only" -eq 0 ]; then
|
|
unset ipv6_only
|
|
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 -s /usr/lib/ahcp/ahcp-config.sh -D -I $pidfile \
|
|
${ipv4_only:+-4} ${ipv6_only:+-6} ${no_dns:+-N} ${no_config:+-n} \
|
|
$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)."
|
|
}
|