diff options
Diffstat (limited to 'meta-networking/recipes-protocols/quagga/quagga.inc')
-rw-r--r-- | meta-networking/recipes-protocols/quagga/quagga.inc | 250 |
1 files changed, 250 insertions, 0 deletions
diff --git a/meta-networking/recipes-protocols/quagga/quagga.inc b/meta-networking/recipes-protocols/quagga/quagga.inc new file mode 100644 index 000000000..2c0817b83 --- /dev/null +++ b/meta-networking/recipes-protocols/quagga/quagga.inc | |||
@@ -0,0 +1,250 @@ | |||
1 | SUMMARY = "BGP/OSPF/RIP routing daemon" | ||
2 | DESCRIPTION = "Quagga is a routing software suite, providing \ | ||
3 | implementations of OSPFv2, OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 for \ | ||
4 | Unix platforms, particularly FreeBSD, Linux, Solaris and NetBSD. \ | ||
5 | Quagga is a fork of GNU Zebra which was developed by Kunihiro \ | ||
6 | Ishiguro. The Quagga tree aims to build a more involved community \ | ||
7 | around Quagga than the current centralised model of GNU Zebra." | ||
8 | HOMEPAGE = "http://www.nongnu.org/quagga/" | ||
9 | SECTION = "network" | ||
10 | LICENSE = "GPL-2.0 & LGPL-2.0" | ||
11 | DEPENDS = "readline ncurses perl-native" | ||
12 | DEPENDS += "${@base_contains('DISTRO_FEATURES', 'snmp', 'net-snmp', '', d)}" | ||
13 | SNMP_CONF="${@base_contains('DISTRO_FEATURES', 'snmp', '--enable-snmp', '', d)}" | ||
14 | |||
15 | LIC_FILES_CHKSUM = "file://COPYING;md5=81bcece21748c91ba9992349a91ec11d \ | ||
16 | file://COPYING.LIB;md5=01ef24401ded36cd8e5d18bfe947240c" | ||
17 | |||
18 | # the "ip" command from busybox is not sufficient (flush by protocol flushes all routes) | ||
19 | RDEPENDS_${PN} += "iproute2" | ||
20 | |||
21 | QUAGGASUBDIR = "" | ||
22 | # ${QUAGGASUBDIR} is deal with old versions. Set to "/attic" for old | ||
23 | # versions and leave it empty for recent versions. | ||
24 | SRC_URI = "${SAVANNAH_GNU_MIRROR}/quagga${QUAGGASUBDIR}/quagga-${PV}.tar.gz; \ | ||
25 | file://Zebra-sync-zebra-routing-table-with-the-kernel-one.patch \ | ||
26 | file://quagga.init \ | ||
27 | file://quagga.default \ | ||
28 | file://watchquagga.init \ | ||
29 | file://watchquagga.default \ | ||
30 | file://volatiles.03_quagga \ | ||
31 | file://quagga.pam \ | ||
32 | file://ripd-fix-two-bugs-after-received-SIGHUP.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 \ | ||
42 | " | ||
43 | |||
44 | PACKAGECONFIG ??= "${@base_contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" | ||
45 | PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap" | ||
46 | PACKAGECONFIG[pam] = "--with-libpam, --without-libpam, libpam" | ||
47 | |||
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" | ||
59 | |||
60 | EXTRA_OECONF = "--sysconfdir=${sysconfdir}/quagga \ | ||
61 | --localstatedir=${localstatedir}/run/quagga \ | ||
62 | --enable-exampledir=${docdir}/quagga/examples/ \ | ||
63 | --enable-vtysh \ | ||
64 | --enable-isisd \ | ||
65 | ${@base_contains('DISTRO_FEATURES', 'sysvinit', '--enable-watchquagga', '--disable-watchquagga', d)} \ | ||
66 | --enable-ospf-te \ | ||
67 | --enable-opaque-lsa \ | ||
68 | --enable-ipv6 \ | ||
69 | --enable-ospfclient=yes \ | ||
70 | --enable-multipath=64 \ | ||
71 | --enable-user=quagga \ | ||
72 | --enable-group=quagga \ | ||
73 | --enable-vty-group=quaggavty \ | ||
74 | --enable-configfile-mask=0640 \ | ||
75 | --enable-logfile-mask=0640 \ | ||
76 | --enable-rtadv \ | ||
77 | --enable-linux24-tcp-md5 \ | ||
78 | ap_cv_cc_pie=no \ | ||
79 | ${SNMP_CONF}" | ||
80 | |||
81 | do_install () { | ||
82 | # Install init script and default settings | ||
83 | install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d \ | ||
84 | ${D}${sysconfdir}/quagga ${D}${sysconfdir}/default/volatiles | ||
85 | install -m 0644 ${WORKDIR}/quagga.default ${D}${sysconfdir}/default/quagga | ||
86 | install -m 0644 ${WORKDIR}/watchquagga.default ${D}${sysconfdir}/default/watchquagga | ||
87 | install -m 0755 ${WORKDIR}/quagga.init ${D}${sysconfdir}/init.d/quagga | ||
88 | install -m 0755 ${WORKDIR}/watchquagga.init ${D}${sysconfdir}/init.d/watchquagga | ||
89 | install -m 0644 ${WORKDIR}/volatiles.03_quagga ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga | ||
90 | |||
91 | # Install sample configurations for the daemons | ||
92 | for f in bgpd vtysh babeld isisd ospfd ripngd zebra ripd ospf6d; do | ||
93 | install -m 0640 ${S}/$f/$f.conf.sample ${D}${sysconfdir}/quagga/$f.conf.sample | ||
94 | done | ||
95 | |||
96 | for f in bgpd vtysh babeld isisd ospfd ripngd zebra ripd ospf6d; do | ||
97 | touch ${D}${sysconfdir}/quagga/$f.conf | ||
98 | done | ||
99 | chown quagga:quaggavty ${D}${sysconfdir}/quagga | ||
100 | chown quagga:quagga ${D}${sysconfdir}/quagga/*.conf | ||
101 | chmod 750 ${D}${sysconfdir}/quagga | ||
102 | chmod 640 ${D}${sysconfdir}/quagga/*.conf | ||
103 | |||
104 | # Install quagga | ||
105 | oe_runmake install DESTDIR=${D} prefix=${prefix} \ | ||
106 | sbindir=${sbindir} \ | ||
107 | sysconfdir=${sysconfdir}/quagga \ | ||
108 | localstatedir=${localstatedir}/run/quagga | ||
109 | |||
110 | # Fix hardcoded paths | ||
111 | sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/* | ||
112 | sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/quagga | ||
113 | sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/watchquagga | ||
114 | sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga | ||
115 | sed -i 's!^PATH=.*!PATH=${base_sbindir}:${sbindir}:${base_bindir}:${bindir}!' ${D}${sysconfdir}/init.d/* | ||
116 | |||
117 | # Remove generated info dir file, it doesn't belong in the generated | ||
118 | # package. | ||
119 | rm -f ${D}${infodir}/dir | ||
120 | |||
121 | # For PAM | ||
122 | for feature in ${DISTRO_FEATURES}; do | ||
123 | if [ "$feature" = "pam" ]; then | ||
124 | install -D -m 644 ${WORKDIR}/quagga.pam ${D}/${sysconfdir}/pam.d/quagga | ||
125 | break | ||
126 | fi | ||
127 | done | ||
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 | rm -f ${D}${sysconfdir}/default/watchquagga | ||
139 | fi | ||
140 | |||
141 | install -d ${D}${systemd_unitdir}/system | ||
142 | for i in babeld bgpd isisd ospf6d ospfd ripd ripngd zebra; do | ||
143 | install -m 0644 ${WORKDIR}/$i.service ${D}${systemd_unitdir}/system | ||
144 | done | ||
145 | sed -e 's,@BASE_SBINDIR@,${base_sbindir},g' \ | ||
146 | -e 's,@SYSCONFDIR@,${sysconfdir},g' \ | ||
147 | -e 's,@SBINDIR@,${sbindir},g' \ | ||
148 | -i ${D}${systemd_unitdir}/system/*.service | ||
149 | } | ||
150 | |||
151 | DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}" | ||
152 | pkg_postinst_${PN} () { | ||
153 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then | ||
154 | if [ -n "$D" ]; then | ||
155 | OPTS="--root=$D" | ||
156 | fi | ||
157 | systemctl $OPTS mask quagga.service | ||
158 | fi | ||
159 | } | ||
160 | |||
161 | # Split into a main package and separate per-protocol packages | ||
162 | PACKAGE_BEFORE_PN = "${PN}-ospfd ${PN}-ospf6d ${PN}-babeld ${PN}-bgpd \ | ||
163 | ${PN}-ripd ${PN}-ripngd ${PN}-isisd \ | ||
164 | ${PN}-ospfclient ${@base_contains('DISTRO_FEATURES', 'sysvinit', '${PN}-watchquagga', '', d)}" | ||
165 | |||
166 | RDEPENDS_${PN} += "${PN}-babeld ${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd" | ||
167 | |||
168 | FILES_${PN}-ospfd = "${sbindir}/ospfd ${libdir}/libospf.so.*" | ||
169 | FILES_${PN}-ospf6d = "${sbindir}/ospf6d" | ||
170 | FILES_${PN}-babeld = "${sbindir}/babeld" | ||
171 | FILES_${PN}-bgpd = "${sbindir}/bgpd" | ||
172 | FILES_${PN}-ripd = "${sbindir}/ripd" | ||
173 | FILES_${PN}-ripngd = "${sbindir}/ripngd" | ||
174 | FILES_${PN}-isisd = "${sbindir}/isisd" | ||
175 | FILES_${PN}-ospfclient = "${sbindir}/ospfclient ${libdir}/libospfapiclient.so.*" | ||
176 | FILES_${PN}-watchquagga = "${sbindir}/watchquagga ${sysconfdir}/default/watchquagga \ | ||
177 | ${sysconfdir}/init.d/watchquagga" | ||
178 | |||
179 | # Indicate that the default files are configuration files | ||
180 | CONFFILES_${PN} = "${sysconfdir}/default/quagga \ | ||
181 | ${sysconfdir}/quagga/bgpd.conf \ | ||
182 | ${sysconfdir}/quagga/vtysh.conf \ | ||
183 | ${sysconfdir}/quagga/babeld.conf \ | ||
184 | ${sysconfdir}/quagga/isisd.conf \ | ||
185 | ${sysconfdir}/quagga/ospfd.conf \ | ||
186 | ${sysconfdir}/quagga/ripngd.conf \ | ||
187 | ${sysconfdir}/quagga/zebra.conf \ | ||
188 | ${sysconfdir}/quagga/ripd.conf \ | ||
189 | ${sysconfdir}/quagga/ospf6d.conf \ | ||
190 | " | ||
191 | CONFFILES_${PN}-watchquagga = "${sysconfdir}/default/watchquagga" | ||
192 | |||
193 | # Stop the names being rewritten due to the internal shared libraries | ||
194 | DEBIAN_NOAUTONAME_${PN}-ospfd = "1" | ||
195 | DEBIAN_NOAUTONAME_${PN}-ospfclient = "1" | ||
196 | |||
197 | # the "ip" command from busybox is not sufficient (flush by protocol flushes all routes) | ||
198 | RDEPENDS_${PN} += "iproute2" | ||
199 | |||
200 | # Main init script starts all deamons | ||
201 | # Seperate init script for watchquagga | ||
202 | INITSCRIPT_PACKAGES = "${PN} ${PN}-watchquagga" | ||
203 | INITSCRIPT_NAME_${PN} = "quagga" | ||
204 | INITSCRIPT_PARAMS_${PN} = "defaults 15 85" | ||
205 | INITSCRIPT_NAME_${PN}-watchquagga = "watchquagga" | ||
206 | INITSCRIPT_PARAMS_${PN}-watchquagga = "defaults 90 10" | ||
207 | |||
208 | # Add quagga's user and group | ||
209 | USERADD_PACKAGES = "${PN}" | ||
210 | GROUPADD_PARAM_${PN} = "--system quagga ; --system quaggavty" | ||
211 | USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/quagga/ -M -g quagga --shell /bin/false quagga" | ||
212 | |||
213 | pkg_postinst_${PN} () { | ||
214 | if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then | ||
215 | ${sysconfdir}/init.d/populate-volatile.sh update | ||
216 | fi | ||
217 | } | ||
218 | |||
219 | # Stop apps before uninstall | ||
220 | pkg_prerm_${PN} () { | ||
221 | ${sysconfdir}/init.d/quagga stop | ||
222 | } | ||
223 | |||
224 | pkg_prerm_${PN}-ospfd () { | ||
225 | ${sysconfdir}/init.d/quagga stop ospfd | ||
226 | } | ||
227 | |||
228 | pkg_prerm_${PN}-ospf6d () { | ||
229 | ${sysconfdir}/init.d/quagga stop ospf6d | ||
230 | } | ||
231 | |||
232 | pkg_prerm_${PN}-babeld () { | ||
233 | ${sysconfdir}/init.d/quagga stop babeld | ||
234 | } | ||
235 | |||
236 | pkg_prerm_${PN}-bgpd () { | ||
237 | ${sysconfdir}/init.d/quagga stop bgpd | ||
238 | } | ||
239 | |||
240 | pkg_prerm_${PN}-ripd () { | ||
241 | ${sysconfdir}/init.d/quagga stop ripd | ||
242 | } | ||
243 | |||
244 | pkg_prerm_${PN}-ripngd () { | ||
245 | ${sysconfdir}/init.d/quagga stop ripngd | ||
246 | } | ||
247 | |||
248 | pkg_prerm_${PN}-isisd () { | ||
249 | ${sysconfdir}/init.d/quagga stop isisd | ||
250 | } | ||