diff options
author | Matt Turner <mattst88@gentoo.org> | 2017-06-14 08:36:41 -0700 |
---|---|---|
committer | Matt Turner <mattst88@gentoo.org> | 2017-06-14 08:48:04 -0700 |
commit | 58ad6e14c853928499f34ee991120ee2196058e7 (patch) | |
tree | 2e790d43e098ce37ea25dc3cfa372abfd351ace5 /net-proxy/redsocks/files/redsocks.init | |
parent | www-apps/gitea: Remove old (diff) | |
download | gentoo-58ad6e14c853928499f34ee991120ee2196058e7.tar.gz gentoo-58ad6e14c853928499f34ee991120ee2196058e7.tar.bz2 gentoo-58ad6e14c853928499f34ee991120ee2196058e7.zip |
net-proxy/redsocks: Ship man page, init files, etc
Also move config file to /etc/redsocks.conf (there's a single file, no
need for a directory) and add a redsocks user and group.
Diffstat (limited to 'net-proxy/redsocks/files/redsocks.init')
-rw-r--r-- | net-proxy/redsocks/files/redsocks.init | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/net-proxy/redsocks/files/redsocks.init b/net-proxy/redsocks/files/redsocks.init new file mode 100644 index 000000000000..853d9b57a6bb --- /dev/null +++ b/net-proxy/redsocks/files/redsocks.init @@ -0,0 +1,53 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +: ${REDSOCKS_BINARY:=/usr/sbin/redsocks} +: ${REDSOCKS_CONFIG:=/etc/redsocks.conf} +: ${REDSOCKS_PIDFILE:=/run/redsocks/redsocks.pid} + +extra_commands="checkconfig" +extra_started_commands="reload" + +depend() { + need localmount + use dns +} + +checkconfig() { + if [ ! -f "${REDSOCKS_CONFIG}" ] ; then + eerror "No ${REDSOCKS_CONFIG} file exists!" + return 1 + fi + + "${REDSOCKS_BINARY}" -t -c ${REDSOCKS_CONFIG} || return 1 +} + +start() { + checkconfig || return 1 + + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --exec "${REDSOCKS_BINARY}" \ + -p "${REDSOCKS_PIDFILE}" -c ${REDSOCKS_CONFIG} + eend $? +} + +stop() { + if [ "${RC_CMD}" = "restart" ] ; then + checkconfig || return 1 + fi + + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --exec "${REDSOCKS_BINARY}" \ + -p "${REDSOCKS_PIDFILE}" -c "${REDSOCKS_CONFIG}" + eend $? +} + +reload() { + checkconfig || return 1 + + ebegin "Reloading ${SVCNAME}" + start-stop-daemon --signal HUP --exec "${REDSOCKS_BINARY}" \ + -p "${REDSOCKS_PIDFILE}" -c "${REDSOCKS_CONFIG}" + eend $? +} |