Gentoo Archives: gentoo-commits

From: Matt Turner <mattst88@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-proxy/redsocks/, net-proxy/redsocks/files/
Date: Sat, 08 Feb 2020 17:40:45
Message-Id: 1581183614.8d1fbcd0b68cb2af1ce4491604b7f64d3d12deb2.mattst88@gentoo
1 commit: 8d1fbcd0b68cb2af1ce4491604b7f64d3d12deb2
2 Author: Quentin Retornaz <gentoo <AT> retornaz <DOT> com>
3 AuthorDate: Thu Feb 6 01:19:51 2020 +0000
4 Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 8 17:40:14 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8d1fbcd0
7
8 net-proxy/redsocks: fix command args in initd
9
10 Closes: https://bugs.gentoo.org/708438
11 Closes: https://github.com/gentoo/gentoo/pull/14575
12 Signed-off-by: Quentin Retornaz <gentoo <AT> retornaz.com>
13 Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
14
15 net-proxy/redsocks/files/redsocks.init-r1 | 43 +++++++++++++++++++++++++++
16 net-proxy/redsocks/redsocks-0.5-r1.ebuild | 49 +++++++++++++++++++++++++++++++
17 2 files changed, 92 insertions(+)
18
19 diff --git a/net-proxy/redsocks/files/redsocks.init-r1 b/net-proxy/redsocks/files/redsocks.init-r1
20 new file mode 100644
21 index 00000000000..861054fc914
22 --- /dev/null
23 +++ b/net-proxy/redsocks/files/redsocks.init-r1
24 @@ -0,0 +1,43 @@
25 +#!/sbin/openrc-run
26 +# Copyright 1999-2020 Gentoo Authors
27 +# Distributed under the terms of the GNU General Public License v2
28 +
29 +command=${REDSOCKS_BINARY:=/usr/sbin/redsocks}
30 +: ${REDSOCKS_CONFIG:=/etc/redsocks.conf}
31 +pidfile=${REDSOCKS_PIDFILE:=/run/redsocks/redsocks.pid}
32 +command_args="-p ${pidfile} -c ${REDSOCKS_CONFIG}"
33 +
34 +extra_commands="checkconfig"
35 +extra_started_commands="reload"
36 +
37 +depend() {
38 + need localmount
39 + use dns
40 +}
41 +
42 +checkconfig() {
43 + if [ ! -f "${REDSOCKS_CONFIG}" ] ; then
44 + eerror "No ${REDSOCKS_CONFIG} file exists!"
45 + return 1
46 + fi
47 +
48 + "${command}" -t -c ${REDSOCKS_CONFIG} || return 1
49 +}
50 +
51 +start_pre() {
52 + checkconfig || return 1
53 +}
54 +
55 +stop_pre() {
56 + if [ "${RC_CMD}" = "restart" ] ; then
57 + checkconfig || return 1
58 + fi
59 +}
60 +
61 +reload() {
62 + checkconfig || return 1
63 +
64 + ebegin "Reloading ${SVCNAME}"
65 + start-stop-daemon --signal HUP --pidfile "${pidfile}"
66 + eend $?
67 +}
68
69 diff --git a/net-proxy/redsocks/redsocks-0.5-r1.ebuild b/net-proxy/redsocks/redsocks-0.5-r1.ebuild
70 new file mode 100644
71 index 00000000000..665f5a70002
72 --- /dev/null
73 +++ b/net-proxy/redsocks/redsocks-0.5-r1.ebuild
74 @@ -0,0 +1,49 @@
75 +# Copyright 1999-2020 Gentoo Authors
76 +# Distributed under the terms of the GNU General Public License v2
77 +
78 +EAPI=6
79 +
80 +if [[ ${PV} != *9999* ]]; then
81 + SRC_URI="https://github.com/darkk/${PN}/archive/release-${PV}.tar.gz -> ${P}.tar.gz"
82 + KEYWORDS="~amd64 ~x86"
83 +else
84 + GIT_ECLASS="git-r3"
85 + EGIT_REPO_URI="https://github.com/darkk/${PN}.git"
86 +fi
87 +
88 +inherit systemd toolchain-funcs user ${GIT_ECLASS}
89 +
90 +DESCRIPTION="Transparent redirector of any TCP connection to proxy"
91 +HOMEPAGE="http://darkk.net.ru/redsocks/"
92 +LICENSE="Apache-2.0 LGPL-2.1+ ZLIB"
93 +SLOT="0"
94 +IUSE="doc"
95 +RESTRICT="test"
96 +
97 +DEPEND="dev-libs/libevent:0="
98 +RDEPEND="${DEPEND}
99 + net-firewall/iptables"
100 +
101 +[[ ${PV} != *9999 ]] && S="${WORKDIR}"/"${PN}"-release-"${PV}"
102 +
103 +pkg_setup() {
104 + enewgroup redsocks
105 + enewuser redsocks -1 -1 /run/redsocks redsocks
106 +}
107 +
108 +src_compile() {
109 + CC="$(tc-getCC)" emake
110 +}
111 +
112 +src_install() {
113 + dosbin redsocks
114 + doman debian/redsocks.8
115 + use doc && dodoc README doc/*
116 + insinto /etc
117 + newins debian/redsocks.conf redsocks.conf
118 +
119 + newinitd "${FILESDIR}"/redsocks.init-r1 redsocks
120 + newconfd "${FILESDIR}"/redsocks.conf redsocks
121 +
122 + systemd_dounit "${FILESDIR}"/redsocks.service
123 +}