summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons/radvd
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-11-27 11:25:49 +0000
committerJoe MacDonald <joe.macdonald@windriver.com>2012-11-27 14:43:58 -0500
commit85c1a1a45409ffa064b5da8c8b00e7a5f7d67b83 (patch)
tree41122208e17e86c6364e7c776d1b8296e5f3588f /meta-networking/recipes-daemons/radvd
parente762ce3fc044cc64f473c95e096245e439eb3234 (diff)
downloadmeta-openembedded-85c1a1a45409ffa064b5da8c8b00e7a5f7d67b83.tar.gz
radvd: add from OE-Classic, update and tidy up
* Update to 1.9.1 * Add libdaemon to DEPENDS as needed by 1.9+ * Remove empty config file (not really of much use and there's an example config in the -doc package anyway) * Use useradd.bbclass to create user * Handle hardcoded paths in initscript * Add LSB headers to initscript (borrowed from openSUSE) * Set custom LICENSE as it's BSD-Style but not actually one of the standard BSD variants * Add LIC_FILES_CHKSUM * Set SUMMARY (which sets DESCRIPTION) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'meta-networking/recipes-daemons/radvd')
-rwxr-xr-xmeta-networking/recipes-daemons/radvd/files/radvd.init124
-rw-r--r--meta-networking/recipes-daemons/radvd/files/volatiles.03_radvd2
-rw-r--r--meta-networking/recipes-daemons/radvd/radvd.inc42
-rw-r--r--meta-networking/recipes-daemons/radvd/radvd_1.9.1.bb6
4 files changed, 174 insertions, 0 deletions
diff --git a/meta-networking/recipes-daemons/radvd/files/radvd.init b/meta-networking/recipes-daemons/radvd/files/radvd.init
new file mode 100755
index 000000000..a48dff8c8
--- /dev/null
+++ b/meta-networking/recipes-daemons/radvd/files/radvd.init
@@ -0,0 +1,124 @@
1#! /bin/sh
2#
3### BEGIN INIT INFO
4# Provides: radvd
5# Required-Start: $remote_fs $named $syslog
6# Required-Stop: $remote_fs $named $syslog
7# Default-Start: 3 5
8# Default-Stop: 0 1 2 6
9# Description: router advertisement daemon
10### END INIT INFO
11
12PATH=/sbin:/bin:/usr/sbin:/usr/bin
13DAEMON=/usr/sbin/radvd
14NAME=radvd
15DESC=radvd
16CONFIG=/etc/radvd.conf
17SAVED_SETTINGS=/var/run/radvd/saved-settings
18PIDFILE=/var/run/radvd/radvd.pid
19OPTIONS="-u radvd -p $PIDFILE"
20
21test -x $DAEMON || exit 0
22
23set -e
24
25# Check for IPv6 support in kernel
26if test \! -e /proc/sys/net/ipv6; then
27 echo "IPv6 support must be enabled in the kernel for $DESC to work."
28 exit
29fi
30
31save_settings()
32{
33 local file=$1
34
35 rm -f $file
36 for if_conf in /proc/sys/net/ipv6/conf/*; do
37 echo -e "$if_conf/forwarding\t `cat $if_conf/forwarding`" >> $file
38 done
39 return 0
40}
41
42restore_settings()
43{
44 file=$1
45
46 if [ ! -f $file ]; then
47 echo "$0: warning: cannot restore settings"
48 return
49 fi
50
51 (
52 while read f value; do
53 if [ -w $f ]; then
54 echo $value > $f
55 fi
56 done
57 ) < $file
58}
59
60chkconfig() {
61 if [ ! -e $CONFIG -o ! -s $CONFIG ]; then
62 echo ""
63 echo "* $CONFIG does not exist or is empty."
64 echo "* See /usr/share/doc/radvd/examples/simple-radvd.conf for a simple"
65 echo "* configuration suitable for most systems, and radvd.conf(5)"
66 echo "* for configuration file syntax. radvd will *not* be started."
67 exit 0
68 fi
69}
70
71case "$1" in
72 start)
73 echo -n "Starting $DESC: "
74 chkconfig
75 save_settings $SAVED_SETTINGS
76
77 # We must enable IPv6 forwarding for radvd to work
78 echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
79
80 # Check for stale pidfile; radvd won't start if one is lying around
81 if [ -f $PIDFILE ] && ! ps `cat $PIDFILE` > /dev/null; then
82 rm -f $PIDFILE
83 fi
84 if ! start-stop-daemon --oknodo --start --pidfile $PIDFILE \
85 --exec $DAEMON -- $OPTIONS; then
86 echo "failed." && exit 1
87 fi
88 echo "$NAME."
89 ;;
90 stop)
91 echo -n "Stopping $DESC: "
92 start-stop-daemon --oknodo --stop --pidfile $PIDFILE \
93 --exec $DAEMON
94 restore_settings $SAVED_SETTINGS
95 rm -f $SAVED_SETTINGS
96 echo "$NAME."
97 ;;
98 reload|force-reload)
99 echo "Reloading $DESC configuration files."
100 start-stop-daemon --stop --signal HUP --quiet --pidfile \
101 $PIDFILE --exec $DAEMON
102 ;;
103 restart)
104 chkconfig
105 echo -n "Restarting $DESC: "
106 if ! start-stop-daemon --stop --quiet --pidfile \
107 $PIDFILE --exec $DAEMON; then
108 # stop failed, so we were not running
109 save_settings $SAVED_SETTINGS
110 echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
111 fi
112 sleep 1
113 start-stop-daemon --start --quiet --pidfile \
114 $PIDFILE --exec $DAEMON -- $OPTIONS
115 echo "$NAME."
116 ;;
117 *)
118 N=/etc/init.d/$NAME
119 echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
120 exit 1
121 ;;
122esac
123
124exit 0
diff --git a/meta-networking/recipes-daemons/radvd/files/volatiles.03_radvd b/meta-networking/recipes-daemons/radvd/files/volatiles.03_radvd
new file mode 100644
index 000000000..89256a40e
--- /dev/null
+++ b/meta-networking/recipes-daemons/radvd/files/volatiles.03_radvd
@@ -0,0 +1,2 @@
1# <type> <owner> <group> <mode> <path> <linksource>
2d radvd root 0755 /var/run/radvd none
diff --git a/meta-networking/recipes-daemons/radvd/radvd.inc b/meta-networking/recipes-daemons/radvd/radvd.inc
new file mode 100644
index 000000000..406127939
--- /dev/null
+++ b/meta-networking/recipes-daemons/radvd/radvd.inc
@@ -0,0 +1,42 @@
1SUMMARY = "IPv6 router advertisement daemon"
2HOMEPAGE = "http://www.litech.org/radvd/"
3SECTION = "console/network"
4DEPENDS = "flex-native libdaemon"
5
6# License is BSD-Style (with advertising clause) but also has an additional 0th clause
7LICENSE = "radvd"
8LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=73ebbf7182ae996e65e8fadc9a8c45db"
9
10SRC_URI = "http://v6web.litech.org/radvd/dist/radvd-${PV}.tar.gz \
11 file://radvd.init \
12 file://volatiles.03_radvd"
13
14inherit autotools update-rc.d useradd
15
16do_install_append () {
17 install -m 0755 -d ${D}${sysconfdir}/init.d \
18 ${D}${sysconfdir}/default/volatiles \
19 ${D}${docdir}/radvd
20 # Install init script and volatiles
21 install -m 0755 ${WORKDIR}/radvd.init ${D}${sysconfdir}/init.d/radvd
22 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/radvd
23 sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/radvd
24 sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/radvd
25 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/radvd
26
27 install -m 0644 ${WORKDIR}/volatiles.03_radvd ${D}${sysconfdir}/default/volatiles/volatiles.03_radvd
28 # Documentation
29 for i in radvd.conf.example README; do \
30 install -m 0644 $i ${D}${docdir}/radvd; \
31 done
32}
33
34INITSCRIPT_NAME = "radvd"
35INITSCRIPT_PARAMS = "defaults 20 80"
36
37USERADD_PACKAGES = "${PN}"
38USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/radvd/ -M -g nogroup radvd"
39
40pkg_postinst_${PN} () {
41 ${sysconfdir}/init.d/populate-volatile.sh update
42}
diff --git a/meta-networking/recipes-daemons/radvd/radvd_1.9.1.bb b/meta-networking/recipes-daemons/radvd/radvd_1.9.1.bb
new file mode 100644
index 000000000..26d21ce07
--- /dev/null
+++ b/meta-networking/recipes-daemons/radvd/radvd_1.9.1.bb
@@ -0,0 +1,6 @@
1PR = "r0"
2
3require radvd.inc
4
5SRC_URI[md5sum] = "e807ad7e9a76d46b6133df391385cd31"
6SRC_URI[sha256sum] = "54eb5704a2b710ba946fa30d2bca811fa23b1b3bfab322c38cb0c2a9619aa933"