From 6973d43fe929f2b28761777b7921b7bb5005b1a1 Mon Sep 17 00:00:00 2001 From: Sandino Araico Sanchez Date: Wed, 12 Dec 2012 18:53:52 -0600 Subject: [PATCH] script parchado de quagga --- net-misc/quagga/Manifest | 10 ++ net-misc/quagga/files/437292-ipforward.patch | 19 +++ .../files/quagga-0.99.21-fix-no-ipv6.patch | 136 ++++++++++++++++++ .../quagga/files/quagga-link-libcap.patch | 24 ++++ net-misc/quagga/files/quagga-services.init.2 | 53 +++++++ net-misc/quagga/files/quagga-services.init.3 | 44 ++++++ net-misc/quagga/files/quagga.pam | 26 ++++ net-misc/quagga/files/zebra.init.3 | 55 +++++++ net-misc/quagga/quagga-0.99.21-r1.ebuild | 127 ++++++++++++++++ 9 files changed, 494 insertions(+) create mode 100644 net-misc/quagga/Manifest create mode 100644 net-misc/quagga/files/437292-ipforward.patch create mode 100644 net-misc/quagga/files/quagga-0.99.21-fix-no-ipv6.patch create mode 100644 net-misc/quagga/files/quagga-link-libcap.patch create mode 100644 net-misc/quagga/files/quagga-services.init.2 create mode 100644 net-misc/quagga/files/quagga-services.init.3 create mode 100644 net-misc/quagga/files/quagga.pam create mode 100644 net-misc/quagga/files/zebra.init.3 create mode 100644 net-misc/quagga/quagga-0.99.21-r1.ebuild diff --git a/net-misc/quagga/Manifest b/net-misc/quagga/Manifest new file mode 100644 index 0000000..344bb9e --- /dev/null +++ b/net-misc/quagga/Manifest @@ -0,0 +1,10 @@ +AUX 437292-ipforward.patch 611 SHA256 e16c2c71a5a60ab9b3ed5c97be0c3763da70c790a121b45fe50300d3e81e869d SHA512 ea016978319f4fa4c559f9c5cef0568e616a5224243c2354e75c6602cd4ed7608c091ec8eafb5c5010f8620d5f49d6df3e9226445ff45c645cfbe58a9dad5fc1 WHIRLPOOL 21d55d483063fcd54115c68889f33ad05b776e3d98a11a91ea403fa918b6555ed2d2410af843eeb07c8be6e11c819341c7faa6af19dea31dcd8997ba2b7b0f11 +AUX quagga-0.99.21-fix-no-ipv6.patch 3144 SHA256 905478424846456138fa194fee40ffd773d58ee0c68424fc0f5b986abfd0044e SHA512 8d05e60c980b207dd4a0e59f8bc95f687e16c521a41aeda542beb68ae23bc0e4f416c46521d902b188903fbde858479d8dbe6e02585508d9ab3326b29a277be4 WHIRLPOOL c1dd29bd9a7f3cd1c00f31a0d80d2728ae97cdf45040605064470070bf0b6989d7f18331b243b8c9784b78bdba292da2e48a02ccce8e5a3b9988b6d7f4331081 +AUX quagga-link-libcap.patch 1027 SHA256 33bbab3490852b32f38437d50d64fcbb2a98e063503ccc46dd75cd350187853f SHA512 bc87b14432af75bc6e1bb27a7f90f0a05ddd98c6b554ef53535a2fc8e43f49c76762c8a0c240323817fdbb4e1ce29b868da7b768c597acce919febe8f040ec78 WHIRLPOOL 6be7d422ecdd4166c2bf22d8a2dbfdbdbcee9bb4d3af1d189457e3dda8d2746466533789c23f18ce9f726daf2c89b2b731675a8222d8957fb4410b550e24964f +AUX quagga-services.init.2 1384 SHA256 51f604e45d82831fe2d34ec9a15ab65c6aaa21c7a3bc6856c97372cabbc06108 SHA512 e4d92a694f13ddeea9980b37de9322a19ca21f458fd4be621860c2d5835a78cb853a48bec91a858a48e8fead0dde7f993e2b7a4e119823bf74fa3e170102574e WHIRLPOOL 5ed2f7f801e1b0c859da04b2637c66eb6de94aa1e7ec553fd166e98d242d0081a5327a7a2cc79a715a93393cce71f0cfde15642e252ca8629ffdc23c5c9fc565 +AUX quagga-services.init.3 1195 SHA256 5941bdf35374a94a50e2b004993883fa69047e72de644008d15bb260a4eb7ada SHA512 de42ef010c833dc623517efd8b25212c5859b8819863e37b165cc6102b520d554f996dd710fd52e6ed35c0d43b3d52045bce52a2fa2973a390302ce943dc295f WHIRLPOOL 948c98c107416a530ee76e0259df5c11b943762659fa62c4228c664ee28e110b95add813eaf37270635ff42a7230cc68c535569f09fa3cc5505feddbc1b9b46e +AUX quagga.pam 975 SHA256 aa68ac97d7a951324bc3c4124a1c70f6fa88a45da860f636ac01cbcbfa36db70 SHA512 92dc6c68146d46046c6f5ff410629a2a7170e81e9657b7a2aebe1d94c8fa267acdcac9d8d8596fb54dbbacc0566502e82d900ea33f8824c07fba497b7e0f1efe WHIRLPOOL defc345fe4ccbff1cf3b68bee46f589467d68b11f7511d1333f9cdf4dbef8c55c32e4b0d9eb2f2aa57df7bdb47baa75bada593f97059494534192d34c808733b +AUX zebra.init.3 1433 SHA256 ce174d7b8a277f0e1c2ba2c6991b133c1cbd4f3f445406f741e1e4becc236918 SHA512 b7be568b03d5c20f3ac29669cc0cefd52fe06ab053fb3f82197d875d05835654efc64f5846d92816866e979602647a1f4d1d59806bc68e6a0e1900a4be840e34 WHIRLPOOL cff2c0cf8395ff77418653d72cfaa9e3e511aeb8ba47b17115ba5b41c2c8380b8c09d533e2ce022b849db15f56caf83c9e2661990866790504b7d8767d26191d +DIST ht-20040304-classless-bgp.patch 1581 SHA256 39993890f9e31d662ed0564c732fb22392a901beb45b64261ffeadd9edf27887 SHA512 3df102d8ab88aaee1f109a2310602d6f734f2268252e5e42df752df7db7abeac526e969289481c4abfe905dcd41c35dee65196c48ac320fe9d083305451476e8 WHIRLPOOL cef99d64d52ab8c28bd672fb93dfbd8d716a31c76a5403496a6d104a5ff39531d6085134124d41fe4ff7adf895fa001cbe77b6e42846d849d6c108c81583d04e +DIST quagga-0.99.21.tar.xz 1572264 SHA256 87329c3d9d4e5c0a74812e725026560c477f610eec9771e67baf513da0357246 SHA512 0f35cabfd7aa82e08f3f728660f0fe4c35a38e1146fca8ea37100e176333363cdd3cb22987cffd644f77852bfbf8b98da87310abdc575b2200415901837765cd WHIRLPOOL f745f4840671da06c6e6504c446e86c02f255f7bf5b35651aa205cf6e4021048fd3640b8b4a66a45798191105799f19aa77ea2b05d26cc2111aba22659722197 +EBUILD quagga-0.99.21-r1.ebuild 3682 SHA256 b58e7842871f02615db4806918c343f3a8107e6485718ea9f9eba13df300b5a4 SHA512 e84248c92e4ba4d3cd11eeee6533825392f4bc82760bae33446350649e1aa6145e003cca6c7892e6bf79ea49a0eb64aa9f9e86cacf698057422c1886c281c56c WHIRLPOOL a82a71b531c2546e5ad1aaa945f41bb9f2482f1f0c2bf61cc167d357d403af1fd81ee4a83bf7f365b96ab50f24f8b54c8dc50e0efe12a39db52fb0b74f208f29 diff --git a/net-misc/quagga/files/437292-ipforward.patch b/net-misc/quagga/files/437292-ipforward.patch new file mode 100644 index 0000000..2437428 --- /dev/null +++ b/net-misc/quagga/files/437292-ipforward.patch @@ -0,0 +1,19 @@ +diff -Naur quagga-0.99.18.orig/zebra/ipforward_sysctl.c quagga-0.99.18/zebra/ipforward_sysctl.c +--- quagga-0.99.18.orig/zebra/ipforward_sysctl.c 2011-04-13 11:58:40.000000000 -0400 ++++ quagga-0.99.18/zebra/ipforward_sysctl.c 2011-04-13 11:58:51.000000000 -0400 +@@ -31,6 +31,15 @@ + + #define MIB_SIZ 4 + ++/* Fix for recent (2.6.14) kernel headers */ ++#ifndef IPCTL_FORWARDING ++ #define IPCTL_FORWARDING NET_IPV4_FORWARD ++#endif ++ ++#ifndef IP6CTL_FORWARDING ++ #define IP6CTL_FORWARDING NET_IPV6_FORWARDING ++#endif ++ + extern struct zebra_privs_t zserv_privs; + + /* IPv4 forwarding control MIB. */ diff --git a/net-misc/quagga/files/quagga-0.99.21-fix-no-ipv6.patch b/net-misc/quagga/files/quagga-0.99.21-fix-no-ipv6.patch new file mode 100644 index 0000000..ad47665 --- /dev/null +++ b/net-misc/quagga/files/quagga-0.99.21-fix-no-ipv6.patch @@ -0,0 +1,136 @@ +Fix building with no IPv6 support +https://dev.openwrt.org/changeset/32697 + +Index: quagga-0.99.21/zebra/main.c +=================================================================== +--- quagga-0.99.21.orig/zebra/main.c ++++ quagga-0.99.21/zebra/main.c +@@ -327,7 +327,9 @@ main (int argc, char **argv) + zebra_vty_init (); + access_list_init (); + prefix_list_init (); ++#ifdef RTADV + rtadv_init (); ++#endif + #ifdef HAVE_IRDP + irdp_init(); + #endif +Index: quagga-0.99.21/zebra/rtadv.h +=================================================================== +--- quagga-0.99.21.orig/zebra/rtadv.h ++++ quagga-0.99.21/zebra/rtadv.h +@@ -26,6 +26,9 @@ + #include "vty.h" + #include "zebra/interface.h" + ++/* NB: RTADV is defined in zebra/interface.h above */ ++#ifdef RTADV ++ + /* Router advertisement prefix. */ + struct rtadv_prefix + { +@@ -96,4 +99,6 @@ struct nd_opt_homeagent_info { /* Home + + extern const char *rtadv_pref_strs[]; + ++#endif /* RTADV */ ++ + #endif /* _ZEBRA_RTADV_H */ +Index: quagga-0.99.21/zebra/zebra_vty.c +=================================================================== +--- quagga-0.99.21.orig/zebra/zebra_vty.c ++++ quagga-0.99.21/zebra/zebra_vty.c +@@ -1197,6 +1197,40 @@ DEFUN (show_ip_protocol, + return CMD_SUCCESS; + } + ++/* ++ * Show IP mroute command to dump the BGP Multicast ++ * routing table ++ */ ++DEFUN (show_ip_mroute, ++ show_ip_mroute_cmd, ++ "show ip mroute", ++ SHOW_STR ++ IP_STR ++ "IP Multicast routing table\n") ++{ ++ struct route_table *table; ++ struct route_node *rn; ++ struct rib *rib; ++ int first = 1; ++ ++ table = vrf_table (AFI_IP, SAFI_MULTICAST, 0); ++ if (! table) ++ return CMD_SUCCESS; ++ ++ /* Show all IPv4 routes. */ ++ for (rn = route_top (table); rn; rn = route_next (rn)) ++ for (rib = rn->info; rib; rib = rib->next) ++ { ++ if (first) ++ { ++ vty_out (vty, SHOW_ROUTE_V4_HEADER); ++ first = 0; ++ } ++ vty_show_ip_route (vty, rn, rib); ++ } ++ return CMD_SUCCESS; ++} ++ + + #ifdef HAVE_IPV6 + /* General fucntion for IPv6 static route. */ +@@ -1952,40 +1986,6 @@ DEFUN (show_ipv6_route_summary, + } + + /* +- * Show IP mroute command to dump the BGP Multicast +- * routing table +- */ +-DEFUN (show_ip_mroute, +- show_ip_mroute_cmd, +- "show ip mroute", +- SHOW_STR +- IP_STR +- "IP Multicast routing table\n") +-{ +- struct route_table *table; +- struct route_node *rn; +- struct rib *rib; +- int first = 1; +- +- table = vrf_table (AFI_IP, SAFI_MULTICAST, 0); +- if (! table) +- return CMD_SUCCESS; +- +- /* Show all IPv4 routes. */ +- for (rn = route_top (table); rn; rn = route_next (rn)) +- for (rib = rn->info; rib; rib = rib->next) +- { +- if (first) +- { +- vty_out (vty, SHOW_ROUTE_V4_HEADER); +- first = 0; +- } +- vty_show_ip_route (vty, rn, rib); +- } +- return CMD_SUCCESS; +-} +- +-/* + * Show IPv6 mroute command.Used to dump + * the Multicast routing table. + */ +@@ -2020,11 +2020,6 @@ DEFUN (show_ipv6_mroute, + return CMD_SUCCESS; + } + +- +- +- +- +- + /* Write IPv6 static route configuration. */ + static int + static_config_ipv6 (struct vty *vty) diff --git a/net-misc/quagga/files/quagga-link-libcap.patch b/net-misc/quagga/files/quagga-link-libcap.patch new file mode 100644 index 0000000..7e63c7f --- /dev/null +++ b/net-misc/quagga/files/quagga-link-libcap.patch @@ -0,0 +1,24 @@ +diff -Nru quagga-0.99.8.orig/lib/Makefile.am quagga-0.99.8/lib/Makefile.am +--- quagga-0.99.8.orig/lib/Makefile.am 2006-06-27 10:48:16.000000000 +0300 ++++ quagga-0.99.8/lib/Makefile.am 2007-08-13 22:09:10.000000000 +0300 +@@ -18,7 +18,7 @@ + + libzebra_la_DEPENDENCIES = @LIB_REGEX@ + +-libzebra_la_LIBADD = @LIB_REGEX@ ++libzebra_la_LIBADD = @LIB_REGEX@ @LIBCAP@ + + pkginclude_HEADERS = \ + buffer.h checksum.h command.h filter.h getopt.h hash.h \ +diff -Nru quagga-0.99.8.orig/zebra/Makefile.am quagga-0.99.8/zebra/Makefile.am +--- quagga-0.99.8.orig/zebra/Makefile.am 2007-05-02 18:28:33.000000000 +0300 ++++ quagga-0.99.8/zebra/Makefile.am 2007-08-13 22:09:10.000000000 +0300 +@@ -36,7 +36,7 @@ + connected.h ioctl.h rib.h rt.h zserv.h redistribute.h debug.h rtadv.h \ + interface.h ipforward.h irdp.h router-id.h kernel_socket.h + +-zebra_LDADD = $(otherobj) $(LIBCAP) $(LIB_IPV6) ../lib/libzebra.la ++zebra_LDADD = $(otherobj) ../lib/libzebra.la $(LIBCAP) $(LIB_IPV6) + + testzebra_LDADD = $(LIBCAP) $(LIB_IPV6) ../lib/libzebra.la + diff --git a/net-misc/quagga/files/quagga-services.init.2 b/net-misc/quagga/files/quagga-services.init.2 new file mode 100644 index 0000000..c05face --- /dev/null +++ b/net-misc/quagga/files/quagga-services.init.2 @@ -0,0 +1,53 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/quagga/files/quagga-services.init.2,v 1.3 2011/09/27 21:51:34 flameeyes Exp $ + +: ${CFGFILE:=/etc/quagga/${SVCNAME}.conf} + +get_service_config() { + [ -e "$CFGFILE" ] || return + + awk '$1 == "'$1'" { s=$2 } END { print s }' "$CFGFILE" +} + +depend() { + config "$CFGFILE" + + need zebra + + [ "$(get_service_config log)" = "syslog" ] && \ + use logger +} + +start() { + if [ ! -e "${CFGFILE}" ] ; then + eerror "Before starting ${SVCNAME} you have to configure it, by creating" + eerror "a ${CFGFILE} file." + eerror "" + eerror "A sample file has been installed in `ls /usr/share/doc/quagga-*/samples/${SVCNAME}.conf.sample`" + return 1 + fi + + if [ ! -d /var/run/quagga ] ; then + mkdir -p /var/run/quagga + chown quagga:quagga /var/run/quagga + chmod 0750 /var/run/quagga + fi + + ebegin "Starting ${SVCNAME}" + start-stop-daemon \ + --start --exec /usr/sbin/${SVCNAME} \ + --pidfile /var/run/quagga/${SVCNAME}.pid \ + -- -d -f "${CFGFILE}" ${EXTRA_OPTS} \ + --pid_file /var/run/quagga/${SVCNAME}.pid + + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop \ + --pidfile /var/run/quagga/${SVCNAME}.pid + eend $? +} diff --git a/net-misc/quagga/files/quagga-services.init.3 b/net-misc/quagga/files/quagga-services.init.3 new file mode 100644 index 0000000..a91c825 --- /dev/null +++ b/net-misc/quagga/files/quagga-services.init.3 @@ -0,0 +1,44 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/quagga/files/quagga-services.init.3,v 1.2 2012/12/05 22:48:59 jer Exp $ + +: ${CFGFILE:=/etc/quagga/${SVCNAME}.conf} + +pidfile=/var/run/quagga/${SVCNAME}.pid + +command=/usr/sbin/${SVCNAME} +command_args="-d -f ${CFGFILE} ${EXTRA_OPTS} --pid_file ${pidfile}" + +get_service_config() { + [ -e "$CFGFILE" ] || return + + awk '$1 == "'$1'" { s=$2 } END { print s }' "$CFGFILE" +} + +depend() { + config "$CFGFILE" + + [ ${SVCNAME} = "zebra" ] && need net || need zebra + + [ "$(get_service_config log)" = "syslog" ] && \ + use logger +} + +start_pre() { + if [ ! -e "${CFGFILE}" ] ; then + eerror "Before starting ${SVCNAME} you have to configure it, by creating" + eerror "a ${CFGFILE} file." + eerror "" + eerror "A sample file has been installed in `echo /usr/share/doc/quagga-*/samples/${SVCNAME}.conf.sample*`" + return 1 + fi + + checkpath -d -m 0750 -o quagga:quagga /var/run/quagga + + if [ ${SVCNAME} = "zebra" ]; then + ebegin "Cleaning up stale zebra routes..." + ip route flush proto zebra + eend $? + fi +} diff --git a/net-misc/quagga/files/quagga.pam b/net-misc/quagga/files/quagga.pam new file mode 100644 index 0000000..9a91ad8 --- /dev/null +++ b/net-misc/quagga/files/quagga.pam @@ -0,0 +1,26 @@ +#%PAM-1.0 +# + +##### if running quagga as root: +# Only allow root (and possibly wheel) to use this because enable access +# is unrestricted. +auth sufficient pam_rootok.so + +# Uncomment the following line to implicitly trust users in the "wheel" group. +#auth sufficient pam_wheel.so trust use_uid +# Uncomment the following line to require a user to be in the "wheel" group. +#auth required pam_wheel.so use_uid +########################################################### + +# If using quagga privileges and with a seperate group for vty access, then +# access can be controlled via the vty access group, and pam can simply +# check for valid user/password, eg: +# +# only allow local users. +#auth required pam_securetty.so +#auth include system-auth +#auth required pam_nologin.so +#account include system-auth +#password include system-auth +#session include system-auth +#session optional pam_console.so diff --git a/net-misc/quagga/files/zebra.init.3 b/net-misc/quagga/files/zebra.init.3 new file mode 100644 index 0000000..b0c6f92 --- /dev/null +++ b/net-misc/quagga/files/zebra.init.3 @@ -0,0 +1,55 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/quagga/files/zebra.init.3,v 1.2 2011/09/27 21:50:12 flameeyes Exp $ + +: ${CFGFILE:=/etc/quagga/${SVCNAME}.conf} + +get_service_config() { + awk '$1 == "'$1'" { s=$2 } END { print s }' "$CFGFILE" +} + +depend() { + config "$CFGFILE" + + need net + + [ "$(get_service_config log)" = "syslog" ] && \ + use logger +} + +start() { + if [ ! -e "${CFGFILE}" ] ; then + eerror "Before starting ${SVCNAME} you have to configure it, by creating" + eerror "a ${CFGFILE} file." + eerror "" + eerror "A sample file has been installed in `ls /usr/share/doc/quagga-*/samples/${SVCNAME}.conf.sample`" + return 1 + fi + + if [ ! -d /var/run/quagga ] ; then + mkdir -p /var/run/quagga + chown quagga:quagga /var/run/quagga + chmod 0750 /var/run/quagga + fi + + ebegin "Cleaning up stale zebra routes..." + ip route flush proto zebra + eend $? + + ebegin "Starting ${SVCNAME}" + start-stop-daemon \ + --start --exec /usr/sbin/${SVCNAME} \ + --pidfile /var/run/quagga/${SVCNAME}.pid \ + -- -d -f "${CFGFILE}" ${EXTRA_OPTS} \ + --pid_file /var/run/quagga/${SVCNAME}.pid + + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop \ + --pidfile /var/run/quagga/${SVCNAME}.pid + eend $? +} diff --git a/net-misc/quagga/quagga-0.99.21-r1.ebuild b/net-misc/quagga/quagga-0.99.21-r1.ebuild new file mode 100644 index 0000000..2d4e00b --- /dev/null +++ b/net-misc/quagga/quagga-0.99.21-r1.ebuild @@ -0,0 +1,127 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/quagga/quagga-0.99.21.ebuild,v 1.7 2012/12/08 12:23:45 ago Exp $ + +EAPI="4" + +CLASSLESS_BGP_PATCH=ht-20040304-classless-bgp.patch +#BACKPORTS=2 + +AUTOTOOLS_AUTORECONF=1 +inherit eutils autotools-utils multilib flag-o-matic pam user + +DESCRIPTION="A free routing daemon replacing Zebra supporting RIP, OSPF and BGP" +HOMEPAGE="http://quagga.net/" +SRC_URI="mirror://nongnu/${PN}/${P}.tar.xz + ${BACKPORTS:+ + http://dev.gentoo.org/~flameeyes/${PN}/${P}-backports-${BACKPORTS}.tar.xz} + bgpclassless? ( http://hasso.linux.ee/stuff/patches/quagga/${CLASSLESS_BGP_PATCH} )" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha amd64 ~arm hppa ~ppc ~s390 ~sparc x86" +IUSE="bgpclassless caps doc elibc_glibc ipv6 multipath ospfapi pam +readline snmp tcp-zebra" + +COMMON_DEPEND=" + caps? ( sys-libs/libcap ) + snmp? ( net-analyzer/net-snmp ) + readline? ( + sys-libs/readline + pam? ( sys-libs/pam ) + ) + !elibc_glibc? ( dev-libs/libpcre )" +DEPEND="${COMMON_DEPEND} + app-arch/xz-utils + >=sys-devel/libtool-2.2.4" +RDEPEND="${COMMON_DEPEND} + sys-apps/openrc + sys-apps/iproute2" + +pkg_setup() { + enewgroup quagga + enewuser quagga -1 -1 /var/empty quagga +} + +src_prepare() { + [[ -n ${BACKPORTS} ]] && \ + EPATCH_FORCE=yes EPATCH_SUFFIX="patch" EPATCH_SOURCE="${S}/patches" \ + epatch + + # bug #446289 + epatch "${FILESDIR}/${P}-fix-no-ipv6.patch" + + # bug #446346 + epatch "${FILESDIR}/${PN}-link-libcap.patch" + + # bug #437292 + epatch "${FILESDIR}/437292-ipforward.patch" + + # Classless prefixes for BGP + # http://hasso.linux.ee/doku.php/english:network:quagga + use bgpclassless && epatch "${DISTDIR}/${CLASSLESS_BGP_PATCH}" + + autotools-utils_src_prepare +} + +src_configure() { + append-flags -fno-strict-aliasing + local myeconfargs=( + --enable-user=quagga + --enable-group=quagga + --enable-vty-group=quagga + --with-cflags="${CFLAGS}" + --sysconfdir=/etc/quagga + --enable-exampledir=/usr/share/doc/${PF}/samples + --localstatedir=/var/run/quagga + --disable-static + --disable-pie + --disable-babeld # does not build properly with USE="-ipv6", bug #446289 + $(use_enable caps capabilities) + $(use_enable snmp) + $(use_enable !elibc_glibc pcreposix) + $(use_enable tcp-zebra) + $(use_enable doc) + $(usex multipath $(use_enable multipath) '' '=0' '') + $(usex ospfapi '--enable-opaque-lsa --enable-ospf-te --enable-ospfclient' '' '' '') + $(use_enable readline vtysh) + $(use_with pam libpam) + $(use_enable ipv6) + $(use_enable ipv6 ripngd) + $(use_enable ipv6 ospf6d) + $(use_enable ipv6 rtadv) + ) + autotools-utils_src_configure +} + +src_install() { + autotools-utils_src_install + + keepdir /etc/quagga + fowners root:quagga /etc/quagga + fperms 0770 /etc/quagga + + # install zebra as a file, symlink the rest + newinitd "${FILESDIR}"/quagga-services.init.3 zebra + + for service in ripd ospfd bgpd $(use ipv6 && echo ripngd ospf6d); do + dosym zebra /etc/init.d/${service} + done + + use readline && newpamd "${FILESDIR}/quagga.pam" quagga + + insinto /etc/logrotate.d + newins redhat/quagga.logrotate quagga +} + +pkg_postinst() { + elog "Sample configuration files can be found in /usr/share/doc/${PF}/samples" + elog "You have to create config files in /etc/quagga before" + elog "starting one of the daemons." + elog "" + elog "You can pass additional options to the daemon by setting the EXTRA_OPTS" + elog "variable in their respective file in /etc/conf.d" + elog "" + elog "Starting from version 0.99.18, quagga no longer supports the realms patch." + elog "The patch was abandoned upstream and once again didn't apply; it needs a" + elog "dedicated maintainer, if it is still necessary." +}