Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-misc/stunnel/, net-misc/stunnel/files/
Date: Wed, 06 Jul 2016 11:18:41
Message-Id: 1467804044.75e8a84bc6a37d5dc5752e3eac0ca667566d165a.blueness@gentoo
1 commit: 75e8a84bc6a37d5dc5752e3eac0ca667566d165a
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jul 6 11:20:44 2016 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Wed Jul 6 11:20:44 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=75e8a84b
7
8 net-misc/stunnel: reload configuration using HUP, bug #588054
9
10 Package-Manager: portage-2.2.28
11
12 net-misc/stunnel/files/stunnel-r1 | 51 ++++++++++++++++++
13 net-misc/stunnel/stunnel-5.34-r1.ebuild | 93 +++++++++++++++++++++++++++++++++
14 2 files changed, 144 insertions(+)
15
16 diff --git a/net-misc/stunnel/files/stunnel-r1 b/net-misc/stunnel/files/stunnel-r1
17 new file mode 100644
18 index 0000000..e7eee32
19 --- /dev/null
20 +++ b/net-misc/stunnel/files/stunnel-r1
21 @@ -0,0 +1,51 @@
22 +#!/sbin/openrc-run
23 +# Copyright 1999-2014 Gentoo Foundation
24 +# Distributed under the terms of the GNU General Public License v2
25 +# $Id$
26 +
27 +extra_started_commands="reload"
28 +SERVICENAME=${SVCNAME#*.}
29 +SERVICENAME=${SERVICENAME:-stunnel}
30 +STUNNEL_CONFIGFILE=${STUNNEL_CONFIGFILE:-/etc/stunnel/${SERVICENAME}.conf}
31 +
32 +depend() {
33 + need net
34 + before logger
35 +}
36 +
37 +get_config() {
38 + if [ ! -e ${STUNNEL_CONFIGFILE} ] ; then
39 + eerror "You need to create ${STUNNEL_CONFIGFILE} first."
40 + return 1
41 + fi
42 + CHROOT=$(grep "^chroot" ${STUNNEL_CONFIGFILE} | sed "s;.*= *;;")
43 + [ -n "${CHROOT}" ] && CHROOT="--chroot ${CHROOT}"
44 + PIDFILE=$(grep "^pid" ${STUNNEL_CONFIGFILE} | sed "s;.*= *;;")
45 + PIDFILE=${PIDFILE:-/run/stunnel/${SERVICENAME}.pid}
46 +}
47 +
48 +start() {
49 + get_config || return 1
50 + checkpath -d -m 0775 -o root:stunnel /run/stunnel
51 + if [ "$(dirname ${PIDFILE})" != "/run" ]; then
52 + checkpath -d -m 0755 -o stunnel:stunnel -q $(dirname ${PIDFILE})
53 + fi
54 + ebegin "Starting ${SVCNAME}"
55 + start-stop-daemon --start --pidfile "${PIDFILE}" ${CHROOT} \
56 + --exec /usr/bin/stunnel -- ${STUNNEL_CONFIGFILE} ${STUNNEL_OPTIONS}
57 + eend $? "Failed to start ${SVCNAME}"
58 +}
59 +
60 +stop() {
61 + get_config || return 1
62 + ebegin "Stopping ${SVCNAME}"
63 + start-stop-daemon --stop --quiet --pidfile ${PIDFILE}
64 + eend $? "Failed to stop ${SVCNAME}"
65 +}
66 +
67 +reload() {
68 + get_config || return 1
69 + ebegin "Reloading ${SVCNAME}"
70 + start-stop-daemon --signal HUP --pidfile ${PIDFILE} --name stunnel
71 + eend $?
72 +}
73
74 diff --git a/net-misc/stunnel/stunnel-5.34-r1.ebuild b/net-misc/stunnel/stunnel-5.34-r1.ebuild
75 new file mode 100644
76 index 0000000..53ee300
77 --- /dev/null
78 +++ b/net-misc/stunnel/stunnel-5.34-r1.ebuild
79 @@ -0,0 +1,93 @@
80 +# Copyright 1999-2016 Gentoo Foundation
81 +# Distributed under the terms of the GNU General Public License v2
82 +# $Id$
83 +
84 +EAPI="5"
85 +
86 +inherit ssl-cert eutils multilib systemd user
87 +
88 +DESCRIPTION="TLS/SSL - Port Wrapper"
89 +HOMEPAGE="http://www.stunnel.org/index.html"
90 +SRC_URI="ftp://ftp.stunnel.org/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
91 + http://www.usenix.org.uk/mirrors/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
92 + http://ftp.nluug.nl/pub/networking/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
93 + http://www.namesdir.com/mirrors/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
94 + http://stunnel.cybermirror.org/archive/${PV%%.*}.x/${P}.tar.gz
95 + http://mirrors.zerg.biz/stunnel/archive/${PV%%.*}.x/${P}.tar.gz
96 + ftp://mirrors.go-parts.com/stunnel/archive/${PV%%.*}.x/${P}.tar.gz"
97 +
98 +LICENSE="GPL-2"
99 +SLOT="0"
100 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x86-macos"
101 +IUSE="ipv6 libressl selinux stunnel3 tcpd"
102 +
103 +DEPEND="tcpd? ( sys-apps/tcp-wrappers )
104 + !libressl? ( dev-libs/openssl:0 )
105 + libressl? ( dev-libs/libressl )"
106 +RDEPEND="${DEPEND}
107 + stunnel3? ( dev-lang/perl )
108 + selinux? ( sec-policy/selinux-stunnel )"
109 +
110 +RESTRICT="test"
111 +
112 +pkg_setup() {
113 + enewgroup stunnel
114 + enewuser stunnel -1 -1 -1 stunnel
115 +}
116 +
117 +src_prepare() {
118 + # Hack away generation of certificate
119 + sed -i -e "s/^install-data-local:/do-not-run-this:/" \
120 + tools/Makefile.in || die "sed failed"
121 +
122 + # libressl compat
123 + epatch "${FILESDIR}"/stunnel-compat-libressl.patch
124 +
125 + echo "CONFIG_PROTECT=\"/etc/stunnel/stunnel.conf\"" > "${T}"/20stunnel
126 +}
127 +
128 +src_configure() {
129 + econf \
130 + --libdir="${EPREFIX}/usr/$(get_libdir)" \
131 + $(use_enable ipv6) \
132 + $(use_enable tcpd libwrap) \
133 + --with-ssl="${EPREFIX}"/usr \
134 + --disable-fips
135 +}
136 +
137 +src_install() {
138 + emake DESTDIR="${D}" install
139 + rm -rf "${ED}"/usr/share/doc/${PN}
140 + rm -f "${ED}"/etc/stunnel/stunnel.conf-sample \
141 + "${ED}"/usr/share/man/man8/stunnel.{fr,pl}.8
142 + use stunnel3 || rm -f "${ED}"/usr/bin/stunnel3
143 +
144 + # The binary was moved to /usr/bin with 4.21,
145 + # symlink for backwards compatibility
146 + dosym ../bin/stunnel /usr/sbin/stunnel
147 +
148 + dodoc AUTHORS BUGS CREDITS PORTS README TODO ChangeLog
149 + dohtml doc/stunnel.html doc/en/VNC_StunnelHOWTO.html tools/ca.html \
150 + tools/importCA.html
151 +
152 + insinto /etc/stunnel
153 + doins "${FILESDIR}"/stunnel.conf
154 + newinitd "${FILESDIR}"/stunnel-r1 stunnel
155 +
156 + doenvd "${T}"/20stunnel
157 +
158 + systemd_dounit "${S}/tools/stunnel.service"
159 + systemd_newtmpfilesd "${FILESDIR}"/stunnel.tmpfiles.conf stunnel.conf
160 +}
161 +
162 +pkg_postinst() {
163 + if [ ! -f "${EROOT}"/etc/stunnel/stunnel.key ]; then
164 + install_cert /etc/stunnel/stunnel
165 + chown stunnel:stunnel "${EROOT}"/etc/stunnel/stunnel.{crt,csr,key,pem}
166 + chmod 0640 "${EROOT}"/etc/stunnel/stunnel.{crt,csr,key,pem}
167 + fi
168 +
169 + einfo "If you want to run multiple instances of stunnel, create a new config"
170 + einfo "file ending with .conf in /etc/stunnel/. **Make sure** you change "
171 + einfo "\'pid= \' with a unique filename."
172 +}