summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2011-09-26 03:23:06 +0000
committerAnthony G. Basile <blueness@gentoo.org>2011-09-26 03:23:06 +0000
commit9e87d8bc2d39cb8b2f2deaa79d5d922f8ed02f28 (patch)
tree90939ad235d4844a1227714035c614dd81cbcdb6 /net-misc/tinc/files
parentMarked ~x86-macos (diff)
downloadgentoo-2-9e87d8bc2d39cb8b2f2deaa79d5d922f8ed02f28.tar.gz
gentoo-2-9e87d8bc2d39cb8b2f2deaa79d5d922f8ed02f28.tar.bz2
gentoo-2-9e87d8bc2d39cb8b2f2deaa79d5d922f8ed02f28.zip
Rewrite of initd system, added syslog/logfile support, bug #371357
(Portage version: 2.1.10.11/cvs/Linux x86_64)
Diffstat (limited to 'net-misc/tinc/files')
-rw-r--r--net-misc/tinc/files/tincd.170
-rw-r--r--net-misc/tinc/files/tincd.conf.15
-rw-r--r--net-misc/tinc/files/tincd.lo.158
3 files changed, 133 insertions, 0 deletions
diff --git a/net-misc/tinc/files/tincd.1 b/net-misc/tinc/files/tincd.1
new file mode 100644
index 000000000000..3dc1d61c63f7
--- /dev/null
+++ b/net-misc/tinc/files/tincd.1
@@ -0,0 +1,70 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/files/tincd.1,v 1.1 2011/09/26 03:23:06 blueness Exp $
+
+extra_commands="reload"
+
+NETS="/etc/conf.d/tinc.networks"
+DAEMON="/usr/sbin/tincd"
+
+depend() {
+ use logger dns
+ need net
+}
+
+checkconfig() {
+ if ! grep -q '^ *NETWORK:' "${NETS}" ; then
+ eerror "No VPN networks configured in ${NETS}"
+ return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting tinc VPN networks"
+ awk '/^ *NETWORK:/ { print $2 }' "${NETS}" | while read NETNAME
+ do
+ 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 ${NETNAME}"
+ if [ "${SYSLOG}" == "yes" ]; then
+ LOG=""
+ else
+ LOG="--logfile=/var/log/tinc.${NETNAME}.log"
+ fi
+ start-stop-daemon --start --exec "${DAEMON}" -- --net="${NETNAME}" "${LOG}" --pidfile "${PIDFILE}"
+ eend $?
+ fi
+ done
+}
+
+stop() {
+ ebegin "Stopping tinc VPN networks"
+ awk '/^ *NETWORK:/ { print $2 }' "${NETS}" | while read NETNAME
+ do
+ PIDFILE="/var/run/tinc.${NETNAME}.pid"
+ if [ -f "${PIDFILE}" ]; then
+ ebegin "Stopping tinc network ${NETNAME}"
+ start-stop-daemon --stop --pidfile "${PIDFILE}"
+ eend $?
+ fi
+ done
+}
+
+reload() {
+ ebegin "Reloading configuration for tinc VPN networks"
+ awk '/^ *NETWORK:/ { print $2 }' "${NETS}" | while read NETNAME
+ do
+ 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/net-misc/tinc/files/tincd.conf.1 b/net-misc/tinc/files/tincd.conf.1
new file mode 100644
index 000000000000..0394702a2af5
--- /dev/null
+++ b/net-misc/tinc/files/tincd.conf.1
@@ -0,0 +1,5 @@
+#rc_need="net.net"
+
+#If you want tincd to log to syslog, then set this to "yes"
+#Anything else and tincd will log to /var/log/tinc.NETNAME.log.
+SYSLOG="yes"
diff --git a/net-misc/tinc/files/tincd.lo.1 b/net-misc/tinc/files/tincd.lo.1
new file mode 100644
index 000000000000..41a2c517ad47
--- /dev/null
+++ b/net-misc/tinc/files/tincd.lo.1
@@ -0,0 +1,58 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/files/tincd.lo.1,v 1.1 2011/09/26 03:23:06 blueness Exp $
+
+extra_commands="reload"
+
+DAEMON="/usr/sbin/tincd"
+
+depend()
+{
+ use logger dns
+ need net
+}
+
+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
+ 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}" -- --net="${NETNAME}" "${LOG}" --pidfile "${PIDFILE}"
+ eend $?
+ fi
+}
+
+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 $?
+ fi
+}
+
+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
+}