quagga: add 0.99.2 and 0.99.3, closes #476
authorKoen Kooi <koen@openembedded.org>
Fri, 28 Apr 2006 10:11:30 +0000 (10:11 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Fri, 28 Apr 2006 10:11:30 +0000 (10:11 +0000)
12 files changed:
packages/quagga/.mtn2git_empty [new file with mode: 0644]
packages/quagga/files/.mtn2git_empty [new file with mode: 0644]
packages/quagga/files/fix-for-lib-inpath.patch [new file with mode: 0644]
packages/quagga/files/quagga.default [new file with mode: 0644]
packages/quagga/files/quagga.init [new file with mode: 0644]
packages/quagga/files/watchquagga.default [new file with mode: 0644]
packages/quagga/files/watchquagga.init [new file with mode: 0644]
packages/quagga/quagga-0.99.2/.mtn2git_empty [new file with mode: 0644]
packages/quagga/quagga-0.99.2/ospfd-no-opaque-lsa-fix.patch [new file with mode: 0644]
packages/quagga/quagga.inc [new file with mode: 0644]
packages/quagga/quagga_0.99.2.bb [new file with mode: 0644]
packages/quagga/quagga_0.99.3.bb [new file with mode: 0644]

diff --git a/packages/quagga/.mtn2git_empty b/packages/quagga/.mtn2git_empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/packages/quagga/files/.mtn2git_empty b/packages/quagga/files/.mtn2git_empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/packages/quagga/files/fix-for-lib-inpath.patch b/packages/quagga/files/fix-for-lib-inpath.patch
new file mode 100644 (file)
index 0000000..50f0ad5
--- /dev/null
@@ -0,0 +1,19 @@
+At first this worked, then I tried a clean build in a directory that
+contained lib in it (oe/build/titan-glibc) and vtysh no longer
+worked. It's test for the lib directory was excepting anything
+containing lib.
+
+With this patch you still cannot have lib in the path anywhere, but
+at least things containing lib will now work.
+
+--- quagga-0.99.2/vtysh/extract.pl.in  2005/11/16 04:12:04     1.1
++++ quagga-0.99.2/vtysh/extract.pl.in  2005/11/16 04:12:16
+@@ -89,7 +89,7 @@
+       $cmd =~ s/\s+$//g;
+         # $protocol is VTYSH_PROTO format for redirection of user input
+-      if ($file =~ /lib/) {
++      if ($file =~ /\/lib\//) {
+            if ($file =~ /keychain.c/) {
+               $protocol = "VTYSH_RIPD";
+            }
diff --git a/packages/quagga/files/quagga.default b/packages/quagga/files/quagga.default
new file mode 100644 (file)
index 0000000..4c4bc23
--- /dev/null
@@ -0,0 +1,12 @@
+# If this option is set the /etc/init.d/quagga script automatically loads
+# the config via "vtysh -b" when the servers are started.
+vtysh_enable=yes
+
+# Bind all daemons to loopback only by default
+zebra_options=" --daemon -A 127.0.0.1"
+bgpd_options="  --daemon -A 127.0.0.1"
+ospfd_options=" --daemon -A 127.0.0.1"
+ospf6d_options="--daemon -A ::1"
+ripd_options="  --daemon -A 127.0.0.1"
+ripngd_options="--daemon -A ::1"
+isisd_options=" --daemon -A 127.0.0.1"
diff --git a/packages/quagga/files/quagga.init b/packages/quagga/files/quagga.init
new file mode 100644 (file)
index 0000000..cfc02d8
--- /dev/null
@@ -0,0 +1,186 @@
+#!/bin/sh
+#
+# /etc/init.d/quagga -- start/stop the Quagga routing daemons
+#
+# Based on debian version by Endre Hirling <endre@mail.elte.hu> and 
+# Christian Hammers <ch@debian.org>.
+#
+
+# NOTE: sbin must be before bin so we get the iproute2 ip and not the
+# busybox ip command. The busybox one flushes all routes instead of just
+# the dynamic routes
+PATH=/sbin:/usr/sbin:/bin:/usr/bin:/sbin
+D_PATH=/usr/lib/quagga
+C_PATH=/etc/quagga
+DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd"    # keep zebra first!
+
+# Print the name of the pidfile.
+pidfile()
+{
+       echo "/var/run/quagga/$1.pid"
+}
+
+# Check if daemon is started by using the pidfile.
+started()
+{
+       [ -e `pidfile $1` ] && kill -0 `cat \`pidfile $1\`` 2> /dev/null && return 0
+       return 1
+}
+
+# Loads the config via vtysh -b if configured to do so.
+vtysh_b ()
+{
+       # Rember, that all variables have been incremented by 1 in convert_daemon_prios()
+       if [ "$vtysh_enable" = 2 -a -f $C_PATH/Quagga.conf ]; then
+               /usr/bin/vtysh -b
+       fi
+}
+
+# Check if the daemon is activated and if its executable and config files 
+# are in place.
+# params:      daemon name
+# returns:     0=ok, 1=error
+check_daemon()
+{
+       # If the integrated config file is used the others are not checked.
+       if [ -r "$C_PATH/Quagga.conf" ]; then
+         return 0
+       fi 
+
+       # check for config file           
+       if [ ! -r "$C_PATH/$1.conf" ]; then
+         return 1
+       fi
+       return 0
+}
+
+# Starts the server if it's not alrady running according to the pid file.
+# The Quagga daemons creates the pidfile when starting.
+start()
+{
+       if ! check_daemon $1; then echo -n " (!$1)"; return; fi
+       echo -n " $1"
+       start-stop-daemon \
+               --start \
+               --pidfile=`pidfile $1` \
+               --exec "$D_PATH/$1" \
+               -- \
+               `eval echo "$""$1""_options"`
+               
+}
+
+# Stop the daemon given in the parameter, printing its name to the terminal.
+stop()
+{
+    if ! started "$1" ; then
+       echo -n " (!$1)"
+       return 0
+    else
+       PIDFILE=`pidfile $1`
+       PID=`cat $PIDFILE 2>/dev/null`
+       start-stop-daemon --stop --quiet --exec "$D_PATH/$1"
+       #
+       #       Now we have to wait until $DAEMON has _really_ stopped.
+       #
+       if test -n "$PID" && kill -0 $PID 2>/dev/null; then
+           echo -n " (waiting) ."
+           cnt=0
+           while kill -0 $PID 2>/dev/null; do
+               cnt=`expr $cnt + 1`
+               if [ $cnt -gt 60 ]; then
+                   # Waited 120 secs now, fail.
+                   echo -n "Failed.. "
+                   break
+               fi
+               sleep 2
+               echo -n "."
+               done
+           fi
+       echo -n " $1"
+       rm -f `pidfile $1`
+    fi
+}
+
+stop_all() 
+{
+       local daemon_list
+       daemon_list=${1:-$DAEMONS}
+
+       echo -n "Stopping Quagga daemons:"
+       for daemon_name in $daemon_list; do
+               stop "$daemon_name"
+       done
+       echo "."
+}
+
+start_all()
+{
+       local daemon_list
+       daemon_list=${1:-$DAEMONS}
+
+       echo -n "Starting Quagga daemons:"
+       for daemon_name in $daemon_list; do
+               start "$daemon_name"
+       done
+       echo "."
+}
+
+status_all() 
+{
+       local daemon_list
+       daemon_list=${1:-$DAEMONS}
+       res=1
+
+       echo -n "quagga: "
+       for daemon_name in $daemon_list; do
+           if started "$daemon_name" ; then
+               id=`cat \`pidfile $daemon_name\``
+               echo -n "$daemon_name (pid $id) "
+               res=0
+           fi
+       done
+       if [ $res -eq 0 ]; then
+           echo "is running..."
+       else
+           echo "is stopped..."
+       fi
+       exit $res
+}
+
+#########################################################
+#              Main program                            #
+#########################################################
+
+# Load configuration
+test -f /etc/default/quagga && . /etc/default/quagga
+
+case "$1" in
+    start)
+       cd $C_PATH/
+       start_all $2
+       vtysh_b
+       ;;
+       
+    stop)
+       stop_all $2
+       echo "Removing all routes made by zebra."
+       ip route flush proto zebra
+       ;;
+
+    status)
+       status_all $2
+       ;;
+
+    restart|force-reload)
+       $0 stop $2
+       sleep 1
+       $0 start $2
+       ;;
+
+    *)
+       echo "Usage: /etc/init.d/quagga {start|stop|restart|status|force-reload} [daemon]"
+       exit 1
+       ;;
+esac
+
+exit 0
diff --git a/packages/quagga/files/watchquagga.default b/packages/quagga/files/watchquagga.default
new file mode 100644 (file)
index 0000000..f152032
--- /dev/null
@@ -0,0 +1,7 @@
+# Watchquagga configuration
+#watch_daemons="zebra bgpd ospfd ospf6d ripd ripngd"
+watch_daemons="zebra"
+
+# To enable restarts, uncomment this line (but first be sure to edit
+# the WATCH_DAEMONS line to reflect the daemons you are actually using):
+watch_options="-Az -b_ -r/etc/init.d/quagga_restart_%s -s/etc/init.d/quagga_start_%s -k/etc/init.d/quagga_stop_%s"
diff --git a/packages/quagga/files/watchquagga.init b/packages/quagga/files/watchquagga.init
new file mode 100644 (file)
index 0000000..79be16d
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/sh
+#
+# /etc/init.d/watchquagga -- start/stop the Quagga watchdog
+#
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+# Load configuration
+test -f /etc/default/watchquagga && . /etc/default/watchquagga
+
+# Check that there are daemons to be monitored.
+[ -z "$watch_daemons" ] && exit 0
+
+pidfile="/var/run/quagga/watchquagga.pid"
+
+case "$1" in
+    start)
+       echo -n "Starting quagga watchdog daemon: watchquagga"
+       start-stop-daemon --start \
+               --pidfile $pidfile \
+               --exec /usr/lib/quagga/watchquagga \
+               -- -d $watch_options $watch_daemons
+       echo "."
+       ;;
+       
+    stop)
+       echo -n "Stopping quagga watchdog daemon: watchquagga"
+       start-stop-daemon --stop --quiet \
+               --pidfile $pidfile
+       echo "."
+       ;;
+
+    status)
+       echo -n "watchquagga "
+       res=1
+       [ -e $pidfile ] && kill -0 `cat $pidfile` 2> /dev/null
+       if [ $? -eq 0 ]; then
+           echo "(pid `cat $pidfile`) is running..."
+           res=0
+       else
+           echo "is stopped..."
+       fi
+       exit $res
+       ;;
+
+    restart|force-reload)
+       $0 stop $2
+       sleep 1
+       $0 start $2
+       ;;
+
+    *)
+       echo "Usage: /etc/init.d/watchquagga {start|stop|restart|force-reload}"
+       exit 1
+       ;;
+esac
+
+exit 0
diff --git a/packages/quagga/quagga-0.99.2/.mtn2git_empty b/packages/quagga/quagga-0.99.2/.mtn2git_empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/packages/quagga/quagga-0.99.2/ospfd-no-opaque-lsa-fix.patch b/packages/quagga/quagga-0.99.2/ospfd-no-opaque-lsa-fix.patch
new file mode 100644 (file)
index 0000000..3c99729
--- /dev/null
@@ -0,0 +1,16 @@
+If you try to build without opaque LSA support you'll hit this error. I now
+turn this on in the makefile so this isn't really needed but it's here just
+because I fixed it before changing the configuration.
+
+--- quagga-0.99.2/ospfd/ospfd.c.orig   2005-11-13 13:28:39.000000000 +1100
++++ quagga-0.99.2/ospfd/ospfd.c        2005-11-13 13:28:57.000000000 +1100
+@@ -466,7 +466,9 @@
+   OSPF_TIMER_OFF (ospf->t_lsa_refresher);
+   OSPF_TIMER_OFF (ospf->t_read);
+   OSPF_TIMER_OFF (ospf->t_write);
++#ifdef HAVE_OPAQUE_LSA
+   OSPF_TIMER_OFF (ospf->t_opaque_lsa_self);
++#endif
+   close (ospf->fd);
+   stream_free(ospf->ibuf);
diff --git a/packages/quagga/quagga.inc b/packages/quagga/quagga.inc
new file mode 100644 (file)
index 0000000..f5c6378
--- /dev/null
@@ -0,0 +1,137 @@
+SECTION = "network"
+DESCRIPTION = "Quagga is a routing software suite, providing \
+implementations of OSPFv2, OSPFv3, RIP v1 and v2, RIPv3 and BGPv4 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."
+HOMEPAGE = "http://www.quagga.net/"
+LICENSE = "GPL"
+DEPENDS = "readline ncurses perl-native"
+PR = "r0"
+
+SRC_URI = "http://www.quagga.net/download/quagga-${PV}.tar.gz \
+          file://fix-for-lib-inpath.patch;patch=1 \
+          file://quagga.init \
+          file://quagga.default \
+          file://watchquagga.init \
+          file://watchquagga.default"
+
+# Main init script starts all deamons
+# Seperate init script for watchquagga
+INITSCRIPT_PACKAGES                    = "${PN} ${PN}-watchquagga"
+INITSCRIPT_NAME_${PN}                  = "quagga"
+INITSCRIPT_PARAMS_${PN}                = "defaults 15 85"
+INITSCRIPT_NAME_${PN}-watchquagga      = "watchquagga"
+INITSCRIPT_PARAMS_${PN}-watchquagga    = "defaults 90 10"
+
+inherit autotools update-rc.d
+
+# Turn on options and changes paths.
+# This matches the layout and configuration of the debian quagga package
+EXTRA_OECONF = "--prefix=${prefix} \
+               --libexecdir=${libexecdir}/quagga \
+               --sbindir=${libdir}/quagga \
+               --sysconfdir=${sysconfdir}/quagga \
+               --localstatedir=${localstatedir}/run/quagga \
+               --enable-exampledir=${docdir}/quagga/examples/ \
+               --enable-vtysh \
+               --enable-isisd \
+               --enable-watchquagga \
+               --enable-ospf-te \
+               --enable-opaque-lsa \
+               --enable-ipv6 \
+               --enable-ospfclient=yes \
+               --enable-multipath=64 \
+               --enable-user=quagga \
+               --enable-group=quagga \
+               --enable-vty-group=quaggavty \
+               --enable-configfile-mask=0640 \
+               --enable-logfile-mask=0640 \
+               --enable-rtadv \
+               --enable-tcp-md5"
+
+# Split into a main package and seperate per-protocol packages
+PACKAGES = "${PN} \
+           ${PN}-ospfd ${PN}-ospf6d ${PN}-bpgd ${PN}-ripd ${PN}-ripngd ${PN}-isisd \
+           ${PN}-ospfclient ${PN}-watchquagga ${PN}-dev ${PN}-doc"
+FILES_${PN}-ospfd      = "${libdir}/quagga/ospfd /usr/lib/libospf.so.*"
+FILES_${PN}-ospf6d     = "${libdir}/quagga/ospf6d"
+FILES_${PN}-bpgd       = "${libdir}/quagga/bgpd"
+FILES_${PN}-ripd       = "${libdir}/quagga/ripd"
+FILES_${PN}-ripngd     = "${libdir}/quagga/ripngd"
+FILES_${PN}-isisd      = "${libdir}/quagga/isisd"
+FILES_${PN}-ospfclient = "${libdir}/quagga/ospfclient /usr/lib/libospfapiclient.so.*"
+FILES_${PN}-dev                = "/usr/include /usr/lib/lib*.so /usr/lib/*.la /usr/lib/*.a"
+FILES_${PN}-doc                = "/usr/share/doc /usr/share/man /usr/share/info"
+FILES_${PN}-watchquagga        = "${libdir}/quagga/watchquagga ${sysconfdir}/default/watchquagga \
+                          ${sysconfdir}/init.d/watchquagga"
+FILES_${PN}            = "${bindir}/vtysh ${libdir}/quagga/zebra /usr/lib/libzebra*.so.* \
+                          ${sysconfdir}/quagga \
+                          ${sysconfdir}/default/quagga ${sysconfdir}/init.d/quagga"
+
+# Stop the names being rewritten due to the internal shared libraries
+PKG_${PN}-ospfd                = ${PN}-ospfd
+PKG_${PN}-ospfclient   = ${PN}-ospfclient
+
+# Each of the per-protocol packages depends on the main package
+RDEPENDS_${PN}-ospfd   = ${PN}
+RDEPENDS_${PN}-ospf6d  = ${PN}
+RDEPENDS_${PN}-bpgd    = ${PN}
+RDEPENDS_${PN}-ripd    = ${PN}
+RDEPENDS_${PN}-ripngd  = ${PN}
+RDEPENDS_${PN}-isisd   = ${PN}
+RDEPENDS_${PN}-ospfclient = ${PN}
+RDEPENDS_${PN}-doc     = ""
+RDEPENDS_${PN}-watchquagga = ${PN}
+# the "ip" command from busybox is not sufficient (flush by protocol flushes all routes)
+RDEPENDS_${PN}         += "iproute2"
+# These are required for vtysh
+RDEPENDS_${PN}         += "ncurses readline"
+
+do_install () {
+       # Install init script and default settings
+       install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d ${D}${sysconfdir}/quagga
+       install -m 0644 ${WORKDIR}/quagga.default ${D}${sysconfdir}/default/quagga
+       install -m 0644 ${WORKDIR}/watchquagga.default ${D}${sysconfdir}/default/watchquagga
+       install -m 0755 ${WORKDIR}/quagga.init ${D}${sysconfdir}/init.d/quagga
+       install -m 0755 ${WORKDIR}/watchquagga.init ${D}${sysconfdir}/init.d/watchquagga
+       # Install quagga
+       oe_runmake install DESTDIR=${D} prefix=${prefix} \
+               libexecdir=${libexecdir}/quagga \
+               sbindir=${libdir}/quagga \
+               sysconfdir=${sysconfdir}/quagga \
+               localstatedir=${localstatedir}/run/quagga
+}
+
+# Add quagga's user and groups
+pkg_postinst_${PN} () {
+        grep -q quagga: /etc/group || addgroup quagga
+       grep -q quaggavty: /etc/group || addgroup quaggavty
+        grep -q quagga: /etc/passwd || adduser --disabled-password --home=/var/run/quagga/ --ingroup quagga -g "Quagga routing suite" quagga
+}
+
+# Stop apps before uninstall
+pkg_prerm_${PN}-ospfd () {
+       ${sysconfdir}/init.d/quagga stop ospfd
+}
+
+pkg_prerm_${PN}-ospf6d () {
+       ${sysconfdir}/init.d/quagga stop ospf6d
+}
+
+pkg_prerm_${PN}-bgpd () {
+       ${sysconfdir}/init.d/quagga stop bpgd
+}
+
+pkg_prerm_${PN}-ripd () {
+       ${sysconfdir}/init.d/quagga stop ripd
+}
+
+pkg_prerm_${PN}-ripngd () {
+       ${sysconfdir}/init.d/quagga stop ripngd
+}
+
+pkg_prerm_${PN}-isisd () {
+       ${sysconfdir}/init.d/quagga stop isisd
+}
diff --git a/packages/quagga/quagga_0.99.2.bb b/packages/quagga/quagga_0.99.2.bb
new file mode 100644 (file)
index 0000000..9214ea6
--- /dev/null
@@ -0,0 +1,3 @@
+include quagga.inc
+PR = "r0"
+SRC_URI += "file://ospfd-no-opaque-lsa-fix.patch;patch=1"
diff --git a/packages/quagga/quagga_0.99.3.bb b/packages/quagga/quagga_0.99.3.bb
new file mode 100644 (file)
index 0000000..52b4734
--- /dev/null
@@ -0,0 +1,2 @@
+include quagga.inc
+PR = "r0"