diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-06-09 08:53:50 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-06-09 08:53:50 +0000 |
commit | 56db87515d46cee8adca0cadb34d3001951c203e (patch) | |
tree | 71cf7c965910dd671b700e9f645d1f59d4151a18 /main/tinc | |
parent | 14b0a8983c5199a8359ab6a1af9e79817c13a6a3 (diff) | |
download | aports-56db87515d46cee8adca0cadb34d3001951c203e.tar.bz2 aports-56db87515d46cee8adca0cadb34d3001951c203e.tar.xz |
main/tinc: sync init.d scripts with gentoo
Diffstat (limited to 'main/tinc')
-rw-r--r-- | main/tinc/APKBUILD | 14 | ||||
-rw-r--r-- | main/tinc/tincd.initd | 55 | ||||
-rw-r--r-- | main/tinc/tincd.lo.initd | 63 |
3 files changed, 72 insertions, 60 deletions
diff --git a/main/tinc/APKBUILD b/main/tinc/APKBUILD index 97674b30af..e087be50bb 100644 --- a/main/tinc/APKBUILD +++ b/main/tinc/APKBUILD @@ -1,7 +1,7 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=tinc pkgver=1.0.24 -pkgrel=1 +pkgrel=2 pkgdesc="tinc is a Virtual Private Network (VPN) daemon" url="http://www.tinc-vpn.org/" arch="all" @@ -57,16 +57,16 @@ package() { md5sums="14a91eb2e85bdc0451a815612521b708 tinc-1.0.24.tar.gz f2c913659191a0c81ed13dde305ca8bc musl.patch -91eef72fcab95d91bf7fdebe9f1b8156 tincd.initd -db453729063ce9fe435dd31fdc7cd3af tincd.lo.initd +06d8405b10a5e7eeb09037a0e6040ec3 tincd.initd +2a6dcec884a40ac6e6c5a0ea4e70d247 tincd.lo.initd 475d64d9aa410ec7e91f5b079800abc9 tinc.networks" sha256sums="498e58f9f39e3922030a63cf62baf4b46a40fbda8d90b23ec0f084f4a9f9b687 tinc-1.0.24.tar.gz a394327605fa38e1b7bbbb49eda6461c96553d31370107e337482934ea8b042c musl.patch -a3892d88164e9113adb7bbe917994946df058364b797f9f6e3ae8692ef7ca1fd tincd.initd -0ac4ca95e17a81a6275a5d9504883394eaf65045ab0c8f2b69d17ffdd30d3359 tincd.lo.initd +2d0e64a87b6e9b0826c43dc9975346d152c222ba4ac4cc0c58eb0669b6de748a tincd.initd +b83753910c6d92c6d39f6fe6ab114a71a9bdfb1debc47c14912c50b8e7c19685 tincd.lo.initd 7165721abd3706c95973118fbb503e18f9a008da6bdbf21a4ce35ecf7818d5ad tinc.networks" sha512sums="a59d4f996892b9aa4ce6adaf3f40c06dfb37c2546edb6b3858af15df7f4e6f7738dc186969df1676ad1dab7fcc081bec262bd9df4efc7620e00ca9be9121bc7d tinc-1.0.24.tar.gz 2a631b82e2d24139e8bf07057578d3f8e7f566829492cbbb82d030505ba00fe63943c57778156bca6985ab216e7b0d5ad8aeb25f7d7affa3189b7b3a005d0312 musl.patch -6ae745adee3208c269a95f5e54e8b362f6ace6424757c1c2ce67af9396be0f1719c611e941038778b6dc0611464922c8b3173cb26fdc772d9be28646589f7907 tincd.initd -affdc60fb45e33e0fa994ceed813a3a1f3a2cf087cf87d30da8ca6184c8a9215680c598bdfbb0a5669993a4f165440479d2e97bd10029f318f44264c4e5998a0 tincd.lo.initd +159e426b6061a34500041b0efd858cfeb2d020341677985b40061dd032b2c6a343417441cb8087b61f1b1d9dbc69fd97f0fec8e264c12bd607b6077a3b784f2d tincd.initd +5c142917f44ffb94370a0212ec6ed2392d0da104db89d89302ce243df6ff26103c1a4b8162d57f9fafc205e41723fc443260e87c2c2eff3d73bffd6f4b521d97 tincd.lo.initd f7cb459c170898e51176bd92c642335386db90b7bca2abb3f6eb2514546efbd74e5fd2c8845060111dd48a0dd2cc1890717a03315c9b86185047c259cdc27135 tinc.networks" diff --git a/main/tinc/tincd.initd b/main/tinc/tincd.initd index c302f4fe0c..b26185eae4 100644 --- a/main/tinc/tincd.initd +++ b/main/tinc/tincd.initd @@ -1,10 +1,12 @@ #!/sbin/runscript -# Copyright 1999-2004 Gentoo Foundation +# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/files/tincd,v 1.5 2008/04/01 14:08:45 dragonheart Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/files/tincd,v 1.9 2013/09/01 12:22:46 blueness Exp $ extra_started_commands="reload" -daemon=/usr/sbin/tincd + +NETS="/etc/conf.d/tinc.networks" +DAEMON="/usr/sbin/tincd" depend() { use logger dns @@ -12,9 +14,8 @@ depend() { } checkconfig() { - if ! grep -q '^ *NETWORK:' /etc/conf.d/tinc.networks - then - eerror "No VPN networks configured in /etc/conf.d/tinc.networks" + if ! grep -q '^ *NETWORK:' "${NETS}" ; then + eerror "No VPN networks configured in ${NETS}" return 1 fi } @@ -22,15 +23,21 @@ checkconfig() { start() { checkconfig || return 1 ebegin "Starting tinc VPN networks" - eend 0 - awk '/^ *NETWORK:/ { print $2 }' /etc/conf.d/tinc.networks | while read TINCNET + awk '/^ *NETWORK:/ { print $2 }' "${NETS}" | while read NETNAME do - if [ ! -f /etc/tinc/"$TINCNET"/tinc.conf ] - then - eerror "Cannot start network $TINCNET, /etc/tinc/$TINCNET/tinc.conf does not exist !" + CONFIG="/etc/tinc/${NETNAME}/tinc.conf" + PIDFILE="/var/run/tinc.${NETNAME}.pid" + if [ ! -f "${CONFIG}" ]; then + eerror "Cannot start network ${NETNAME}." + eerror "Please set up ${CONFIG} !" else - ebegin "Starting tinc network $TINCNET" - $daemon --net="$TINCNET" --logfile=/var/log/tinc.$TINCNET.log --pidfile=/var/run/tinc.$TINCNET.pid + ebegin "Starting tinc network ${NETNAME}" + if [ "${SYSLOG}" == "yes" ]; then + LOG="" + else + LOG="--logfile=/var/log/tinc.${NETNAME}.log" + fi + start-stop-daemon --start --exec "${DAEMON}" --pidfile "${PIDFILE}" -- --net="${NETNAME}" ${LOG} --pidfile "${PIDFILE}" eend $? fi done @@ -38,13 +45,12 @@ start() { stop() { ebegin "Stopping tinc VPN networks" - eend 0 - awk '/^ *NETWORK:/ { print $2 }' /etc/conf.d/tinc.networks | while read TINCNET + awk '/^ *NETWORK:/ { print $2 }' "${NETS}" | while read NETNAME do - if [ -f /var/run/tinc."$TINCNET".pid ] - then - ebegin "Stopping tinc network $TINCNET" - start-stop-daemon --stop --quiet --pidfile=/var/run/tinc.$TINCNET.pid --exec ${daemon} + PIDFILE="/var/run/tinc.${NETNAME}.pid" + if [ -f "${PIDFILE}" ]; then + ebegin "Stopping tinc network ${NETNAME}" + start-stop-daemon --stop --pidfile "${PIDFILE}" eend $? fi done @@ -52,13 +58,12 @@ stop() { reload() { ebegin "Reloading configuration for tinc VPN networks" - eend 0 - awk '/^ *NETWORK:/ { print $2 }' /etc/conf.d/tinc.networks | while read TINCNET + awk '/^ *NETWORK:/ { print $2 }' "${NETS}" | while read NETNAME do - if [ -f /var/run/tinc."$TINCNET".pid ] - then - ebegin "Reloading tinc network $TINCNET" - kill -1 $(awk '{ print $1 }' /var/run/tinc."$TINCNET".pid) + PIDFILE="/var/run/tinc.${NETNAME}.pid" + if [ -f "${PIDFILE}" ]; then + ebegin "Reloading tinc network ${NETNAME}" + start-stop-daemon --signal HUP --pidfile ${PIDFILE} eend $? fi done diff --git a/main/tinc/tincd.lo.initd b/main/tinc/tincd.lo.initd index 7ba43fdfa3..a7bc443498 100644 --- a/main/tinc/tincd.lo.initd +++ b/main/tinc/tincd.lo.initd @@ -1,47 +1,54 @@ #!/sbin/runscript -# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/files/tincd.lo,v 1.1 2010/07/18 10:04:56 dragonheart Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/files/tincd.lo,v 1.5 2013/09/01 12:22:46 blueness Exp $ extra_started_commands="reload" -daemon=/usr/sbin/tincd -depend() -{ +DAEMON="/usr/sbin/tincd" + +depend() { use logger dns need net } -start() -{ - TINCNET=${RC_SVCNAME#*.} - if [ -f /etc/tinc/"$TINCNET"/tinc.conf ] ; then - ebegin "Starting tinc network $TINCNET" - $daemon --debug=1 --net="$TINCNET" --logfile=/var/log/tinc.$TINCNET.log --pidfile=/var/run/tinc.$TINCNET.pid - eend $? +start() { + NETNAME="${RC_SVCNAME#*.}" + CONFIG="/etc/tinc/${NETNAME}/tinc.conf" + PIDFILE="/var/run/tinc.${NETNAME}.pid" + if [ ! -f "${CONFIG}" ]; then + eerror "Cannot start network ${NETNAME}." + eerror "Please set up ${CONFIG} !" else - eerror "Cannot start network $TINCNET, /etc/tinc/$TINCNET/tinc.conf does not exist !" + ebegin "Starting tinc network $NETNAME" + if [ "${SYSLOG}" == "yes" ]; then + LOG="" + else + LOG="--logfile=/var/log/tinc.${NETNAME}.log" + fi + start-stop-daemon --start --exec "${DAEMON}" --pidfile "${PIDFILE}" -- --net="${NETNAME}" ${LOG} --pidfile "${PIDFILE}" + eend $? fi } -stop() -{ - TINCNET=${RC_SVCNAME#*.} - if [ -f /var/run/tinc."$TINCNET".pid ] ; then - ebegin "Stopping tinc network $TINCNET" - start-stop-daemon --stop --quiet --pidfile=/var/run/tinc.$TINCNET.pid --exec ${daemon} +stop() { + NETNAME="${RC_SVCNAME#*.}" + CONFIG="/etc/tinc/${NETNAME}/tinc.conf" + PIDFILE="/var/run/tinc.${NETNAME}.pid" + if [ -f "${PIDFILE}" ] ; then + ebegin "Stopping tinc network ${NETNAME}" + start-stop-daemon --stop --pidfile "${PIDFILE}" eend $? - else - eindent "network $TINCNET has already been stopped" fi } -reload() -{ - TINCNET=${RC_SVCNAME#*.} - if [ -f /var/run/tinc."$TINCNET".pid ] ; then - ebegin "Reloading configuration for tinc network $TINCNET" - kill -1 $(awk '{ print $1 }' /var/run/tinc."$TINCNET".pid) - eend $? +reload() { + NETNAME=${RC_SVCNAME#*.} + CONFIG="/etc/tinc/${NETNAME}/tinc.conf" + PIDFILE="/var/run/tinc.${NETNAME}.pid" + if [ -f "${PIDFILE}" ] ; then + ebegin "Reloading tinc network ${NETNAME}" + start-stop-daemon --signal HUP --pidfile "${PIDFILE}" + eend $? fi } |