Subject: [alpine-aports] [PATCH] main/quagga: Cleanups and fixups in init.d and conf.d files.

From: Valery Kartel <[email-masked]>
Date: Fri, 10 Jun 2016 13:03:01 +0300

---
 main/quagga/APKBUILD     | 11 ++++++-----
 main/quagga/bgpd.initd   |  9 ++++-----
 main/quagga/quagga.confd |  5 +++++
 main/quagga/zebra.confd  |  7 -------
 main/quagga/zebra.initd  | 26 ++++++++------------------
 5 files changed, 23 insertions(+), 35 deletions(-)
 create mode 100644 main/quagga/quagga.confd
 delete mode 100644 main/quagga/zebra.confd

diff --git a/main/quagga/APKBUILD b/main/quagga/APKBUILD
index 48523f8..8b3ee1d 100644
--- a/main/quagga/APKBUILD
+++ b/main/quagga/APKBUILD
@@ -1,7 +1,8 @@
 # Maintainer: Natanael Copa <[email-masked]>
+# Contributor: Valery Kartel <[email-masked]>
 pkgname=quagga
 pkgver=1.0.20160315
-pkgrel=1
+pkgrel=2
 pkgdesc="A free routing daemon replacing Zebra supporting RIP, OSPF and BGP."
 url="http://quagga.net/"
 arch="all"
@@ -14,10 +15,9 @@ pkgusers="quagga"
 pkggroups="quagga"
 source="http://download.savannah.gnu.org/releases/quagga/quagga-$pkgver.tar.xz
 	dont-hook-core-signals.patch
-
+	quagga.confd
 	bgpd.initd
 	zebra.initd
-	zebra.confd
 	"
 
 _builddir="$srcdir"/$pkgname-$pkgver
@@ -61,16 +61,17 @@ package() {
 	cd "$_builddir"
 	make DESTDIR="$pkgdir" install || return 1
 
-	install -o quagga -g quagga -d "$pkgdir"/var/run/quagga
 	for i in zebra bgpd; do
 		install -Dm755 "$srcdir"/$i.initd "$pkgdir"/etc/init.d/$i
+		install -Dm644 "$srcdir"/quagga.confd "$pkgdir"/etc/conf.d/$i
 	done
 	for i in ripd ospfd ripngd ospf6d; do
 		ln -s bgpd "$pkgdir"/etc/init.d/$i || return 1
+		install -Dm644 "$srcdir"/quagga.confd "$pkgdir"/etc/conf.d/$i
 	done
-	install -Dm644 "$srcdir/zebra.confd" "$pkgdir"/etc/conf.d/zebra
 	install -o quagga -g quagga -d -m755 "$pkgdir"/etc/quagga
 }
+
 md5sums="61bfd0c8fb696dd778234ee8b05821bc  quagga-1.0.20160315.tar.xz
 1224ba91ea6b6e81f583bad7813aba98  dont-hook-core-signals.patch
 09a77e2e84e71c43f5a449738c026261  bgpd.initd
diff --git a/main/quagga/bgpd.initd b/main/quagga/bgpd.initd
index bd1e4c6..0b3ddd9 100644
--- a/main/quagga/bgpd.initd
+++ b/main/quagga/bgpd.initd
@@ -1,9 +1,8 @@
 #!/sbin/openrc-run
 
-piddir=/var/run/quagga
-pidfile=$piddir/$SVCNAME.pid
+pidfile=/var/run/quagga/$SVCNAME.pid
 command=/usr/sbin/$SVCNAME
-command_args="-d -f /etc/quagga/$SVCNAME.conf --pid_file $pidfile"
+command_args="-d -f /etc/quagga/$SVCNAME.conf --pid_file $pidfile $command_args"
 
 depend() {
 	need net zebra
@@ -16,7 +15,7 @@ start_pre() {
 		eerror "An example can be found in /usr/share/doc/quagga/$SVCNAME.conf.sample"
 		eerror "from quagga-doc package"
 		return 1
+	else
+		checkpath --owner quagga:quagga --directory ${pidfile%/*}
 	fi
-	checkpath --owner quagga:quagga --directory $piddir
 }
-
diff --git a/main/quagga/quagga.confd b/main/quagga/quagga.confd
new file mode 100644
index 0000000..14172c1
--- /dev/null
+++ b/main/quagga/quagga.confd
@@ -0,0 +1,5 @@
+# Additional command-line parameters to run:
+#	-A, --vty_addr addr   Set vty's bind address
+#	-P, --vty_port port   Set vty's port number
+#	-r, --retain          When program terminates, retain added route by zebra/bgpd.
+command_args=""
diff --git a/main/quagga/zebra.confd b/main/quagga/zebra.confd
deleted file mode 100644
index d2deb11..0000000
--- a/main/quagga/zebra.confd
+++ /dev/null
@@ -1,7 +0,0 @@
-# Additional command-line parameters to run zebra with:
-#	-k, --keep_kernel     Don't delete old routes which installed by zebra.
-#	-A, --vty_addr addr   Set vty's bind address
-#	-P, --vty_port port   Set vty's port number
-#	-r, --retain          When program terminates, retain added route by zebra.
-#       -s, --nl-bufsize      Set netlink receive buffer size
-ZEBRA_OPTS=""
diff --git a/main/quagga/zebra.initd b/main/quagga/zebra.initd
index 6ab297e..c5a7d27 100644
--- a/main/quagga/zebra.initd
+++ b/main/quagga/zebra.initd
@@ -1,34 +1,24 @@
 #!/sbin/openrc-run
 
-piddir=/var/run/quagga
-pidfile=$piddir/$SVCNAME.pid
+pidfile=/var/run/quagga/$SVCNAME.pid
 command=/usr/sbin/$SVCNAME
-command_args="-d -f /etc/quagga/$SVCNAME.conf --pid_file $pidfile"
+command_args="-d -f /etc/quagga/$SVCNAME.conf --pid_file $pidfile $command_args"
 
 depend() {
 	need net
 	after firewall opennhrp
 }
 
-cleanup() {
-	ebegin "Cleaning up stale zebra routes..."
-	ip route flush proto zebra
-	eend $?
-}
-
-checkconfig() {
+start_pre() {
 	if ! [ -e /etc/quagga/$SVCNAME.conf ] ; then
 		eerror "You need to create /etc/quagga/$SVCNAME.conf first."
 		eerror "An example can be found in /usr/share/doc/quagga/$SVCNAME.conf.sample"
 		eerror "from quagga-doc package"
 		return 1
+	else 
+		checkpath --owner quagga:quagga --directory ${pidfile%/*}
+		ebegin "Cleaning up stale zebra routes..."
+		ip route flush proto zebra
+		eend $?
 	fi
-	return 0
 }
-
-start_pre() {
-	checkconfig || return 1
-	checkpath --owner quagga:quagga --directory $piddir
-	cleanup
-}
-
-- 
2.8.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---