net-proxy/redsocks: migrate to GLEP 81

Bug: https://bugs.gentoo.org/781470
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Conrad Kostecki <conikost@gentoo.org>
This commit is contained in:
Conrad Kostecki
2021-07-13 22:55:06 +02:00
parent 650918b576
commit b122ea72d2
3 changed files with 103 additions and 13 deletions
+45
View File
@@ -0,0 +1,45 @@
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
command=${REDSOCKS_BINARY:=/usr/sbin/redsocks}
: ${REDSOCKS_CONFIG:=/etc/redsocks.conf}
pidfile=${REDSOCKS_PIDFILE:=/run/redsocks/redsocks.pid}
command_args="-p ${pidfile} -c ${REDSOCKS_CONFIG}"
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
"${command}" -t -c ${REDSOCKS_CONFIG} || return 1
checkpath -d -o "redsocks:redsocks" -q "/run/redsocks"
}
start_pre() {
checkconfig || return 1
}
stop_pre() {
if [ "${RC_CMD}" = "restart" ] ; then
checkconfig || return 1
fi
}
reload() {
checkconfig || return 1
ebegin "Reloading ${SVCNAME}"
start-stop-daemon --signal HUP --pidfile "${pidfile}"
eend $?
}
+47
View File
@@ -0,0 +1,47 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
if [[ ${PV} != *9999* ]]; then
SRC_URI="https://github.com/darkk/${PN}/archive/release-${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}"/"${PN}"-release-"${PV}"
KEYWORDS="~amd64 ~x86"
else
GIT_ECLASS="git-r3"
EGIT_REPO_URI="https://github.com/darkk/${PN}.git"
fi
inherit systemd toolchain-funcs ${GIT_ECLASS}
DESCRIPTION="Transparent redirector of any TCP connection to proxy"
HOMEPAGE="http://darkk.net.ru/redsocks/"
LICENSE="Apache-2.0 LGPL-2.1+ ZLIB"
SLOT="0"
IUSE="doc"
RESTRICT="test"
DEPEND="dev-libs/libevent:0="
RDEPEND="
${DEPEND}
acct-group/redsocks
acct-user/redsocks
net-firewall/iptables
"
src_compile() {
CC="$(tc-getCC)" emake
}
src_install() {
dosbin redsocks
doman debian/redsocks.8
use doc && dodoc README doc/*
insinto /etc
newins debian/redsocks.conf redsocks.conf
newinitd "${FILESDIR}"/redsocks.init-r2 redsocks
newconfd "${FILESDIR}"/redsocks.conf redsocks
systemd_dounit "${FILESDIR}"/redsocks.service
}
+11 -13
View File
@@ -1,17 +1,18 @@
# Copyright 1999-2017 Gentoo Foundation
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=6
EAPI=7
if [[ ${PV} != *9999* ]]; then
SRC_URI="https://github.com/darkk/${PN}/archive/release-${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}"/"${PN}"-release-"${PV}"
KEYWORDS="~amd64 ~x86"
else
GIT_ECLASS="git-r3"
EGIT_REPO_URI="https://github.com/darkk/${PN}.git"
fi
inherit systemd toolchain-funcs user ${GIT_ECLASS}
inherit systemd toolchain-funcs ${GIT_ECLASS}
DESCRIPTION="Transparent redirector of any TCP connection to proxy"
HOMEPAGE="http://darkk.net.ru/redsocks/"
@@ -21,15 +22,12 @@ IUSE="doc"
RESTRICT="test"
DEPEND="dev-libs/libevent:0="
RDEPEND="${DEPEND}
net-firewall/iptables"
[[ ${PV} != *9999 ]] && S="${WORKDIR}"/"${PN}"-release-"${PV}"
pkg_setup() {
enewgroup redsocks
enewuser redsocks -1 -1 /run/redsocks redsocks
}
RDEPEND="
${DEPEND}
acct-group/redsocks
acct-user/redsocks
net-firewall/iptables
"
src_compile() {
CC="$(tc-getCC)" emake
@@ -42,7 +40,7 @@ src_install() {
insinto /etc
newins debian/redsocks.conf redsocks.conf
newinitd "${FILESDIR}"/redsocks.init redsocks
newinitd "${FILESDIR}"/redsocks.init-r2 redsocks
newconfd "${FILESDIR}"/redsocks.conf redsocks
systemd_dounit "${FILESDIR}"/redsocks.service