diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-05-28 06:51:25 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-05-28 07:19:29 +0000 |
commit | 978b7d0426de9969be878d98a8fd4ab5a67e7a0c (patch) | |
tree | 1a35f68bd55ebaa17fb3a9a2726ec0744ae8effb /testing/stunnel/stunnel.initd | |
parent | 17d84baf11e5dc0ad41efa1dd9057f44da3e2065 (diff) | |
download | aports-978b7d0426de9969be878d98a8fd4ab5a67e7a0c.tar.bz2 aports-978b7d0426de9969be878d98a8fd4ab5a67e7a0c.tar.xz |
testing/stunnel: upgrade to 5.01 and add init.d script
Diffstat (limited to 'testing/stunnel/stunnel.initd')
-rw-r--r-- | testing/stunnel/stunnel.initd | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/testing/stunnel/stunnel.initd b/testing/stunnel/stunnel.initd new file mode 100644 index 0000000000..4d3202b17f --- /dev/null +++ b/testing/stunnel/stunnel.initd @@ -0,0 +1,43 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/stunnel/files/stunnel.initd-start-stop-daemon,v 1.3 2013/06/16 16:04:11 blueness Exp $ + +SERVICENAME=${SVCNAME#*.} +SERVICENAME=${SERVICENAME:-stunnel} +STUNNEL_CONFIGFILE=${STUNNEL_CONFIGFILE:-/etc/stunnel/${SERVICENAME}.conf} + +depend() { + need net + before logger +} + +get_config() { + if [ ! -e ${STUNNEL_CONFIGFILE} ] ; then + eerror "You need to create ${STUNNEL_CONFIGFILE} first." + return 1 + fi + CHROOT=$(grep "^chroot" ${STUNNEL_CONFIGFILE} | sed "s;.*= *;;") + [ -n "${CHROOT}" ] && CHROOT="--chroot ${CHROOT}" + PIDFILE=$(grep "^pid" ${STUNNEL_CONFIGFILE} | sed "s;.*= *;;") + PIDFILE=${PIDFILE:-/var/run/stunnel/${SERVICENAME}.pid} +} + +start() { + get_config || return 1 + checkpath -d -m 0775 -o root:stunnel /var/run/stunnel + if [ "$(dirname ${PIDFILE})" != "/var/run" ]; then + checkpath -d -m 0755 -o stunnel:stunnel -q $(dirname ${PIDFILE}) + fi + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --pidfile "${PIDFILE}" ${CHROOT} \ + --exec /usr/bin/stunnel -- ${STUNNEL_CONFIGFILE} ${STUNNEL_OPTIONS} + eend $? "Failed to start ${SVCNAME}" +} + +stop() { + get_config || return 1 + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --quiet --pidfile ${PIDFILE} + eend $? "Failed to stop ${SVCNAME}" +} |