blob: 70c32b7a4e45d75155957bee8c4eecbe35ec7b25 [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001SUMMARY = "BGP/OSPF/RIP routing daemon"
2DESCRIPTION = "Quagga is a routing software suite, providing \
3implementations of OSPFv2, OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 for \
4Unix platforms, particularly FreeBSD, Linux, Solaris and NetBSD. \
5Quagga is a fork of GNU Zebra which was developed by Kunihiro \
6Ishiguro. The Quagga tree aims to build a more involved community \
7around Quagga than the current centralised model of GNU Zebra."
8HOMEPAGE = "http://www.nongnu.org/quagga/"
9SECTION = "net"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050010
Brad Bishopd7bf8c12018-02-25 22:55:05 -050011
12LICENSE = "GPL-2.0 & LGPL-2.0"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050013LIC_FILES_CHKSUM = "file://COPYING;md5=81bcece21748c91ba9992349a91ec11d \
14 file://COPYING.LIB;md5=01ef24401ded36cd8e5d18bfe947240c"
15
Brad Bishopd7bf8c12018-02-25 22:55:05 -050016DEPENDS = "readline ncurses perl-native c-ares"
17DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'snmp', 'net-snmp', '', d)}"
18SNMP_CONF="${@bb.utils.contains('DISTRO_FEATURES', 'snmp', '--enable-snmp', '', d)}"
19
Patrick Williamsb48b7b42016-08-17 15:04:38 -050020# the "ip" command from busybox is not sufficient (flush by protocol flushes all routes)
21RDEPENDS_${PN} += "iproute2"
22
Brad Bishopd7bf8c12018-02-25 22:55:05 -050023SRC_URI = "${SAVANNAH_GNU_MIRROR}/quagga/quagga-${PV}.tar.gz; \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050024 file://quagga.init \
25 file://quagga.default \
26 file://watchquagga.init \
27 file://watchquagga.default \
28 file://volatiles.03_quagga \
29 file://quagga.pam \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050030 file://bgpd.service \
31 file://isisd.service \
32 file://ospf6d.service \
33 file://ospfd.service \
34 file://ripd.service \
35 file://ripngd.service \
36 file://zebra.service \
Brad Bishopd7bf8c12018-02-25 22:55:05 -050037 "
Patrick Williamsb48b7b42016-08-17 15:04:38 -050038
Brad Bishop6e60e8b2018-02-01 10:27:11 -050039PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050040PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap"
41PACKAGECONFIG[pam] = "--with-libpam, --without-libpam, libpam"
42
Andrew Geissler82c905d2020-04-13 13:39:40 -050043inherit autotools update-rc.d useradd systemd pkgconfig multilib_header
Patrick Williamsb48b7b42016-08-17 15:04:38 -050044
Andrew Geisslerbffdb3e2020-08-21 16:13:29 -050045CFLAGS += "-fcommon"
46
Patrick Williamsddad1a12017-02-23 20:36:32 -060047SYSTEMD_PACKAGES = "${PN} ${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050048SYSTEMD_SERVICE_${PN}-bgpd = "bgpd.service"
49SYSTEMD_SERVICE_${PN}-isisd = "isisd.service"
50SYSTEMD_SERVICE_${PN}-ospf6d = "ospf6d.service"
51SYSTEMD_SERVICE_${PN}-ospfd = "ospfd.service"
52SYSTEMD_SERVICE_${PN}-ripd = "ripd.service"
53SYSTEMD_SERVICE_${PN}-ripngd = "ripngd.service"
54SYSTEMD_SERVICE_${PN} = "zebra.service"
55
56EXTRA_OECONF = "--sysconfdir=${sysconfdir}/quagga \
57 --localstatedir=${localstatedir}/run/quagga \
58 --enable-exampledir=${docdir}/quagga/examples/ \
59 --enable-vtysh \
60 --enable-isisd \
Patrick Williamsddad1a12017-02-23 20:36:32 -060061 ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '--enable-watchquagga', '--disable-watchquagga', d)} \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050062 --enable-ospfclient=yes \
63 --enable-multipath=64 \
64 --enable-user=quagga \
65 --enable-group=quagga \
66 --enable-vty-group=quaggavty \
67 --enable-configfile-mask=0640 \
68 --enable-logfile-mask=0640 \
69 --enable-rtadv \
70 --enable-linux24-tcp-md5 \
71 ap_cv_cc_pie=no \
72 ${SNMP_CONF}"
73
Brad Bishop6e60e8b2018-02-01 10:27:11 -050074CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'"
75
Patrick Williamsb48b7b42016-08-17 15:04:38 -050076do_install () {
77 # Install init script and default settings
78 install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d \
79 ${D}${sysconfdir}/quagga ${D}${sysconfdir}/default/volatiles
80 install -m 0644 ${WORKDIR}/quagga.default ${D}${sysconfdir}/default/quagga
81 install -m 0644 ${WORKDIR}/watchquagga.default ${D}${sysconfdir}/default/watchquagga
82 install -m 0755 ${WORKDIR}/quagga.init ${D}${sysconfdir}/init.d/quagga
83 install -m 0755 ${WORKDIR}/watchquagga.init ${D}${sysconfdir}/init.d/watchquagga
84 install -m 0644 ${WORKDIR}/volatiles.03_quagga ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga
85
86 # Install sample configurations for the daemons
Patrick Williamsddad1a12017-02-23 20:36:32 -060087 for f in bgpd vtysh isisd ospfd ripngd zebra ripd ospf6d; do
Patrick Williamsb48b7b42016-08-17 15:04:38 -050088 install -m 0640 ${S}/$f/$f.conf.sample ${D}${sysconfdir}/quagga/$f.conf.sample
89 done
90
Patrick Williamsddad1a12017-02-23 20:36:32 -060091 for f in bgpd vtysh isisd ospfd ripngd zebra ripd ospf6d; do
92 touch ${D}${sysconfdir}/quagga/$f.conf
Patrick Williamsb48b7b42016-08-17 15:04:38 -050093 done
94 chown quagga:quaggavty ${D}${sysconfdir}/quagga
95 chown quagga:quagga ${D}${sysconfdir}/quagga/*.conf
96 chmod 750 ${D}${sysconfdir}/quagga
97 chmod 640 ${D}${sysconfdir}/quagga/*.conf
98
99 # Install quagga
100 oe_runmake install DESTDIR=${D} prefix=${prefix} \
101 sbindir=${sbindir} \
102 sysconfdir=${sysconfdir}/quagga \
103 localstatedir=${localstatedir}/run/quagga
104
105 # Fix hardcoded paths
106 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/*
107 sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/quagga
108 sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/watchquagga
109 sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga
110 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${sbindir}:${base_bindir}:${bindir}!' ${D}${sysconfdir}/init.d/*
Andrew Geissler82c905d2020-04-13 13:39:40 -0500111 sed -i 's!--with-libtool-sysroot=[^ "]*!!' ${D}${includedir}/quagga/version.h
112
113 oe_multilib_header quagga/version.h
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500114
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500115 # For PAM
116 for feature in ${DISTRO_FEATURES}; do
117 if [ "$feature" = "pam" ]; then
118 install -D -m 644 ${WORKDIR}/quagga.pam ${D}/${sysconfdir}/pam.d/quagga
119 break
120 fi
121 done
122
Patrick Williamsddad1a12017-02-23 20:36:32 -0600123 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
Andrew Geissler82c905d2020-04-13 13:39:40 -0500124 install -d ${D}${nonarch_libdir}/tmpfiles.d
125 echo "d /run/quagga 0755 quagga quagga -" \
126 > ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500127 fi
128
129 # Remove sysinit script if sysvinit is not in DISTRO_FEATURES
130 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then
131 rm -rf ${D}${sysconfdir}/init.d/
132 rm -f ${D}${sysconfdir}/default/watchquagga
133 fi
134
135 install -d ${D}${systemd_unitdir}/system
Patrick Williamsddad1a12017-02-23 20:36:32 -0600136 for i in bgpd isisd ospf6d ospfd ripd ripngd zebra; do
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500137 install -m 0644 ${WORKDIR}/$i.service ${D}${systemd_unitdir}/system
138 done
139 sed -e 's,@BASE_SBINDIR@,${base_sbindir},g' \
140 -e 's,@SYSCONFDIR@,${sysconfdir},g' \
141 -e 's,@SBINDIR@,${sbindir},g' \
142 -e 's,@base_bindir@,${base_bindir},g' \
143 -e 's,@localstatedir@,${localstatedir},g' \
144 -i ${D}${systemd_unitdir}/system/*.service
145}
146
147DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}"
148pkg_postinst_${PN} () {
149 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then
150 if [ -n "$D" ]; then
151 OPTS="--root=$D"
152 fi
153 systemctl $OPTS mask quagga.service
154 fi
155}
156
157# Split into a main package and separate per-protocol packages
Patrick Williamsddad1a12017-02-23 20:36:32 -0600158PACKAGE_BEFORE_PN = "${PN}-ospfd ${PN}-ospf6d ${PN}-bgpd \
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500159 ${PN}-ripd ${PN}-ripngd ${PN}-isisd \
Patrick Williamsddad1a12017-02-23 20:36:32 -0600160 ${PN}-ospfclient ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '${PN}-watchquagga', '', d)}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500161
Patrick Williamsddad1a12017-02-23 20:36:32 -0600162RDEPENDS_${PN} += "${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500163
164FILES_${PN}-ospfd = "${sbindir}/ospfd ${libdir}/libospf.so.*"
165FILES_${PN}-ospf6d = "${sbindir}/ospf6d"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500166FILES_${PN}-bgpd = "${sbindir}/bgpd"
167FILES_${PN}-ripd = "${sbindir}/ripd"
168FILES_${PN}-ripngd = "${sbindir}/ripngd"
169FILES_${PN}-isisd = "${sbindir}/isisd"
170FILES_${PN}-ospfclient = "${sbindir}/ospfclient ${libdir}/libospfapiclient.so.*"
171FILES_${PN}-watchquagga = "${sbindir}/watchquagga ${sysconfdir}/default/watchquagga \
172 ${sysconfdir}/init.d/watchquagga"
173
Andrew Geissler82c905d2020-04-13 13:39:40 -0500174FILES_${PN} += "${nonarch_libdir}/tmpfiles.d/*.conf"
175
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500176# Indicate that the default files are configuration files
177CONFFILES_${PN} = "${sysconfdir}/default/quagga \
178 ${sysconfdir}/quagga/bgpd.conf \
179 ${sysconfdir}/quagga/vtysh.conf \
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500180 ${sysconfdir}/quagga/isisd.conf \
181 ${sysconfdir}/quagga/ospfd.conf \
182 ${sysconfdir}/quagga/ripngd.conf \
183 ${sysconfdir}/quagga/zebra.conf \
184 ${sysconfdir}/quagga/ripd.conf \
185 ${sysconfdir}/quagga/ospf6d.conf \
186 "
187CONFFILES_${PN}-watchquagga = "${sysconfdir}/default/watchquagga"
188
189# Stop the names being rewritten due to the internal shared libraries
190DEBIAN_NOAUTONAME_${PN}-ospfd = "1"
191DEBIAN_NOAUTONAME_${PN}-ospfclient = "1"
192
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500193# Main init script starts all deamons
194# Seperate init script for watchquagga
195INITSCRIPT_PACKAGES = "${PN} ${PN}-watchquagga"
196INITSCRIPT_NAME_${PN} = "quagga"
197INITSCRIPT_PARAMS_${PN} = "defaults 15 85"
198INITSCRIPT_NAME_${PN}-watchquagga = "watchquagga"
199INITSCRIPT_PARAMS_${PN}-watchquagga = "defaults 90 10"
200
201# Add quagga's user and group
202USERADD_PACKAGES = "${PN}"
203GROUPADD_PARAM_${PN} = "--system quagga ; --system quaggavty"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500204USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/quagga/ -M -g quagga -G quaggavty --shell /bin/false quagga"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500205
206pkg_postinst_${PN} () {
207 if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
208 ${sysconfdir}/init.d/populate-volatile.sh update
209 fi
210}
211
212# Stop apps before uninstall
213pkg_prerm_${PN} () {
214 ${sysconfdir}/init.d/quagga stop
215}
216
217pkg_prerm_${PN}-ospfd () {
218 ${sysconfdir}/init.d/quagga stop ospfd
219}
220
221pkg_prerm_${PN}-ospf6d () {
222 ${sysconfdir}/init.d/quagga stop ospf6d
223}
224
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500225pkg_prerm_${PN}-bgpd () {
226 ${sysconfdir}/init.d/quagga stop bgpd
227}
228
229pkg_prerm_${PN}-ripd () {
230 ${sysconfdir}/init.d/quagga stop ripd
231}
232
233pkg_prerm_${PN}-ripngd () {
234 ${sysconfdir}/init.d/quagga stop ripngd
235}
236
237pkg_prerm_${PN}-isisd () {
238 ${sysconfdir}/init.d/quagga stop isisd
239}