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" |
| 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-ospfclient=yes \ |
| 69 | --enable-multipath=64 \ |
| 70 | --enable-user=quagga \ |
| 71 | --enable-group=quagga \ |
| 72 | --enable-vty-group=quaggavty \ |
| 73 | --enable-configfile-mask=0640 \ |
| 74 | --enable-logfile-mask=0640 \ |
| 75 | --enable-rtadv \ |
| 76 | --enable-linux24-tcp-md5 \ |
| 77 | ap_cv_cc_pie=no \ |
| 78 | ${SNMP_CONF}" |
| 79 | |
| 80 | do_install () { |
| 81 | # Install init script and default settings |
| 82 | install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d \ |
| 83 | ${D}${sysconfdir}/quagga ${D}${sysconfdir}/default/volatiles |
| 84 | install -m 0644 ${WORKDIR}/quagga.default ${D}${sysconfdir}/default/quagga |
| 85 | install -m 0644 ${WORKDIR}/watchquagga.default ${D}${sysconfdir}/default/watchquagga |
| 86 | install -m 0755 ${WORKDIR}/quagga.init ${D}${sysconfdir}/init.d/quagga |
| 87 | install -m 0755 ${WORKDIR}/watchquagga.init ${D}${sysconfdir}/init.d/watchquagga |
| 88 | install -m 0644 ${WORKDIR}/volatiles.03_quagga ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga |
| 89 | |
| 90 | # Install sample configurations for the daemons |
| 91 | for f in bgpd vtysh babeld isisd ospfd ripngd zebra ripd ospf6d; do |
| 92 | install -m 0640 ${S}/$f/$f.conf.sample ${D}${sysconfdir}/quagga/$f.conf.sample |
| 93 | done |
| 94 | |
| 95 | for f in bgpd vtysh babeld isisd ospfd ripngd zebra ripd ospf6d; do |
| 96 | touch ${D}${sysconfdir}/quagga/$f.conf |
| 97 | done |
| 98 | chown quagga:quaggavty ${D}${sysconfdir}/quagga |
| 99 | chown quagga:quagga ${D}${sysconfdir}/quagga/*.conf |
| 100 | chmod 750 ${D}${sysconfdir}/quagga |
| 101 | chmod 640 ${D}${sysconfdir}/quagga/*.conf |
| 102 | |
| 103 | # Install quagga |
| 104 | oe_runmake install DESTDIR=${D} prefix=${prefix} \ |
| 105 | sbindir=${sbindir} \ |
| 106 | sysconfdir=${sysconfdir}/quagga \ |
| 107 | localstatedir=${localstatedir}/run/quagga |
| 108 | |
| 109 | # Fix hardcoded paths |
| 110 | sed -i 's!/usr/sbin/!${sbindir}/!g' ${D}${sysconfdir}/init.d/* |
| 111 | sed -i 's!/usr/bin/!${bindir}/!g' ${D}${sysconfdir}/init.d/quagga |
| 112 | sed -i 's!/etc/!${sysconfdir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/watchquagga |
| 113 | sed -i 's!/var/!${localstatedir}/!g' ${D}${sysconfdir}/init.d/* ${D}${sysconfdir}/default/volatiles/volatiles.03_quagga |
| 114 | sed -i 's!^PATH=.*!PATH=${base_sbindir}:${sbindir}:${base_bindir}:${bindir}!' ${D}${sysconfdir}/init.d/* |
| 115 | |
| 116 | # Remove generated info dir file, it doesn't belong in the generated |
| 117 | # package. |
| 118 | rm -f ${D}${infodir}/dir |
| 119 | |
| 120 | # For PAM |
| 121 | for feature in ${DISTRO_FEATURES}; do |
| 122 | if [ "$feature" = "pam" ]; then |
| 123 | install -D -m 644 ${WORKDIR}/quagga.pam ${D}/${sysconfdir}/pam.d/quagga |
| 124 | break |
| 125 | fi |
| 126 | done |
| 127 | |
| 128 | if ${@base_contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
| 129 | install -d ${D}${sysconfdir}/tmpfiles.d |
| 130 | echo "d /var/run/quagga 0755 quagga quagga -" \ |
| 131 | > ${D}${sysconfdir}/tmpfiles.d/${BPN}.conf |
| 132 | fi |
| 133 | |
| 134 | # Remove sysinit script if sysvinit is not in DISTRO_FEATURES |
| 135 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'false', 'true', d)}; then |
| 136 | rm -rf ${D}${sysconfdir}/init.d/ |
| 137 | rm -f ${D}${sysconfdir}/default/watchquagga |
| 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 | -e 's,@base_bindir@,${base_bindir},g' \ |
| 148 | -e 's,@localstatedir@,${localstatedir},g' \ |
| 149 | -i ${D}${systemd_unitdir}/system/*.service |
| 150 | } |
| 151 | |
| 152 | DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd-systemctl-native', '', d)}" |
| 153 | pkg_postinst_${PN} () { |
| 154 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd sysvinit', 'true', 'false', d)}; then |
| 155 | if [ -n "$D" ]; then |
| 156 | OPTS="--root=$D" |
| 157 | fi |
| 158 | systemctl $OPTS mask quagga.service |
| 159 | fi |
| 160 | } |
| 161 | |
| 162 | # Split into a main package and separate per-protocol packages |
| 163 | PACKAGE_BEFORE_PN = "${PN}-ospfd ${PN}-ospf6d ${PN}-babeld ${PN}-bgpd \ |
| 164 | ${PN}-ripd ${PN}-ripngd ${PN}-isisd \ |
| 165 | ${PN}-ospfclient ${@base_contains('DISTRO_FEATURES', 'sysvinit', '${PN}-watchquagga', '', d)}" |
| 166 | |
| 167 | RDEPENDS_${PN} += "${PN}-babeld ${PN}-bgpd ${PN}-isisd ${PN}-ospf6d ${PN}-ospfd ${PN}-ripd ${PN}-ripngd" |
| 168 | |
| 169 | FILES_${PN}-ospfd = "${sbindir}/ospfd ${libdir}/libospf.so.*" |
| 170 | FILES_${PN}-ospf6d = "${sbindir}/ospf6d" |
| 171 | FILES_${PN}-babeld = "${sbindir}/babeld" |
| 172 | FILES_${PN}-bgpd = "${sbindir}/bgpd" |
| 173 | FILES_${PN}-ripd = "${sbindir}/ripd" |
| 174 | FILES_${PN}-ripngd = "${sbindir}/ripngd" |
| 175 | FILES_${PN}-isisd = "${sbindir}/isisd" |
| 176 | FILES_${PN}-ospfclient = "${sbindir}/ospfclient ${libdir}/libospfapiclient.so.*" |
| 177 | FILES_${PN}-watchquagga = "${sbindir}/watchquagga ${sysconfdir}/default/watchquagga \ |
| 178 | ${sysconfdir}/init.d/watchquagga" |
| 179 | |
| 180 | # Indicate that the default files are configuration files |
| 181 | CONFFILES_${PN} = "${sysconfdir}/default/quagga \ |
| 182 | ${sysconfdir}/quagga/bgpd.conf \ |
| 183 | ${sysconfdir}/quagga/vtysh.conf \ |
| 184 | ${sysconfdir}/quagga/babeld.conf \ |
| 185 | ${sysconfdir}/quagga/isisd.conf \ |
| 186 | ${sysconfdir}/quagga/ospfd.conf \ |
| 187 | ${sysconfdir}/quagga/ripngd.conf \ |
| 188 | ${sysconfdir}/quagga/zebra.conf \ |
| 189 | ${sysconfdir}/quagga/ripd.conf \ |
| 190 | ${sysconfdir}/quagga/ospf6d.conf \ |
| 191 | " |
| 192 | CONFFILES_${PN}-watchquagga = "${sysconfdir}/default/watchquagga" |
| 193 | |
| 194 | # Stop the names being rewritten due to the internal shared libraries |
| 195 | DEBIAN_NOAUTONAME_${PN}-ospfd = "1" |
| 196 | DEBIAN_NOAUTONAME_${PN}-ospfclient = "1" |
| 197 | |
| 198 | # the "ip" command from busybox is not sufficient (flush by protocol flushes all routes) |
| 199 | RDEPENDS_${PN} += "iproute2" |
| 200 | |
| 201 | # Main init script starts all deamons |
| 202 | # Seperate init script for watchquagga |
| 203 | INITSCRIPT_PACKAGES = "${PN} ${PN}-watchquagga" |
| 204 | INITSCRIPT_NAME_${PN} = "quagga" |
| 205 | INITSCRIPT_PARAMS_${PN} = "defaults 15 85" |
| 206 | INITSCRIPT_NAME_${PN}-watchquagga = "watchquagga" |
| 207 | INITSCRIPT_PARAMS_${PN}-watchquagga = "defaults 90 10" |
| 208 | |
| 209 | # Add quagga's user and group |
| 210 | USERADD_PACKAGES = "${PN}" |
| 211 | GROUPADD_PARAM_${PN} = "--system quagga ; --system quaggavty" |
| 212 | USERADD_PARAM_${PN} = "--system --home ${localstatedir}/run/quagga/ -M -g quagga --shell /bin/false quagga" |
| 213 | |
| 214 | pkg_postinst_${PN} () { |
| 215 | if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then |
| 216 | ${sysconfdir}/init.d/populate-volatile.sh update |
| 217 | fi |
| 218 | } |
| 219 | |
| 220 | # Stop apps before uninstall |
| 221 | pkg_prerm_${PN} () { |
| 222 | ${sysconfdir}/init.d/quagga stop |
| 223 | } |
| 224 | |
| 225 | pkg_prerm_${PN}-ospfd () { |
| 226 | ${sysconfdir}/init.d/quagga stop ospfd |
| 227 | } |
| 228 | |
| 229 | pkg_prerm_${PN}-ospf6d () { |
| 230 | ${sysconfdir}/init.d/quagga stop ospf6d |
| 231 | } |
| 232 | |
| 233 | pkg_prerm_${PN}-babeld () { |
| 234 | ${sysconfdir}/init.d/quagga stop babeld |
| 235 | } |
| 236 | |
| 237 | pkg_prerm_${PN}-bgpd () { |
| 238 | ${sysconfdir}/init.d/quagga stop bgpd |
| 239 | } |
| 240 | |
| 241 | pkg_prerm_${PN}-ripd () { |
| 242 | ${sysconfdir}/init.d/quagga stop ripd |
| 243 | } |
| 244 | |
| 245 | pkg_prerm_${PN}-ripngd () { |
| 246 | ${sysconfdir}/init.d/quagga stop ripngd |
| 247 | } |
| 248 | |
| 249 | pkg_prerm_${PN}-isisd () { |
| 250 | ${sysconfdir}/init.d/quagga stop isisd |
| 251 | } |