From 0e7cd8679cfdecf9b994a8cb7b60993693db2dd1 Mon Sep 17 00:00:00 2001 From: alarig Date: Tue, 5 Mar 2019 17:08:15 +0100 Subject: [PATCH] Applying comments from Michael Orlitzky --- net-misc/bird/Manifest | 2 +- net-misc/bird/files/initd-bird-2 | 38 ++++++++++++-------------------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/net-misc/bird/Manifest b/net-misc/bird/Manifest index 3cb3d53..8d9589f 100644 --- a/net-misc/bird/Manifest +++ b/net-misc/bird/Manifest @@ -1,4 +1,4 @@ -AUX initd-bird-2 1232 BLAKE2B a055afc497d3934e64a9c76857e7c6890821ae04f935da1b1a162f0b5c0ba97f6ef827f99f155ebec5fa734d92239ec283a574159302a7707029d032f799a4ff SHA512 b937c027ab68db85416145b73079cac12f04d02e40f0833da9733ed8353368de6f331dad923ea272db6fbe71e14c99cc8bbf2eb10b9e7891d43512f705c9b066 +AUX initd-bird-2 1105 BLAKE2B 20a5f258c495567cbed8c26c52bc90a0a4e7528248583324473881fa6f75523407ca4c3445ebaccb4a09301428f9865b634a7f1a907928a86185ff2be7a34c27 SHA512 36e4dc1af64c01f6f2c01c27cd7d50f0b68e3072e01295d108bca2da10b94032f4f0a76470fa208b0fa378b5c9933d44257bbddee1cf66f5e4709164ba9f1413 AUX initd-v4-bird-1.3.8 801 BLAKE2B 09d9045299972580280fbb6d8745378a75b3a9e647b965d9033e6493df67ea268afba8ab95c46208894f330ff3607d90502653072eb73c130d1841cab9e604c2 SHA512 e878792e589317b743c53fa9fd1f5a4e04c6c97a64946a3e47a910c35d32ad265dcd860935e91950cddb97e1f6ab43c02157a5349e4bd4529cdd1539ca7cf879 AUX initd-v6-bird-1.3.8 802 BLAKE2B a9dc698f9dfde93314fe1b0f4c8005d9b5f14e4133ebad124f4283a50d990c946bda88b1d55227ed6bf9f33caf0d716b0a8540adf592fbf156297c20ab8a3b1c SHA512 6adb2b7c22696e53644bb5331bcb1b6e84026e41086f6f538c40073a7daa3b0ce3a14e041c2615a72cbe151d6fa8f81b543f85d421f019440ef5b6fd0a556ad9 DIST bird-2.0.4.tar.gz 1051911 BLAKE2B 12100685e4aad969dbb51eaa567e1038f50e7c030a25a8697bc35d4f33d0f64f9ccbc045e1210acb78f3d8d4a7cc7ef2be7ae50a36679f2322d292e8e6993ed4 SHA512 65092ca6be115b4d0c31c3c4a79d3ee2e196dc2f85454448eab568cc9cc1fe37b7bdfe1ddb74d4f6f147dc479a8570cf7bf702d762cd69414f976678c14c8e2f diff --git a/net-misc/bird/files/initd-bird-2 b/net-misc/bird/files/initd-bird-2 index 8eb0fff..88c6548 100755 --- a/net-misc/bird/files/initd-bird-2 +++ b/net-misc/bird/files/initd-bird-2 @@ -4,39 +4,34 @@ extra_started_commands="reload" -pidfile="/var/run/${RC_SVCNAME}.pid" -CONF_FILE="/etc/${RC_SVCNAME}.conf" -SOCK="/var/run/${RC_SVCNAME}.ctl" - +pidfile="/run/${RC_SVCNAME}.pid" command="/usr/sbin/${RC_SVCNAME}" -command_args="-c ${CONF_FILE} -s ${SOCK} -P ${pidfile}" +retry=15 + +CONF_FILE="/etc/${RC_SVCNAME}.conf" +SOCK="/run/${RC_SVCNAME}.ctl" + +client_args="-s ${SOCK}" +command_args="${client_args} -c ${CONF_FILE} -P ${pidfile}" +client_args="${client_args} -r" depend() { need net use logger } -checkconfig() { - if [ ! -f "CONF_FILE" ]; then - eerror "Please create ${CONF_FILE}" - return 1 - fi - return 0 -} - check_run() { + BIRD_CHECK_CONF="birdc ${client_args} configure check" # Check if the bird parser returns what we want # We can’t use $? because it’s always 0 if the sock works - STATE=$(birdc -s ${SOCK} 'configure check' | \ - grep 'Configuration OK') + STATE=$(${BIRD_CHECK_CONF} | grep 'Configuration OK') if [ -n "${STATE}" ]; then return 0 else - # We remove the first two lines (garbage informations), the - # errors begin at the third - eerror "$(birdc -s ${SOCK} 'configure check' | \ - sed '1d;2d')" + # We remove the first three lines (garbage informations), the + # errors begin after that + eerror "$(${BIRD_CHECK_CONF} | sed '1,3d')" return 1 fi } @@ -53,8 +48,3 @@ stop_pre() { check_run || return 1 fi } - -stop() { - ebegin "Stopping BIRD" - start-stop-daemon --stop --exec ${command} --retry 15 -}