Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 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 = "net" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 10 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 11 | |
| 12 | LICENSE = "GPL-2.0 & LGPL-2.0" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 13 | LIC_FILES_CHKSUM = "file://COPYING;md5=81bcece21748c91ba9992349a91ec11d \ |
| 14 | file://COPYING.LIB;md5=01ef24401ded36cd8e5d18bfe947240c" |
| 15 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 16 | DEPENDS = "readline ncurses perl-native c-ares" |
| 17 | DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'snmp', 'net-snmp', '', d)}" |
| 18 | SNMP_CONF="${@bb.utils.contains('DISTRO_FEATURES', 'snmp', '--enable-snmp', '', d)}" |
| 19 | |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 20 | # the "ip" command from busybox is not sufficient (flush by protocol flushes all routes) |
| 21 | RDEPENDS_${PN} += "iproute2" |
| 22 | |
Andrew Geissler | 32b1199 | 2021-03-31 13:37:05 -0500 | [diff] [blame^] | 23 | SRC_URI = "https://github.com/Quagga/quagga/releases/download/quagga-${PV}/quagga-${PV}.tar.gz \ |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 24 | 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 Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 30 | 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 Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 37 | " |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 38 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 39 | PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 40 | PACKAGECONFIG[cap] = "--enable-capabilities,--disable-capabilities,libcap" |
| 41 | PACKAGECONFIG[pam] = "--with-libpam, --without-libpam, libpam" |
| 42 | |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 43 | inherit autotools update-rc.d useradd systemd pkgconfig multilib_header update-alternatives |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 44 | |
Andrew Geissler | bffdb3e | 2020-08-21 16:13:29 -0500 | [diff] [blame] | 45 | CFLAGS += "-fcommon" |
| 46 | |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 47 | SYSTEMD_PACKAGES = "${PN} ${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 48 | SYSTEMD_SERVICE_${PN}-bgpd = "bgpd.service" |
| 49 | SYSTEMD_SERVICE_${PN}-isisd = "isisd.service" |
| 50 | SYSTEMD_SERVICE_${PN}-ospf6d = "ospf6d.service" |
| 51 | SYSTEMD_SERVICE_${PN}-ospfd = "ospfd.service" |
| 52 | SYSTEMD_SERVICE_${PN}-ripd = "ripd.service" |
| 53 | SYSTEMD_SERVICE_${PN}-ripngd = "ripngd.service" |
| 54 | SYSTEMD_SERVICE_${PN} = "zebra.service" |
| 55 | |
| 56 | EXTRA_OECONF = "--sysconfdir=${sysconfdir}/quagga \ |
| 57 | --localstatedir=${localstatedir}/run/quagga \ |
| 58 | --enable-exampledir=${docdir}/quagga/examples/ \ |
| 59 | --enable-vtysh \ |
| 60 | --enable-isisd \ |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 61 | ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '--enable-watchquagga', '--disable-watchquagga', d)} \ |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 62 | --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 Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 74 | CACHED_CONFIGUREVARS += "ac_cv_path_PERL='/usr/bin/env perl'" |
| 75 | |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 76 | do_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 |
Andrew Geissler | 4b7c115 | 2020-11-30 19:55:29 -0600 | [diff] [blame] | 84 | install -m 0644 ${WORKDIR}/volatiles.03_quagga ${D}${sysconfdir}/default/volatiles/03_quagga |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 85 | |
| 86 | # Install sample configurations for the daemons |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 87 | for f in bgpd vtysh isisd ospfd ripngd zebra ripd ospf6d; do |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 88 | install -m 0640 ${S}/$f/$f.conf.sample ${D}${sysconfdir}/quagga/$f.conf.sample |
| 89 | done |
| 90 | |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 91 | for f in bgpd vtysh isisd ospfd ripngd zebra ripd ospf6d; do |
| 92 | touch ${D}${sysconfdir}/quagga/$f.conf |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 93 | 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 |
Andrew Geissler | 4b7c115 | 2020-11-30 19:55:29 -0600 | [diff] [blame] | 109 | sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/volatiles/03_quagga |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 110 | sed -i 's!^PATH=.*!PATH=${base_sbindir}:${sbindir}:${base_bindir}:${bindir}!' ${D}${sysconfdir}/init.d/* |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 111 | sed -i 's!--with-libtool-sysroot=[^ "]*!!' ${D}${includedir}/quagga/version.h |
| 112 | |
| 113 | oe_multilib_header quagga/version.h |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 114 | |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 115 | # 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 Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 123 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 124 | install -d ${D}${nonarch_libdir}/tmpfiles.d |
| 125 | echo "d /run/quagga 0755 quagga quagga -" \ |
| 126 | > ${D}${nonarch_libdir}/tmpfiles.d/${BPN}.conf |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 127 | 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 Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 136 | for i in bgpd isisd ospf6d ospfd ripd ripngd zebra; do |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 137 | 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 | |
| 147 | DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}" |
| 148 | pkg_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 Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 158 | PACKAGE_BEFORE_PN = "${PN}-ospfd ${PN}-ospf6d ${PN}-bgpd \ |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 159 | ${PN}-ripd ${PN}-ripngd ${PN}-isisd \ |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 160 | ${PN}-ospfclient ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '${PN}-watchquagga', '', d)}" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 161 | |
Patrick Williams | ddad1a1 | 2017-02-23 20:36:32 -0600 | [diff] [blame] | 162 | RDEPENDS_${PN} += "${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 163 | |
| 164 | FILES_${PN}-ospfd = "${sbindir}/ospfd ${libdir}/libospf.so.*" |
| 165 | FILES_${PN}-ospf6d = "${sbindir}/ospf6d" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 166 | FILES_${PN}-bgpd = "${sbindir}/bgpd" |
| 167 | FILES_${PN}-ripd = "${sbindir}/ripd" |
| 168 | FILES_${PN}-ripngd = "${sbindir}/ripngd" |
| 169 | FILES_${PN}-isisd = "${sbindir}/isisd" |
| 170 | FILES_${PN}-ospfclient = "${sbindir}/ospfclient ${libdir}/libospfapiclient.so.*" |
| 171 | FILES_${PN}-watchquagga = "${sbindir}/watchquagga ${sysconfdir}/default/watchquagga \ |
| 172 | ${sysconfdir}/init.d/watchquagga" |
| 173 | |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 174 | FILES_${PN} += "${nonarch_libdir}/tmpfiles.d/*.conf" |
| 175 | |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 176 | # Indicate that the default files are configuration files |
| 177 | CONFFILES_${PN} = "${sysconfdir}/default/quagga \ |
| 178 | ${sysconfdir}/quagga/bgpd.conf \ |
| 179 | ${sysconfdir}/quagga/vtysh.conf \ |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 180 | ${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 | " |
| 187 | CONFFILES_${PN}-watchquagga = "${sysconfdir}/default/watchquagga" |
| 188 | |
| 189 | # Stop the names being rewritten due to the internal shared libraries |
| 190 | DEBIAN_NOAUTONAME_${PN}-ospfd = "1" |
| 191 | DEBIAN_NOAUTONAME_${PN}-ospfclient = "1" |
| 192 | |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 193 | # Main init script starts all deamons |
| 194 | # Seperate init script for watchquagga |
| 195 | INITSCRIPT_PACKAGES = "${PN} ${PN}-watchquagga" |
| 196 | INITSCRIPT_NAME_${PN} = "quagga" |
| 197 | INITSCRIPT_PARAMS_${PN} = "defaults 15 85" |
| 198 | INITSCRIPT_NAME_${PN}-watchquagga = "watchquagga" |
| 199 | INITSCRIPT_PARAMS_${PN}-watchquagga = "defaults 90 10" |
| 200 | |
| 201 | # Add quagga's user and group |
| 202 | USERADD_PACKAGES = "${PN}" |
| 203 | GROUPADD_PARAM_${PN} = "--system quagga ; --system quaggavty" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 204 | USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/quagga/ -M -g quagga -G quaggavty --shell /bin/false quagga" |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 205 | |
| 206 | pkg_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 |
| 213 | pkg_prerm_${PN} () { |
| 214 | ${sysconfdir}/init.d/quagga stop |
| 215 | } |
| 216 | |
| 217 | pkg_prerm_${PN}-ospfd () { |
| 218 | ${sysconfdir}/init.d/quagga stop ospfd |
| 219 | } |
| 220 | |
| 221 | pkg_prerm_${PN}-ospf6d () { |
| 222 | ${sysconfdir}/init.d/quagga stop ospf6d |
| 223 | } |
| 224 | |
Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame] | 225 | pkg_prerm_${PN}-bgpd () { |
| 226 | ${sysconfdir}/init.d/quagga stop bgpd |
| 227 | } |
| 228 | |
| 229 | pkg_prerm_${PN}-ripd () { |
| 230 | ${sysconfdir}/init.d/quagga stop ripd |
| 231 | } |
| 232 | |
| 233 | pkg_prerm_${PN}-ripngd () { |
| 234 | ${sysconfdir}/init.d/quagga stop ripngd |
| 235 | } |
| 236 | |
| 237 | pkg_prerm_${PN}-isisd () { |
| 238 | ${sysconfdir}/init.d/quagga stop isisd |
| 239 | } |
Andrew Geissler | d688a01 | 2020-09-18 13:36:00 -0500 | [diff] [blame] | 240 | |
| 241 | ALTERNATIVE_${PN} = "pimd" |
| 242 | ALTERNATIVE_LINK_NAME[pimd] = "${sbindir}/pimd" |
| 243 | |