diff options
Diffstat (limited to 'meta-networking/recipes-daemons/radvd')
4 files changed, 194 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 0000000000..8b26317ee6 --- /dev/null +++ b/meta-networking/recipes-daemons/radvd/files/radvd.init | |||
@@ -0,0 +1,135 @@ | |||
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 | |||
12 | # Source function library. | ||
13 | . /etc/init.d/functions | ||
14 | |||
15 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
16 | DAEMON=/usr/sbin/radvd | ||
17 | NAME=radvd | ||
18 | DESC=radvd | ||
19 | CONFIG=/etc/radvd.conf | ||
20 | SAVED_SETTINGS=/var/run/radvd/saved-settings | ||
21 | PIDFILE=/var/run/radvd/radvd.pid | ||
22 | OPTIONS="-u radvd -p $PIDFILE" | ||
23 | |||
24 | test -x $DAEMON || exit 0 | ||
25 | |||
26 | set -e | ||
27 | |||
28 | # Check for IPv6 support in kernel | ||
29 | if test \! -e /proc/sys/net/ipv6; then | ||
30 | echo "IPv6 support must be enabled in the kernel for $DESC to work." | ||
31 | exit | ||
32 | fi | ||
33 | |||
34 | save_settings() | ||
35 | { | ||
36 | local file=$1 | ||
37 | |||
38 | rm -f $file | ||
39 | for if_conf in /proc/sys/net/ipv6/conf/*; do | ||
40 | echo -e "$if_conf/forwarding\t `cat $if_conf/forwarding`" >> $file | ||
41 | done | ||
42 | return 0 | ||
43 | } | ||
44 | |||
45 | restore_settings() | ||
46 | { | ||
47 | file=$1 | ||
48 | |||
49 | if [ ! -f $file ]; then | ||
50 | echo "$0: warning: cannot restore settings" | ||
51 | return | ||
52 | fi | ||
53 | |||
54 | ( | ||
55 | while read f value; do | ||
56 | if [ -w $f ]; then | ||
57 | echo $value > $f | ||
58 | fi | ||
59 | done | ||
60 | ) < $file | ||
61 | } | ||
62 | |||
63 | chkconfig() { | ||
64 | if [ ! -e $CONFIG -o ! -s $CONFIG ]; then | ||
65 | echo "" | ||
66 | echo "* $CONFIG does not exist or is empty." | ||
67 | echo "* See /usr/share/doc/radvd/radvd.conf.example for a simple" | ||
68 | echo "* configuration suitable for most systems, and radvd.conf(5)" | ||
69 | echo "* for configuration file syntax. radvd will *not* be started." | ||
70 | exit 0 | ||
71 | fi | ||
72 | } | ||
73 | |||
74 | case "$1" in | ||
75 | start) | ||
76 | echo -n "Starting $DESC: " | ||
77 | chkconfig | ||
78 | save_settings $SAVED_SETTINGS | ||
79 | |||
80 | # We must enable IPv6 forwarding for radvd to work | ||
81 | echo 1 > /proc/sys/net/ipv6/conf/all/forwarding | ||
82 | |||
83 | # Check for stale pidfile; radvd won't start if one is lying around | ||
84 | if [ -f $PIDFILE ] && ! ps `cat $PIDFILE` > /dev/null; then | ||
85 | rm -f $PIDFILE | ||
86 | fi | ||
87 | if ! start-stop-daemon --oknodo --start --pidfile $PIDFILE \ | ||
88 | --exec $DAEMON -- $OPTIONS; then | ||
89 | echo "failed." && exit 1 | ||
90 | fi | ||
91 | echo "$NAME." | ||
92 | ;; | ||
93 | stop) | ||
94 | echo -n "Stopping $DESC: " | ||
95 | if ! [ -f $PIDFILE ] ; then | ||
96 | echo "not running." | ||
97 | exit 0 | ||
98 | fi | ||
99 | start-stop-daemon --oknodo --stop --pidfile $PIDFILE \ | ||
100 | --exec $DAEMON | ||
101 | restore_settings $SAVED_SETTINGS | ||
102 | rm -f $SAVED_SETTINGS | ||
103 | echo "$NAME." | ||
104 | ;; | ||
105 | status) | ||
106 | status $DAEMON; | ||
107 | exit $? | ||
108 | ;; | ||
109 | reload|force-reload) | ||
110 | echo "Reloading $DESC configuration files." | ||
111 | start-stop-daemon --stop --signal HUP --quiet --pidfile \ | ||
112 | $PIDFILE --exec $DAEMON | ||
113 | ;; | ||
114 | restart) | ||
115 | chkconfig | ||
116 | echo -n "Restarting $DESC: " | ||
117 | if ! start-stop-daemon --stop --quiet --pidfile \ | ||
118 | $PIDFILE --exec $DAEMON; then | ||
119 | # stop failed, so we were not running | ||
120 | save_settings $SAVED_SETTINGS | ||
121 | echo 1 > /proc/sys/net/ipv6/conf/all/forwarding | ||
122 | fi | ||
123 | sleep 1 | ||
124 | start-stop-daemon --start --quiet --pidfile \ | ||
125 | $PIDFILE --exec $DAEMON -- $OPTIONS | ||
126 | echo "$NAME." | ||
127 | ;; | ||
128 | *) | ||
129 | N=/etc/init.d/$NAME | ||
130 | echo "Usage: $N {start|stop|status|restart|reload|force-reload}" >&2 | ||
131 | exit 1 | ||
132 | ;; | ||
133 | esac | ||
134 | |||
135 | exit 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 0000000000..89256a40e4 --- /dev/null +++ b/meta-networking/recipes-daemons/radvd/files/volatiles.03_radvd | |||
@@ -0,0 +1,2 @@ | |||
1 | # <type> <owner> <group> <mode> <path> <linksource> | ||
2 | d 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 0000000000..9e194012c0 --- /dev/null +++ b/meta-networking/recipes-daemons/radvd/radvd.inc | |||
@@ -0,0 +1,51 @@ | |||
1 | SUMMARY = "IPv6 router advertisement daemon" | ||
2 | DESCRIPTION = "radvd is the router advertisement daemon for IPv6. It \ | ||
3 | listens to router solicitations and sends router \ | ||
4 | advertisements as described in RFC 2461, Neighbor \ | ||
5 | Discovery for IP Version 6 (IPv6). With these \ | ||
6 | advertisements hosts can automatically configure their \ | ||
7 | addresses and some other parameters. They also can \ | ||
8 | choose a default router based on these advertisements." | ||
9 | HOMEPAGE = "http://www.litech.org/radvd/" | ||
10 | SECTION = "console/network" | ||
11 | DEPENDS = "flex-native libdaemon" | ||
12 | |||
13 | # License is BSD-Style (with advertising clause) but also has an additional 0th clause | ||
14 | LICENSE = "radvd" | ||
15 | LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=73ebbf7182ae996e65e8fadc9a8c45db" | ||
16 | |||
17 | SRC_URI = "http://v6web.litech.org/radvd/dist/radvd-${PV}.tar.gz \ | ||
18 | file://radvd.init \ | ||
19 | file://volatiles.03_radvd" | ||
20 | |||
21 | inherit autotools update-rc.d useradd | ||
22 | |||
23 | do_install_append () { | ||
24 | install -m 0755 -d ${D}${sysconfdir}/init.d \ | ||
25 | ${D}${sysconfdir}/default/volatiles \ | ||
26 | ${D}${docdir}/radvd | ||
27 | # Install init script and volatiles | ||
28 | install -m 0755 ${WORKDIR}/radvd.init ${D}${sysconfdir}/init.d/radvd | ||
29 | sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/radvd | ||
30 | sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/radvd | ||
31 | sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/radvd | ||
32 | sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/radvd | ||
33 | |||
34 | install -m 0644 ${WORKDIR}/volatiles.03_radvd ${D}${sysconfdir}/default/volatiles/volatiles.03_radvd | ||
35 | # Documentation | ||
36 | for i in radvd.conf.example README; do \ | ||
37 | install -m 0644 $i ${D}${docdir}/radvd; \ | ||
38 | done | ||
39 | } | ||
40 | |||
41 | INITSCRIPT_NAME = "radvd" | ||
42 | INITSCRIPT_PARAMS = "defaults 20 80" | ||
43 | |||
44 | USERADD_PACKAGES = "${PN}" | ||
45 | USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/radvd/ -M -g nogroup radvd" | ||
46 | |||
47 | pkg_postinst_${PN} () { | ||
48 | if [ -z "$D" -a -x /etc/init.d/populate-volatile.sh ]; then | ||
49 | /etc/init.d/populate-volatile.sh update | ||
50 | fi | ||
51 | } | ||
diff --git a/meta-networking/recipes-daemons/radvd/radvd_1.9.8.bb b/meta-networking/recipes-daemons/radvd/radvd_1.9.8.bb new file mode 100644 index 0000000000..407eb43d3b --- /dev/null +++ b/meta-networking/recipes-daemons/radvd/radvd_1.9.8.bb | |||
@@ -0,0 +1,6 @@ | |||
1 | PR = "r0" | ||
2 | |||
3 | require radvd.inc | ||
4 | |||
5 | SRC_URI[md5sum] = "7a96a38252c3964ee18bbc1fdeae25fa" | ||
6 | SRC_URI[sha256sum] = "645ccf1c9b16e769ff4179813712e580e2c8786d64a888d8afa1e296c057c1c1" | ||