summaryrefslogtreecommitdiff
path: root/net-misc/stunnel/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2021-03-20 14:27:17 +0000
committerV3n3RiX <venerix@redcorelinux.org>2021-03-20 14:27:17 +0000
commit5bb9ff1ee56d2b5e75e01a7f066d8b0cec84ec02 (patch)
tree66e860a5099bcad013f1cf667255dc372a7c11b3 /net-misc/stunnel/files
parent7218e1b46bceac05841e90472501742d905fb3fc (diff)
gentoo resync : 20.03.2021
Diffstat (limited to 'net-misc/stunnel/files')
-rw-r--r--net-misc/stunnel/files/stunnel-r255
1 files changed, 55 insertions, 0 deletions
diff --git a/net-misc/stunnel/files/stunnel-r2 b/net-misc/stunnel/files/stunnel-r2
new file mode 100644
index 000000000000..abd42987d2b4
--- /dev/null
+++ b/net-misc/stunnel/files/stunnel-r2
@@ -0,0 +1,55 @@
+#!/sbin/openrc-run
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+extra_started_commands="reload"
+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:-/run/stunnel/${SERVICENAME}.pid}
+ SETUID=$(grep "^setuid" ${STUNNEL_CONFIGFILE} | sed "s;.*= *;;")
+ SETUID=${SETUID:-stunnel}
+ SETGID=$(grep "^setgid" ${STUNNEL_CONFIGFILE} | sed "s;.*= *;;")
+ SETGID=${SETGID:-stunnel}
+}
+
+start() {
+ get_config || return 1
+ checkpath -d -m 0775 -o root:stunnel /run/stunnel
+ if [ "$(dirname ${PIDFILE})" != "/run" ]; then
+ checkpath -d -m 0755 -o ${SETUID}:${SETGID} -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 --exec /usr/bin/stunnel \
+ --pidfile ${PIDFILE}
+ eend $? "Failed to stop ${SVCNAME}"
+}
+
+reload() {
+ get_config || return 1
+ ebegin "Reloading ${SVCNAME}"
+ start-stop-daemon --signal HUP --pidfile ${PIDFILE} --name stunnel
+ eend $?
+}