diff --git a/net/quagga/Makefile b/net/quagga/Makefile index 5461edc9bf33..599986eb53a2 100644 --- a/net/quagga/Makefile +++ b/net/quagga/Makefile @@ -1,243 +1,243 @@ # New ports collection makefile for: quagga # Date created: 3 September 2003 # Whom: Bruce M Simpson # # $FreeBSD$ # PORTNAME= quagga PORTVERSION= 0.99.4 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net ipv6 MASTER_SITES= http://quagga.net/download/ PATCH_SITES= http://quagga.net/ MAINTAINER= boris@tagnet.ru COMMENT= Free RIPv1, RIPv2, OSPFv2, BGP4, IS-IS route software CONFLICTS= openbgpd-* zebra-0* GNU_CONFIGURE= yes CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL} USE_GMAKE= yes INSTALLS_SHLIB= yes USE_PERL5_BUILD= yes LIBTOOLFILES= configure MAN1= vtysh.1 MAN8= bgpd.8 ospf6d.8 ospfd.8 ripd.8 ripngd.8 zebra.8 OPTIONS= ISISD "Enable experimental ISIS daemon" off \ PAM "PAM authentication for vtysh" off \ OSPF_NSSA "NSSA support (RFC1587)" off \ OSPF_OPAQUE_LSA "OSPF Opaque-LSA support (RFC2370)" off \ RTADV "IPv6 Router Advertisements" off \ SNMP "SNMP support" off \ TCPSOCKETS "Use TCP/IP sockets for protocol daemons" off \ TCPMD5 "Use experimental MD5 patch for BGP" off .include CONFIGURE_ARGS+=--includedir=${PREFIX}/include --enable-exampledir=${PREFIX}/share/examples/quagga CONFIGURE_ENV+= CFLAGS="${CFLAGS} -I${LOCALBASE}/include" \ LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib" \ LIBTOOL=${LIBTOOL} LIBTOOLIZE=${LIBTOOLIZE} \ LIBTOOL_VERSION=${LIBTOOL_VERSION} .if !defined(ENABLE_USER) ENABLE_USER=quagga .endif .if !defined(ENABLE_GROUP) ENABLE_GROUP=quagga .endif CONFIGURE_ARGS+=--enable-user=${ENABLE_USER} CONFIGURE_ARGS+=--enable-group=${ENABLE_GROUP} .if !defined(SYSCONF_DIR) SYSCONF_DIR=${PREFIX}/etc/quagga .endif .if !defined(LOCALSTATE_DIR) LOCALSTATE_DIR=/var/run/quagga .endif CONFIGURE_ARGS+=--sysconfdir=${SYSCONF_DIR} CONFIGURE_ARGS+=--localstatedir=${LOCALSTATE_DIR} .if defined(ENABLE_VTY_GROUP) CONFIGURE_ARGS+=--enable-vty-group=${ENABLE_VTY_GROUP} .endif CONFIGURE_ARGS+=--enable-vtysh SCRIPTS_ENV= PREFIX=${PREFIX} PKG_PREFIX=${PREFIX} \ SYSCONF_DIR=${SYSCONF_DIR} SYSSTATE_DIR=${SYSSTATE_DIR} \ ENABLE_USER=${ENABLE_USER} ENABLE_GROUP=${ENABLE_GROUP} .if defined(WITH_ISISD) CONFIGURE_ARGS+=--enable-isisd PLIST_SUB+= ISISD="" .else PLIST_SUB+= ISISD="@comment " .endif MAN8+= isisd.8 .if defined(WITH_PAM) CONFIGURE_ARGS+=--with-libpam .endif .if defined(WITH_OSPFNSSA) CONFIGURE_ARGS+=--enable-nssa .endif .if defined(WITH_OSPF_OPAQUE_LSA) CONFIGURE_ARGS+=--enable-opaque-lsa PLIST_SUB+= OSPFAPI="" .else PLIST_SUB+= OSPFAPI="@comment " .endif .if defined(WITH_RTADV) CONFIGURE_ARGS+=--enable-rtadv .endif .if defined(WITH_SNMP) CONFIGURE_ARGS+=--enable-snmp LIB_DEPENDS+=netsnmp.9:${PORTSDIR}/net-mgmt/net-snmp .endif .if defined(WITH_TCPMD5) .if ${OSVERSION} < 491000 BROKEN= This version of FreeBSD does not have TCP MD5 signature support .endif EXTRA_PATCHES+=${PATCHDIR}/extra-tcpmd5-patch-bgpd-bgp_network.c ${PATCHDIR}/extra-tcpmd5-patch-bgpd-bgp_vty.c ${PATCHDIR}/extra-tcpmd5-patch-bgpd-bgpd.c ${PATCHDIR}/extra-tcpmd5-patch-bgpd-bgpd.h ${PATCHDIR}/extra-tcpmd5-patch-lib-sockopt.c ${PATCHDIR}/extra-tcpmd5-patch-lib-sockopt.h CFLAGS+= -DQUAGGA_TCP_MD5SIG .endif USE_RC_SUBR= watchquagga.sh .if ${OSVERSION} < 500000 || ${OSVERSION} >= 600101 USE_RC_SUBR+= quagga.sh .else USE_RCORDER= quagga.sh .endif SUB_LIST+= LOCALSTATE_DIR=${LOCALSTATE_DIR} \ SYSCONF_DIR=${SYSCONF_DIR} PLIST_SUB+= LOCALSTATE_DIR=${LOCALSTATE_DIR} \ SYSCONF_DIR=${SYSCONF_DIR} \ ENABLE_USER=${ENABLE_USER} \ ENABLE_GROUP=${ENABLE_GROUP} pre-everything:: @${ECHO} "=============================================================" @${ECHO} @${ECHO} "You can build ${PORTNAME} with the following options:" @${ECHO} @${ECHO} "ENABLE_USER Specify user to run Quagga suite as" @${ECHO} "ENABLE_GROUP Specify group to run Quagga suite as" @${ECHO} "ENABLE_VTY_GROUP Specify group for vty socket ownership" @${ECHO} "SYSCONF_DIR Specify directory for Quagga configuration files" @${ECHO} "LOCALSTATE_DIR Specify directory for Quagga runtime files" @${ECHO} @${ECHO} "The following options may be configured interactively:" @${ECHO} " WITH_PAM PAM authentication for vtysh" @${ECHO} " WITH_OSPF_NSSA NSSA support (RFC1587)" @${ECHO} " WITH_OSPF_OPAQUE_LSA OSPF Opaque-LSA with OSPFAPI support (RFC2370)" @${ECHO} " WITH_RTADV IPv6 Router Advertisements" @${ECHO} " WITH_SNMP SNMP support" @${ECHO} " WITH_TCPSOCKETS Use TCP/IP sockets for protocol daemons" @${ECHO} " WITH_TCPMD5 Use experimental MD5 patch for BGP" post-install: @${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL @${ECHO} "===> installing ${PORTNAME} startup file..." @${ECHO} "Add the following lines to /etc/rc.conf to enable quagga:" @${ECHO} "" @${ECHO} "defaultrouter=\"NO\"" @${ECHO} "quagga_enable=\"YES\"" @${ECHO} "" @${ECHO} "Also, you may wish to set the following options:" @${ECHO} "quagga_daemons=\"zebra bgpd etc...\"" @${ECHO} "quagga_flags=\"....\"" @${ECHO} "quagga_extralibs_path=\"/path1 /path2\"" @${ECHO} "router_enable=\"NO\"" @${ECHO} "watchquagga_enable=\"YES\"" @${ECHO} "watchquagga_flags=\"...\"" @${ECHO} "" @${ECHO} "Note!!! Since 0.96.4_5 port uses new id for quagga user and group." @${ECHO} " So, You need to manually chown files:" @${ECHO} " in ${SYSCONF_DIR}" @${ECHO} " and ${LOCALSTATE_DIR}" @${ECHO} " if You had never do this before. Or run" @${ECHO} " make changeuser" @${ECHO} "" .if defined(WITH_TCPMD5) && !defined(WITHOUT_TCPMD5) @${ECHO} "Note!!! To use MD5 passwords on BGP sessions, your kernel must" @${ECHO} "be built with the following options:" @${ECHO} " options TCP_SIGNATURE" @${ECHO} " options FAST_IPSEC" @${ECHO} " device crypto" @${ECHO} " device cryptodev" @${ECHO} "" .endif .if ${OSVERSION} < 500000 @${ECHO} "Warning: You are running 4.x version of FreeBSD. To properly start" @${ECHO} " quagga on your system please rename" @${ECHO} " ${PREFIX}/etc/rc.d/quagga.sh to something like" @${ECHO} " ${PREFIX}/etc/rc.d/010.quagga.sh or even You" @${ECHO} " should write your own startup script and use it with" @${ECHO} " router_enable=\"YES\"" @${ECHO} " router=\"your_startup_script_here\" in your rc.conf" @${ECHO} "" .endif .if !defined(BATCH) post-clean: @${RM} -f ${WRKDIRPREFIX}${.CURDIR}/Makefile.inc .endif changeuser: # Recover from the problem that earlier versions of this port created the # quagga pseudo-user with an id of 90 which is used by FireBird database # engine. The port now uses id 101:101. # NOTE: # This target assumes that ENABLE_GROUP is the primary group of ENABLE_USER. If you # have a different setup, do not run this target! @if [ `${ID} -u` -ne 0 ]; \ then ${ECHO_CMD} "Sorry, you must be root to use this target."; exit 1; fi; \ current_uid=`id -u ${ENABLE_USER}`; \ current_gid=`pw groupshow ${ENABLE_GROUP}|cut -f 3 -d :`; \ ${ECHO_CMD} "I will remove this user:"; \ ${ID} -P $${current_uid}; \ ${ECHO_CMD} "and this group:"; \ pw groupshow ${ENABLE_GROUP}; \ ${ECHO_CMD} "I will then re-create them with a user and group id of 101."; \ ${ECHO_CMD} "Then all files and directories under ${PREFIX} and /var that"; \ ${ECHO_CMD} "are owned by uid $${current_uid} will be chown(1)'ed."; \ ${ECHO_CMD} "After that, all files and directories that were accessible"; \ ${ECHO_CMD} "by group $${current_gid} will chgrp(1)'ed respectively."; \ ${ECHO_CMD} "Note that this assumes group '${ENABLE_GROUP}' to be the primary"; \ ${ECHO_CMD} "group of user '${ENABLE_USER}'. If you have a different setup"; \ ${ECHO_CMD} "please abort this target now. Also don't forget to write your"; \ ${ECHO_CMD} "Quagga configs right now!"; \ read -p "Press RETURN to continue or CTRL-C to abort:" dummy ; \ ${ECHO_CMD} "OK, here we go:"; \ ${ECHO_CMD} "deleting user $${current_uid} and his primary group..."; \ pw userdel -u $${current_uid}; \ ${ECHO_CMD} "adding user ${ENABLE_USER} with id 101..."; \ pw groupadd -n ${ENABLE_USER} -g 101; \ pw useradd -n ${ENABLE_GROUP} -u 101 -c "quagga route daemon pseudo-user" \ -d ${SYSCONF_DIR} -s /sbin/nologin -h - ; \ ${ECHO_CMD} "chown(1)'ing everything under ${PREFIX} from $${current_uid} to 101..."; \ ${FIND} -H ${PREFIX} -user $${current_uid} -exec ${CHOWN} 101 {} \; ; \ ${ECHO_CMD} "chgrp(1)'ing everything under ${PREFIX} from $${current_gid} to 100..."; \ ${FIND} -H ${PREFIX} -group $${current_gid} -exec ${CHOWN} :101 {} \; ; \ ${ECHO_CMD} "chown(1)'ing everything under /var from $${current_uid} to 101..."; \ ${FIND} -H /var -user $${current_uid} -exec ${CHOWN} 101 {} \; ; \ ${ECHO_CMD} "chgrp(1)'ing everything under /var from $${current_gid} to 101..."; \ ${FIND} -H /var -group $${current_gid} -exec ${CHOWN} :101 {} \; ; \ ${ECHO_CMD} "Finished. You must stop and then start Quagga now." .include diff --git a/net/quagga/files/quagga.sh.in b/net/quagga/files/quagga.sh.in index 868b00db1d69..9a28950558b3 100644 --- a/net/quagga/files/quagga.sh.in +++ b/net/quagga/files/quagga.sh.in @@ -1,76 +1,80 @@ #!/bin/sh # # PROVIDE: quagga -# REQUIRE: netif routing mountcritlocal -# BEFORE: NETWORKING -# KEYWORD: shutdown +# REQUIRE: NETWORKING # # Add the following line to /etc/rc.conf to enable quagga: #quagga_enable="YES" # # You may also wish to use the following variables to fine-tune startup: #quagga_flags="-d" #quagga_daemons="zebra ripd ripngd ospfd ospf6d bgpd isisd" +# Per daemon tuning may be done with daemon_name_flags +#zebra_flags="-dP 0" +#bgpd_flags="-dnrP 0" and so on +# # # If the quagga daemons require additional shared libraries to start, # use the following variable to run ldconfig(8) in advance: #quagga_extralibs_path="/usr/local/lib ..." # . %%RC_SUBR%% name="quagga" rcvar=`set_rcvar` stop_postcmd=stop_postcmd stop_postcmd() { rm -f $pidfile } # set defaults -quagga_enable=${quagga_enable:-"NO"} -quagga_flags=${quagga_flags:-"-d"} -quagga_daemons=${quagga_daemons:-"zebra ripd ripngd ospfd ospf6d bgpd isisd"} -quagga_extralibs_path=${quagga_extralibs_path:-""} load_rc_config $name +: ${quagga_enable="NO"} +: ${quagga_flags="-d"} +: ${quagga_daemons="zebra ripd ripngd ospfd ospf6d bgpd isisd"} +: ${quagga_extralibs_path=""} + quagga_cmd=$1 case "$1" in force*) quagga_cmd=${quagga_cmd#force} ;; fast*) quagga_cmd=${quagga_cmd#fast} ;; esac case "${quagga_cmd}" in start) if [ ! -z ${quagga_extralibs_path} ]; then /sbin/ldconfig -m ${quagga_extralibs_path} fi ;; stop) quagga_daemons=$(reverse_list ${quagga_daemons}) ;; esac for daemon in ${quagga_daemons}; do command=%%PREFIX%%/sbin/${daemon} required_files=%%SYSCONF_DIR%%/${daemon}.conf pidfile=%%LOCALSTATE_DIR%%/${daemon}.pid if [ ${quagga_cmd} = "start" -a ! -f ${required_files} ]; then continue fi if [ ${quagga_cmd} = "stop" -a -z $(check_process ${command}) ]; then continue fi + eval flags=\$\{${daemon}_flags:-\"${quagga_flags}\"\} run_rc_command "$1" done diff --git a/net/quagga/files/watchquagga.sh.in b/net/quagga/files/watchquagga.sh.in index d9af072e47f6..be31f48c1f70 100644 --- a/net/quagga/files/watchquagga.sh.in +++ b/net/quagga/files/watchquagga.sh.in @@ -1,39 +1,38 @@ #!/bin/sh # # PROVIDE: watchquagga -# REQUIRE: netif routing mountcritlocal quagga -# BEFORE: NETWORKING -# KEYWORD: shutdown +# REQUIRE: NETWORKING quagga # # Add the following line to /etc/rc.conf to enable quagga: #watchquagga_enable="YES" # # You may also wish to use the following variables to fine-tune startup: #watchquagga_flags="" # # . %%RC_SUBR%% name="watchquagga" rcvar=`set_rcvar` stop_postcmd=stop_postcmd stop_postcmd() { rm -f $pidfile } # set defaults -watchquagga_enable=${watchquagga_enable:-"NO"} -watchquagga_flags=${watchquagga_flags:-""} load_rc_config $name +: ${watchquagga_enable="NO"} +: ${watchquagga_flags=""} + command=%%PREFIX%%/sbin/watchquagga pidfile=%%LOCALSTATE_DIR%%/watchquagga.pid run_rc_command "$1"