From a5d362da5127036f0608e79a36b1411fcae5b9ac Mon Sep 17 00:00:00 2001 From: Marin Glibic Date: Wed, 29 Dec 2010 19:19:03 -0200 Subject: network/quagga: Added (IP routing daemons) Signed-off-by: Niels Horn --- network/quagga/Makefile.am.diff.gz | Bin 0 -> 262 bytes network/quagga/README | 6 ++ network/quagga/doinst.sh | 34 ++++++++ network/quagga/ospf6_area.c.diff.gz | Bin 0 -> 484 bytes network/quagga/quagga.SlackBuild | 166 ++++++++++++++++++++++++++++++++++++ network/quagga/quagga.info | 10 +++ network/quagga/quagga.logrotate | 17 ++++ network/quagga/quagga.pam | 3 + network/quagga/rc.quagga | 43 ++++++++++ network/quagga/rc.watchquagga | 40 +++++++++ network/quagga/slack-desc | 12 +++ network/quagga/vtysh_user.c.diff.gz | Bin 0 -> 264 bytes 12 files changed, 331 insertions(+) create mode 100644 network/quagga/Makefile.am.diff.gz create mode 100644 network/quagga/README create mode 100644 network/quagga/doinst.sh create mode 100644 network/quagga/ospf6_area.c.diff.gz create mode 100644 network/quagga/quagga.SlackBuild create mode 100644 network/quagga/quagga.info create mode 100644 network/quagga/quagga.logrotate create mode 100644 network/quagga/quagga.pam create mode 100644 network/quagga/rc.quagga create mode 100644 network/quagga/rc.watchquagga create mode 100644 network/quagga/slack-desc create mode 100644 network/quagga/vtysh_user.c.diff.gz (limited to 'network') diff --git a/network/quagga/Makefile.am.diff.gz b/network/quagga/Makefile.am.diff.gz new file mode 100644 index 0000000000..97349a1a6c Binary files /dev/null and b/network/quagga/Makefile.am.diff.gz differ diff --git a/network/quagga/README b/network/quagga/README new file mode 100644 index 0000000000..1352f95b68 --- /dev/null +++ b/network/quagga/README @@ -0,0 +1,6 @@ +Quagga is a routing software suite, providing implementations of OSPFv2, +OSPFv3, RIP v1 and v2, RIPng and BGP-4 for Unix platforms, particularly +FreeBSD, Linux, Solaris and NetBSD. Quagga is a fork of GNU Zebra which +was developed by Kunihiro Ishiguro. The Quagga tree aims to build a more +involved community around Quagga than the current centralised model of +GNU Zebra. \ No newline at end of file diff --git a/network/quagga/doinst.sh b/network/quagga/doinst.sh new file mode 100644 index 0000000000..f0f1596656 --- /dev/null +++ b/network/quagga/doinst.sh @@ -0,0 +1,34 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.quagga.new +preserve_perms etc/rc.d/rc.watchquagga.new + +config etc/logrotate.d/quagga.new + +# Install the info files for this package +if [ -x usr/bin/install-info ]; then + usr/bin/install-info --info-dir=/usr/info /usr/info/quagga.info.gz 2>/dev/null +fi + diff --git a/network/quagga/ospf6_area.c.diff.gz b/network/quagga/ospf6_area.c.diff.gz new file mode 100644 index 0000000000..7b1448bd98 Binary files /dev/null and b/network/quagga/ospf6_area.c.diff.gz differ diff --git a/network/quagga/quagga.SlackBuild b/network/quagga/quagga.SlackBuild new file mode 100644 index 0000000000..fdd853edd3 --- /dev/null +++ b/network/quagga/quagga.SlackBuild @@ -0,0 +1,166 @@ +#!/bin/sh + +# Slackware build script for Quagga routing suite +# Written by zhilla2_at_gm@il.kkom (spamprotected, figure domain out) +# This script is in the public domain + +# Don't forget to set USE_PAM if you use it. + +PRGNAM=quagga +VERSION=${VERSION:-0.99.17} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) export ARCH=i486 ;; + arm*) export ARCH=arm ;; + *) export ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i486" ]; then + SLKCFLAGS="-O2 -march=i486 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "s390" ]; then + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +# Bail if user or group isn't valid on your system +if ! grep ^quagga: /etc/passwd 2>&1 > /dev/null; then + +cat << EOF + + You must have a quagga user and group to run this script + + # groupadd -g 245 quagga + # useradd -g quagga -u 245 -s /bin/false -c "Quagga routing suite" -d /var/run/quagga/ quagga + +EOF + + exit +elif ! grep ^quaggavt: /etc/group 2>&1 > /dev/null; then + +cat << EOF + + You must have a quaggavt group to run this script + + # groupadd -g 246 quaggavt + +EOF + + exit +fi + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP + +rm -rf $PRGNAM-$VERSION +tar zxvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find . \ + \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ + -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ + -exec chmod 644 {} \; + +# use libpam for PAM support in vtysh +USE_PAM=${USE_PAM:-NO} + +if [ "$USE_PAM" == 'YES' ]; then + DO_PAM="--with-libpam" + zcat $CWD/vtysh_user.c.diff.gz | patch -p1 + mkdir -p $PKG/etc/pam.d + cat $CWD/quagga.pam > $PKG/etc/pam.d/quagga +else + DO_PAM="--without-libpam" +fi + +zcat $CWD/Makefile.am.diff.gz | patch -p1 +zcat $CWD/ospf6_area.c.diff.gz | patch -p1 + +#./bootstrap.sh + +CFLAGS="$SLKCFLAGS" \ +CXXFLAGS="$SLKCFLAGS" \ +./configure \ + --prefix=/usr \ + --sysconfdir=/etc/quagga \ + --localstatedir=/var/run/quagga \ + --libdir=/usr/lib${LIBDIRSUFFIX} \ + --mandir=/usr/man \ + --infodir=/usr/info \ + --enable-vtysh \ + --enable-opaque-lsa \ + --enable-ospf-te \ + --enable-dependency-tracking \ + --enable-user=quagga \ + --enable-group=quagga \ + --enable-vty-group=quaggavt \ + --enable-rtadv \ + ${DO_PAM} +# Some options useful for troubleshooting compiling +# problems +# --disable-capabilities \ +# --disable-ipv6 \ + +sed -i -e "s#/lib#/lib${LIBDIRSUFFIX}#" Makefile + +make +make install DESTDIR=$PKG + +find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null +chown -R root.root $PKG/usr/sbin + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +rm -f $PKG/usr/info/dir +gzip -9 $PKG/usr/info/* + +mv $TMP/$PRGNAM-$VERSION/*/*.sample $PKG/etc/quagga +chown root.quagga $PKG/etc/quagga ; chmod 750 $PKG/etc/quagga +chown -R root.quagga $PKG/etc/quagga/* ; chmod 640 $PKG/etc/quagga/*.sample + +mkdir -p $PKG/var/run/quagga $PKG/var/log/quagga +chown quagga.quagga $PKG/var/run/quagga ; chmod 770 $PKG/var/run/quagga +chown quagga.quagga $PKG/var/log/quagga ; chmod 770 $PKG/var/log/quagga + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + AUTHORS ChangeLog COPYING* README INSTALL REPORTING-BUGS TODO SERVICES \ + $PKG/usr/doc/$PRGNAM-$VERSION + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +mkdir -p $PKG/etc/rc.d +cat $CWD/rc.quagga > $PKG/etc/rc.d/rc.quagga.new +cat $CWD/rc.watchquagga > $PKG/etc/rc.d/rc.watchquagga.new + +mkdir -p $PKG/etc/logrotate.d +cat $CWD/quagga.logrotate > $PKG/etc/logrotate.d/quagga.new + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/network/quagga/quagga.info b/network/quagga/quagga.info new file mode 100644 index 0000000000..37f7943ab5 --- /dev/null +++ b/network/quagga/quagga.info @@ -0,0 +1,10 @@ +PRGNAM="quagga" +VERSION="0.99.17" +HOMEPAGE="http://www.quagga.net/" +DOWNLOAD="http://www.quagga.net/download/quagga-0.99.17.tar.gz" +MD5SUM="37b9022adca04b03863d2d79787e643f" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +MAINTAINER="Marin Glibic" +EMAIL="zhilla2@gmail.com" +APPROVED="Niels Horn" diff --git a/network/quagga/quagga.logrotate b/network/quagga/quagga.logrotate new file mode 100644 index 0000000000..9a213de3ca --- /dev/null +++ b/network/quagga/quagga.logrotate @@ -0,0 +1,17 @@ +/var/log/quagga/*.log { + daily + sharedscripts + missingok + compress + rotate 14 + create 640 quagga quagga + + postrotate + for i in zebra bgpd ripd ospfd ripngd ospf6d isisd; do + if [ -e /var/run/quagga/$i.pid ] ; then + kill -USR1 $(cat /var/run/quagga/$i.pid) + fi + + done + endscript +} diff --git a/network/quagga/quagga.pam b/network/quagga/quagga.pam new file mode 100644 index 0000000000..093e172946 --- /dev/null +++ b/network/quagga/quagga.pam @@ -0,0 +1,3 @@ +# Any user may call vtysh but only those belonging to the group quaggavty can +# actually connect to the socket and use the program. +auth sufficient pam_permit.so diff --git a/network/quagga/rc.quagga b/network/quagga/rc.quagga new file mode 100644 index 0000000000..3033da277c --- /dev/null +++ b/network/quagga/rc.quagga @@ -0,0 +1,43 @@ +#!/bin/sh + +# rc.quagga will try to start any service that has configured a config file in /etc/quagga + +start() { + + for SERVICE in zebra bgpd ripd ospfd ripngd ospf6d isisd; do + if [ -r /etc/quagga/$SERVICE.conf ] ; then + echo -n "Starting ${SERVICE}: " && /usr/sbin/${SERVICE} -d && echo "done" + fi + done +} + +stop() { + + for SERVICE in zebra bgpd ripd ospfd ripngd ospf6d isisd; do + echo -n "Stopping ${SERVICE}: " + killall $SERVICE 2>/dev/null && echo -n "done" || echo -n "not started" + echo + done +} + +restart() { + + stop && sleep 2s && start + if [ -x /etc/rc.d/rc.watchquagga ] ; then + sh /etc/rc.d/rc.watchquagga restart + fi +} + +case "$1" in + 'start') + start + ;; + 'stop') + stop + ;; + 'restart') + restart + ;; + *) + echo "usage $0 start|stop|restart" +esac diff --git a/network/quagga/rc.watchquagga b/network/quagga/rc.watchquagga new file mode 100644 index 0000000000..0f9736e2de --- /dev/null +++ b/network/quagga/rc.watchquagga @@ -0,0 +1,40 @@ +#!/bin/sh + +start() { + if [ -x /usr/sbin/watchquagga ]; then + + for i in zebra bgpd ripd ospfd ripngd ospf6d isisd; do + if [ -e /var/run/quagga/$i.pid ] ; then + WATCHSERVICES="${WATCHSERVICES} ${i}" + fi + done + + echo -n "Starting watchquagga: " + /usr/sbin/watchquagga -dz -R '/etc/rc.d/rc.quagga restart' $WATCHSERVICES || exit 1 + echo "done" + fi +} + +stop() { + echo -n "Stopping watchquagga: " + killall watchquagga 2>/dev/null && echo -n "done" || echo -n "not started" + echo +} + +restart() { + stop && sleep 2s && start +} + +case "$1" in + 'start') + start + ;; + 'stop') + stop + ;; + 'restart') + restart + ;; + *) + echo "usage $0 start|stop|restart" +esac diff --git a/network/quagga/slack-desc b/network/quagga/slack-desc new file mode 100644 index 0000000000..a3e1295aaf --- /dev/null +++ b/network/quagga/slack-desc @@ -0,0 +1,12 @@ + |-----handy-ruler------------------------------------------------------| +quagga: quagga (IP routing daemons) +quagga: +quagga: Quagga is a routing software suite, providing implementations of +quagga: OSPFv2, OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 for Unix platforms. +quagga: Quagga is a fork of GNU Zebra. +quagga: +quagga: +quagga: +quagga: +quagga: +quagga: diff --git a/network/quagga/vtysh_user.c.diff.gz b/network/quagga/vtysh_user.c.diff.gz new file mode 100644 index 0000000000..4bdc3d8455 Binary files /dev/null and b/network/quagga/vtysh_user.c.diff.gz differ -- cgit v1.2.3