slackbuilds_ponce/network/radvd/rc.radvd.new
Robby Workman 97b17aea08 network/radvd: Create piddir and chown before start()
Since the radvd daemon drops privileges when starting, and
it doesn't write its pidfile until *after* dropping privs,
it is unable to do so if /var/run/radvd does not already
exist with daemon:daemon ownership.  Even if this directory
is created during packaging, there's no guarantee that it
will persist, as /var/run on tmpfs is quite common these
days (as that's how this problem was discovered here).

Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
2013-06-15 23:00:05 -03:00

45 lines
685 B
Bash

#!/bin/sh
#
# /etc/rc.d/rc.radvd
#
# Start/stop/restart the radvd daemon.
if ! [ -f /proc/net/if_inet6 ]; then
echo "IPv6 support not found, exiting"
exit 1
fi
radvd_start() {
if [ -x /usr/sbin/radvd ]; then
echo "Starting radvd..."
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
mkdir -p /var/run/radvd
chown daemon:daemon /var/run/radvd
/usr/sbin/radvd -u daemon
fi
}
radvd_stop() {
/bin/kill $(cat /var/run/radvd/radvd.pid)
}
radvd_restart() {
radvd_stop
sleep 2
radvd_start
}
case "$1" in
'start')
radvd_start
;;
'stop')
radvd_stop
;;
'restart')
radvd_restart
;;
*)
echo "usage $0 start|stop|restart"
esac