diff options
author | Chong.Lu@windriver.com <Chong.Lu@windriver.com> | 2014-09-29 09:19:53 +0800 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2014-10-04 00:30:29 +0200 |
commit | 07e13c6b940288d5649a82a7c1c185ab9b24d4b4 (patch) | |
tree | a03be1204d09b3fcb41ea3318b8ce3b00d98bb95 /meta-networking/recipes-protocols | |
parent | a97b89e72f218715d369e3db43c294154d9c377a (diff) | |
download | meta-openembedded-07e13c6b940288d5649a82a7c1c185ab9b24d4b4.tar.gz |
quagga: add systemd service file
Add systemd service for quagga.
Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-networking/recipes-protocols')
9 files changed, 161 insertions, 1 deletions
diff --git a/meta-networking/recipes-protocols/quagga/files/babeld.service b/meta-networking/recipes-protocols/quagga/files/babeld.service new file mode 100644 index 000000000..dd344b0b3 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/babeld.service | |||
@@ -0,0 +1,14 @@ | |||
1 | [Unit] | ||
2 | Description=Babel routing daemon | ||
3 | BindTo=zebra.service | ||
4 | After=zebra.service | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/babeld.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStart=@SBINDIR@/babeld -d $babeld_options -f /etc/quagga/babeld.conf | ||
11 | Restart=on-abort | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/bgpd.service b/meta-networking/recipes-protocols/quagga/files/bgpd.service new file mode 100644 index 000000000..164c81724 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/bgpd.service | |||
@@ -0,0 +1,14 @@ | |||
1 | [Unit] | ||
2 | Description=BGP routing daemon | ||
3 | BindTo=zebra.service | ||
4 | After=zebra.service | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/bgpd.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStart=@SBINDIR@/bgpd -d $bgpd_options -f /etc/quagga/bgpd.conf | ||
11 | Restart=on-abort | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/isisd.service b/meta-networking/recipes-protocols/quagga/files/isisd.service new file mode 100644 index 000000000..9bfe7b65e --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/isisd.service | |||
@@ -0,0 +1,14 @@ | |||
1 | [Unit] | ||
2 | Description=IS-IS routing daemon | ||
3 | BindTo=zebra.service | ||
4 | After=zebra.service | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/isisd.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStart=@SBINDIR@/isisd -d $isisd_options -f /etc/quagga/isisd.conf | ||
11 | Restart=on-abort | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/ospf6d.service b/meta-networking/recipes-protocols/quagga/files/ospf6d.service new file mode 100644 index 000000000..4b8ebf802 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/ospf6d.service | |||
@@ -0,0 +1,14 @@ | |||
1 | [Unit] | ||
2 | Description=OSPF routing daemon for IPv6 | ||
3 | BindTo=zebra.service | ||
4 | After=zebra.service | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/ospf6d.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStart=@SBINDIR@/ospf6d -d $ospf6d_options -f /etc/quagga/ospf6d.conf | ||
11 | Restart=on-abort | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/ospfd.service b/meta-networking/recipes-protocols/quagga/files/ospfd.service new file mode 100644 index 000000000..f9f5031b4 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/ospfd.service | |||
@@ -0,0 +1,14 @@ | |||
1 | [Unit] | ||
2 | Description=OSPF routing daemon | ||
3 | BindTo=zebra.service | ||
4 | After=zebra.service | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/ospfd.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStart=@SBINDIR@/ospfd -d $ospfd_options -f /etc/quagga/ospfd.conf | ||
11 | Restart=on-abort | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/ripd.service b/meta-networking/recipes-protocols/quagga/files/ripd.service new file mode 100644 index 000000000..5dfd28b3a --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/ripd.service | |||
@@ -0,0 +1,14 @@ | |||
1 | [Unit] | ||
2 | Description=RIP routing daemon | ||
3 | BindTo=zebra.service | ||
4 | After=zebra.service | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/ripd.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStart=@SBINDIR@/ripd -d $ripd_options -f /etc/quagga/ripd.conf | ||
11 | Restart=on-abort | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/ripngd.service b/meta-networking/recipes-protocols/quagga/files/ripngd.service new file mode 100644 index 000000000..936b81fb9 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/ripngd.service | |||
@@ -0,0 +1,14 @@ | |||
1 | i[Unit] | ||
2 | Description=RIP routing daemon for IPv6 | ||
3 | BindTo=zebra.service | ||
4 | After=zebra.service | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/ripngd.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStart=@SBINDIR@/ripngd -d $ripngd_options -f /etc/quagga/ripngd.conf | ||
11 | Restart=on-abort | ||
12 | |||
13 | [Install] | ||
14 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/files/zebra.service b/meta-networking/recipes-protocols/quagga/files/zebra.service new file mode 100644 index 000000000..afdd9e52d --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/files/zebra.service | |||
@@ -0,0 +1,15 @@ | |||
1 | [Unit] | ||
2 | Description=GNU Zebra routing manager | ||
3 | Wants=network.target | ||
4 | Before=network.target | ||
5 | ConditionPathExists=@SYSCONFDIR@/quagga/zebra.conf | ||
6 | |||
7 | [Service] | ||
8 | Type=forking | ||
9 | EnvironmentFile=-@SYSCONFDIR@/default/quagga | ||
10 | ExecStartPre=@BASE_SBINDIR@/ip route flush proto zebra | ||
11 | ExecStart=@SBINDIR@/zebra -d $zebra_options -f /etc/quagga/zebra.conf | ||
12 | Restart=on-abort | ||
13 | |||
14 | [Install] | ||
15 | WantedBy=multi-user.target | ||
diff --git a/meta-networking/recipes-protocols/quagga/quagga.inc b/meta-networking/recipes-protocols/quagga/quagga.inc index 04ec05153..9bdd4d590 100644 --- a/meta-networking/recipes-protocols/quagga/quagga.inc +++ b/meta-networking/recipes-protocols/quagga/quagga.inc | |||
@@ -31,13 +31,31 @@ SRC_URI = "${SAVANNAH_GNU_MIRROR}/quagga${QUAGGASUBDIR}/quagga-${PV}.tar.gz; \ | |||
31 | file://quagga.pam \ | 31 | file://quagga.pam \ |
32 | file://ripd-fix-two-bugs-after-received-SIGHUP.patch \ | 32 | file://ripd-fix-two-bugs-after-received-SIGHUP.patch \ |
33 | file://quagga-Avoid-duplicate-connected-address.patch \ | 33 | file://quagga-Avoid-duplicate-connected-address.patch \ |
34 | file://babeld.service \ | ||
35 | file://bgpd.service \ | ||
36 | file://isisd.service \ | ||
37 | file://ospf6d.service \ | ||
38 | file://ospfd.service \ | ||
39 | file://ripd.service \ | ||
40 | file://ripngd.service \ | ||
41 | file://zebra.service \ | ||
34 | " | 42 | " |
35 | 43 | ||
36 | PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" | 44 | PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" |
37 | PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap" | 45 | PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap" |
38 | PACKAGECONFIG[pam] = "--with-libpam, --without-libpam, libpam" | 46 | PACKAGECONFIG[pam] = "--with-libpam, --without-libpam, libpam" |
39 | 47 | ||
40 | inherit autotools update-rc.d useradd | 48 | inherit autotools update-rc.d useradd systemd |
49 | |||
50 | SYSTEMD_PACKAGES = "${PN} ${PN}-babeld ${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd" | ||
51 | SYSTEMD_SERVICE_${PN}-babeld = "babeld.service" | ||
52 | SYSTEMD_SERVICE_${PN}-bgpd = "bgpd.service" | ||
53 | SYSTEMD_SERVICE_${PN}-isisd = "isisd.service" | ||
54 | SYSTEMD_SERVICE_${PN}-ospf6d = "ospf6d.service" | ||
55 | SYSTEMD_SERVICE_${PN}-ospfd = "ospfd.service" | ||
56 | SYSTEMD_SERVICE_${PN}-ripd = "ripd.service" | ||
57 | SYSTEMD_SERVICE_${PN}-ripngd = "ripngd.service" | ||
58 | SYSTEMD_SERVICE_${PN} = "zebra.service" | ||
41 | 59 | ||
42 | EXTRA_OECONF = "--sysconfdir=${sysconfdir}/quagga \ | 60 | EXTRA_OECONF = "--sysconfdir=${sysconfdir}/quagga \ |
43 | --localstatedir=${localstatedir}/run/quagga \ | 61 | --localstatedir=${localstatedir}/run/quagga \ |
@@ -108,6 +126,35 @@ do_install () { | |||
108 | fi | 126 | fi |
109 | done | 127 | done |
110 | 128 | ||
129 | if ${@base_contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
130 | install -d ${D}${sysconfdir}/tmpfiles.d | ||
131 | echo "d /var/run/quagga 0755 quagga quagga -" \ | ||
132 | > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf | ||
133 | fi | ||
134 | |||
135 | # Remove sysinit script if sysvinit is not in DISTRO_FEATURES | ||
136 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then | ||
137 | rm -rf ${D}${sysconfdir}/init.d/ | ||
138 | fi | ||
139 | |||
140 | install -d ${D}${systemd_unitdir}/system | ||
141 | for i in babeld bgpd isisd ospf6d ospfd ripd ripngd zebra; do | ||
142 | install -m 0644 ${WORKDIR}/$i.service ${D}${systemd_unitdir}/system | ||
143 | done | ||
144 | sed -e 's,@BASE_SBINDIR@,${base_sbindir},g' \ | ||
145 | -e 's,@SYSCONFDIR@,${sysconfdir},g' \ | ||
146 | -e 's,@SBINDIR@,${sbindir},g' \ | ||
147 | -i ${D}${systemd_unitdir}/system/*.service | ||
148 | } | ||
149 | |||
150 | DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}" | ||
151 | pkg_postinst_${PN} () { | ||
152 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then | ||
153 | if [ -n "$D" ]; then | ||
154 | OPTS="--root=$D" | ||
155 | fi | ||
156 | systemctl $OPTS mask quagga.service | ||
157 | fi | ||
111 | } | 158 | } |
112 | 159 | ||
113 | # Split into a main package and separate per-protocol packages | 160 | # Split into a main package and separate per-protocol packages |