aboutsummaryrefslogtreecommitdiffstats
path: root/main/tinc/tincd.lo.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-06-09 08:53:50 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-06-09 08:53:50 +0000
commit56db87515d46cee8adca0cadb34d3001951c203e (patch)
tree71cf7c965910dd671b700e9f645d1f59d4151a18 /main/tinc/tincd.lo.initd
parent14b0a8983c5199a8359ab6a1af9e79817c13a6a3 (diff)
downloadaports-56db87515d46cee8adca0cadb34d3001951c203e.tar.bz2
aports-56db87515d46cee8adca0cadb34d3001951c203e.tar.xz
main/tinc: sync init.d scripts with gentoo
Diffstat (limited to 'main/tinc/tincd.lo.initd')
-rw-r--r--main/tinc/tincd.lo.initd63
1 files changed, 35 insertions, 28 deletions
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
}