blob: 134a33d478dd31ad35e5c349e1500bec7f0d0a96 [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
Patrick Williamsddad1a12017-02-23 20:36:32 -060045SYSTEMD_PACKAGES = "${PN} ${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd"
Patrick Williamsb48b7b42016-08-17 15:04:38 -050046SYSTEMD_SERVICE_${PN}-bgpd = "bgpd.service"
47SYSTEMD_SERVICE_${PN}-isisd = "isisd.service"
48SYSTEMD_SERVICE_${PN}-ospf6d = "ospf6d.service"
49SYSTEMD_SERVICE_${PN}-ospfd = "ospfd.service"
50SYSTEMD_SERVICE_${PN}-ripd = "ripd.service"
51SYSTEMD_SERVICE_${PN}-ripngd = "ripngd.service"
52SYSTEMD_SERVICE_${PN} = "zebra.service"
53
54EXTRA_OECONF = "--sysconfdir=${sysconfdir}/quagga \
55 --localstatedir=${localstatedir}/run/quagga \
56 --enable-exampledir=${docdir}/quagga/examples/ \
57 --enable-vtysh \
58 --enable-isisd \
Patrick Williamsddad1a12017-02-23 20:36:32 -060059 ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '--enable-watchquagga', '--disable-watchquagga', d)} \
Patrick Williamsb48b7b42016-08-17 15:04:38 -050060 --enable-ospfclient=yes \
61 --enable-multipath=64 \
62 --enable-user=quagga \
63 --enable-group=quagga \
64 --enable-vty-group=quaggavty \
65 --enable-configfile-mask=0640 \
66 --enable-logfile-mask=0640 \
67 --enable-rtadv \
68 --enable-linux24-tcp-md5 \
69 ap_cv_cc_pie=no \
70 ${SNMP_CONF}"
71
Brad Bishop6e60e8b2018-02-01 10:27:11 -050072CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'"
73
Patrick Williamsb48b7b42016-08-17 15:04:38 -050074do_install () {
75 # Install init script and default settings
76 install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d \
77 ${D}${sysconfdir}/quagga ${D}${sysconfdir}/default/volatiles
78 install -m 0644 ${WORKDIR}/quagga.default ${D}${sysconfdir}/default/quagga
79 install -m 0644 ${WORKDIR}/watchquagga.default ${D}${sysconfdir}/default/watchquagga
80 install -m 0755 ${WORKDIR}/quagga.init ${D}${sysconfdir}/init.d/quagga
81 install -m 0755 ${WORKDIR}/watchquagga.init ${D}${sysconfdir}/init.d/watchquagga
82 install -m 0644 ${WORKDIR}/volatiles.03_quagga ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga
83
84 # Install sample configurations for the daemons
Patrick Williamsddad1a12017-02-23 20:36:32 -060085 for f in bgpd vtysh isisd ospfd ripngd zebra ripd ospf6d; do
Patrick Williamsb48b7b42016-08-17 15:04:38 -050086 install -m 0640 ${S}/$f/$f.conf.sample ${D}${sysconfdir}/quagga/$f.conf.sample
87 done
88
Patrick Williamsddad1a12017-02-23 20:36:32 -060089 for f in bgpd vtysh isisd ospfd ripngd zebra ripd ospf6d; do
90 touch ${D}${sysconfdir}/quagga/$f.conf
Patrick Williamsb48b7b42016-08-17 15:04:38 -050091 done
92 chown quagga:quaggavty ${D}${sysconfdir}/quagga
93 chown quagga:quagga ${D}${sysconfdir}/quagga/*.conf
94 chmod 750 ${D}${sysconfdir}/quagga
95 chmod 640 ${D}${sysconfdir}/quagga/*.conf
96
97 # Install quagga
98 oe_runmake install DESTDIR=${D} prefix=${prefix} \
99 sbindir=${sbindir} \
100 sysconfdir=${sysconfdir}/quagga \
101 localstatedir=${localstatedir}/run/quagga
102
103 # Fix hardcoded paths
104 sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/*
105 sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/quagga
106 sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/watchquagga
107 sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga
108 sed -i 's!^PATH=.*!PATH=${base_sbindir}:${sbindir}:${base_bindir}:${bindir}!' ${D}${sysconfdir}/init.d/*
Andrew Geissler82c905d2020-04-13 13:39:40 -0500109 sed -i 's!--with-libtool-sysroot=[^ "]*!!' ${D}${includedir}/quagga/version.h
110
111 oe_multilib_header quagga/version.h
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500112
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500113 # For PAM
114 for feature in ${DISTRO_FEATURES}; do
115 if [ "$feature" = "pam" ]; then
116 install -D -m 644 ${WORKDIR}/quagga.pam ${D}/${sysconfdir}/pam.d/quagga
117 break
118 fi
119 done
120
Patrick Williamsddad1a12017-02-23 20:36:32 -0600121 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
Andrew Geissler82c905d2020-04-13 13:39:40 -0500122 install -d ${D}${nonarch_libdir}/tmpfiles.d
123 echo "d /run/quagga 0755 quagga quagga -" \
124 > ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500125 fi
126
127 # Remove sysinit script if sysvinit is not in DISTRO_FEATURES
128 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then
129 rm -rf ${D}${sysconfdir}/init.d/
130 rm -f ${D}${sysconfdir}/default/watchquagga
131 fi
132
133 install -d ${D}${systemd_unitdir}/system
Patrick Williamsddad1a12017-02-23 20:36:32 -0600134 for i in bgpd isisd ospf6d ospfd ripd ripngd zebra; do
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500135 install -m 0644 ${WORKDIR}/$i.service ${D}${systemd_unitdir}/system
136 done
137 sed -e 's,@BASE_SBINDIR@,${base_sbindir},g' \
138 -e 's,@SYSCONFDIR@,${sysconfdir},g' \
139 -e 's,@SBINDIR@,${sbindir},g' \
140 -e 's,@base_bindir@,${base_bindir},g' \
141 -e 's,@localstatedir@,${localstatedir},g' \
142 -i ${D}${systemd_unitdir}/system/*.service
143}
144
145DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}"
146pkg_postinst_${PN} () {
147 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then
148 if [ -n "$D" ]; then
149 OPTS="--root=$D"
150 fi
151 systemctl $OPTS mask quagga.service
152 fi
153}
154
155# Split into a main package and separate per-protocol packages
Patrick Williamsddad1a12017-02-23 20:36:32 -0600156PACKAGE_BEFORE_PN = "${PN}-ospfd ${PN}-ospf6d ${PN}-bgpd \
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500157 ${PN}-ripd ${PN}-ripngd ${PN}-isisd \
Patrick Williamsddad1a12017-02-23 20:36:32 -0600158 ${PN}-ospfclient ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '${PN}-watchquagga', '', d)}"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500159
Patrick Williamsddad1a12017-02-23 20:36:32 -0600160RDEPENDS_${PN} += "${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500161
162FILES_${PN}-ospfd = "${sbindir}/ospfd ${libdir}/libospf.so.*"
163FILES_${PN}-ospf6d = "${sbindir}/ospf6d"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500164FILES_${PN}-bgpd = "${sbindir}/bgpd"
165FILES_${PN}-ripd = "${sbindir}/ripd"
166FILES_${PN}-ripngd = "${sbindir}/ripngd"
167FILES_${PN}-isisd = "${sbindir}/isisd"
168FILES_${PN}-ospfclient = "${sbindir}/ospfclient ${libdir}/libospfapiclient.so.*"
169FILES_${PN}-watchquagga = "${sbindir}/watchquagga ${sysconfdir}/default/watchquagga \
170 ${sysconfdir}/init.d/watchquagga"
171
Andrew Geissler82c905d2020-04-13 13:39:40 -0500172FILES_${PN} += "${nonarch_libdir}/tmpfiles.d/*.conf"
173
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500174# Indicate that the default files are configuration files
175CONFFILES_${PN} = "${sysconfdir}/default/quagga \
176 ${sysconfdir}/quagga/bgpd.conf \
177 ${sysconfdir}/quagga/vtysh.conf \
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500178 ${sysconfdir}/quagga/isisd.conf \
179 ${sysconfdir}/quagga/ospfd.conf \
180 ${sysconfdir}/quagga/ripngd.conf \
181 ${sysconfdir}/quagga/zebra.conf \
182 ${sysconfdir}/quagga/ripd.conf \
183 ${sysconfdir}/quagga/ospf6d.conf \
184 "
185CONFFILES_${PN}-watchquagga = "${sysconfdir}/default/watchquagga"
186
187# Stop the names being rewritten due to the internal shared libraries
188DEBIAN_NOAUTONAME_${PN}-ospfd = "1"
189DEBIAN_NOAUTONAME_${PN}-ospfclient = "1"
190
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500191# Main init script starts all deamons
192# Seperate init script for watchquagga
193INITSCRIPT_PACKAGES = "${PN} ${PN}-watchquagga"
194INITSCRIPT_NAME_${PN} = "quagga"
195INITSCRIPT_PARAMS_${PN} = "defaults 15 85"
196INITSCRIPT_NAME_${PN}-watchquagga = "watchquagga"
197INITSCRIPT_PARAMS_${PN}-watchquagga = "defaults 90 10"
198
199# Add quagga's user and group
200USERADD_PACKAGES = "${PN}"
201GROUPADD_PARAM_${PN} = "--system quagga ; --system quaggavty"
Brad Bishop6e60e8b2018-02-01 10:27:11 -0500202USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/quagga/ -M -g quagga -G quaggavty --shell /bin/false quagga"
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500203
204pkg_postinst_${PN} () {
205 if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
206 ${sysconfdir}/init.d/populate-volatile.sh update
207 fi
208}
209
210# Stop apps before uninstall
211pkg_prerm_${PN} () {
212 ${sysconfdir}/init.d/quagga stop
213}
214
215pkg_prerm_${PN}-ospfd () {
216 ${sysconfdir}/init.d/quagga stop ospfd
217}
218
219pkg_prerm_${PN}-ospf6d () {
220 ${sysconfdir}/init.d/quagga stop ospf6d
221}
222
Patrick Williamsb48b7b42016-08-17 15:04:38 -0500223pkg_prerm_${PN}-bgpd () {
224 ${sysconfdir}/init.d/quagga stop bgpd
225}
226
227pkg_prerm_${PN}-ripd () {
228 ${sysconfdir}/init.d/quagga stop ripd
229}
230
231pkg_prerm_${PN}-ripngd () {
232 ${sysconfdir}/init.d/quagga stop ripngd
233}
234
235pkg_prerm_${PN}-isisd () {
236 ${sysconfdir}/init.d/quagga stop isisd
237}