summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-daemons/radvd/radvd.inc
blob: 6b595b07f3fb51b02bb908cb8ec7da4f73f98eed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
SUMMARY = "IPv6 router advertisement daemon"
DESCRIPTION = "radvd is the router advertisement daemon for IPv6. It \
listens to router solicitations and sends router \
advertisements as described in RFC 2461, Neighbor \
Discovery for IP Version 6 (IPv6). With these \
advertisements hosts can automatically configure their \
addresses and some other parameters. They also can \
choose a default router based on these advertisements."
HOMEPAGE = "http://www.litech.org/radvd/"
SECTION = "console/network"
DEPENDS = "flex-native libdaemon"

# License is BSD-Style (with advertising clause) but also has an additional 0th clause
LICENSE = "radvd"
LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=73ebbf7182ae996e65e8fadc9a8c45db"

SRC_URI = "http://v6web.litech.org/radvd/dist/radvd-${PV}.tar.gz \
           file://radvd.init \
           file://radvd.service \
           file://volatiles.03_radvd \
           file://radvd.default"

inherit autotools update-rc.d useradd pkgconfig systemd

SYSTEMD_SERVICE_${PN} = "radvd.service"
SYSTEMD_AUTO_ENABLE = "disable"

do_install_append () {
    install -m 0755 -d ${D}${sysconfdir}/init.d \
                       ${D}${sysconfdir}/default/volatiles \
                       ${D}${docdir}/radvd
    # Install init script and volatiles
    install -m 0755 ${WORKDIR}/radvd.init ${D}${sysconfdir}/init.d/radvd
    sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/radvd
    sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/radvd
    sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/radvd
    sed -i 's!^PATH=.*!PATH=${base_sbindir}:${base_bindir}:${sbindir}:${bindir}!' ${D}${sysconfdir}/init.d/radvd

    install -m 0644 ${WORKDIR}/volatiles.03_radvd ${D}${sysconfdir}/default/volatiles/volatiles.03_radvd

    # Install systemd service files
    install -d ${D}${systemd_unitdir}/system
    install -m 0644 ${WORKDIR}/radvd.service ${D}${systemd_unitdir}/system
    sed -i -e 's#@SYSCONFDIR@#${sysconfdir}#g' \
           -e 's#@SBINDIR@#${sbindir}#g' \
           -e 's#@BASE_BINDIR@#${base_bindir}#g' ${D}${systemd_unitdir}/system/radvd.service

    # Install default environment file
    install -m 0644 ${WORKDIR}/radvd.default ${D}${sysconfdir}/default/radvd

    # Documentation
    for i in radvd.conf.example README; do \
        install -m 0644 ${S}/$i ${D}${docdir}/radvd; \
    done
}

INITSCRIPT_NAME = "radvd"
INITSCRIPT_PARAMS = "defaults 20 80"

USERADD_PACKAGES = "${PN}"
USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/radvd/ -M -g nogroup radvd"

pkg_postinst_${PN} () {
    if [ -z "$D" -a -x /etc/init.d/populate-volatile.sh ]; then
	/etc/init.d/populate-volatile.sh update
    fi
}