summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Albertson <ramereth@gentoo.org>2012-05-13 21:08:13 +0000
committerLance Albertson <ramereth@gentoo.org>2012-05-13 21:08:13 +0000
commit85054b9113a358a9531746f6c925074d3929072d (patch)
tree4af484f7a44715c9bff2808f18debd15eed2303e /net-misc/stunnel
parentunmask avahi related masks (diff)
downloadgentoo-2-85054b9113a358a9531746f6c925074d3929072d.tar.gz
gentoo-2-85054b9113a358a9531746f6c925074d3929072d.tar.bz2
gentoo-2-85054b9113a358a9531746f6c925074d3929072d.zip
Simplify init script to use start-stop-daemon; fixes #379673
(Portage version: 2.1.10.49/cvs/Linux x86_64)
Diffstat (limited to 'net-misc/stunnel')
-rw-r--r--net-misc/stunnel/ChangeLog14
-rw-r--r--net-misc/stunnel/files/stunnel.initd-start-stop-daemon39
-rw-r--r--net-misc/stunnel/stunnel-4.44-r1.ebuild75
3 files changed, 126 insertions, 2 deletions
diff --git a/net-misc/stunnel/ChangeLog b/net-misc/stunnel/ChangeLog
index cee7c8f120a9..8c1b590f16a9 100644
--- a/net-misc/stunnel/ChangeLog
+++ b/net-misc/stunnel/ChangeLog
@@ -1,6 +1,16 @@
# ChangeLog for net-misc/stunnel
-# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/stunnel/ChangeLog,v 1.128 2011/10/29 18:55:27 armin76 Exp $
+# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/stunnel/ChangeLog,v 1.129 2012/05/13 21:08:13 ramereth Exp $
+
+*stunnel-4.44-r1 (13 May 2012)
+
+ 13 May 2012; Lance Albertson <ramereth@gentoo.org> +stunnel-4.44-r1.ebuild,
+ +files/stunnel.initd-start-stop-daemon:
+ Simplify init script to use start-stop-daemon; fixes #379673
+
+ Without using start-stop-daemon the init script has no idea if stunnel has
+ crashed. Thanks to Marcel Pennewiß <gentoo@pennewiss.de> for submitting the
+ init script.
29 Oct 2011; Raúl Porcel <armin76@gentoo.org> stunnel-4.44.ebuild:
alpha/ia64/s390/sparc stable wrt #379859
diff --git a/net-misc/stunnel/files/stunnel.initd-start-stop-daemon b/net-misc/stunnel/files/stunnel.initd-start-stop-daemon
new file mode 100644
index 000000000000..051f7022aab3
--- /dev/null
+++ b/net-misc/stunnel/files/stunnel.initd-start-stop-daemon
@@ -0,0 +1,39 @@
+#!/sbin/runscript
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/stunnel/files/stunnel.initd-start-stop-daemon,v 1.1 2012/05/13 21:08:13 ramereth Exp $
+
+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:-/var/run/stunnel/${SERVICENAME}.pid}
+}
+
+start() {
+ get_config || return 1
+ 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 --pidfile ${PIDFILE}
+ eend $? "Failed to stop ${SVCNAME}"
+}
diff --git a/net-misc/stunnel/stunnel-4.44-r1.ebuild b/net-misc/stunnel/stunnel-4.44-r1.ebuild
new file mode 100644
index 000000000000..23ec1e5a12c8
--- /dev/null
+++ b/net-misc/stunnel/stunnel-4.44-r1.ebuild
@@ -0,0 +1,75 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/stunnel/stunnel-4.44-r1.ebuild,v 1.1 2012/05/13 21:08:13 ramereth Exp $
+
+EAPI="2"
+
+inherit autotools ssl-cert eutils
+
+DESCRIPTION="TLS/SSL - Port Wrapper"
+HOMEPAGE="http://stunnel.mirt.net/"
+SRC_URI="ftp://ftp.stunnel.org/stunnel/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86"
+IUSE="ipv6 selinux tcpd xforward listen-queue"
+
+DEPEND="tcpd? ( sys-apps/tcp-wrappers )
+ >=dev-libs/openssl-0.9.8k"
+RDEPEND="${DEPEND}
+ selinux? ( sec-policy/selinux-stunnel )"
+
+pkg_setup() {
+ enewgroup stunnel
+ enewuser stunnel -1 -1 -1 stunnel
+}
+
+src_prepare() {
+ use xforward && epatch "${FILESDIR}/stunnel-4.44-xforwarded-for.diff"
+ use listen-queue && epatch "${FILESDIR}/stunnel-4.44-listen-queue.diff"
+ eautoreconf
+
+ # Hack away generation of certificate
+ sed -i -e "s/^install-data-local:/do-not-run-this:/" \
+ tools/Makefile.in || die "sed failed"
+}
+
+src_configure() {
+ econf $(use_enable ipv6) \
+ $(use_enable tcpd libwrap) || die "econf died"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake install failed"
+ rm -rf "${D}"/usr/share/doc/${PN}
+ rm -f "${D}"/etc/stunnel/stunnel.conf-sample "${D}"/usr/bin/stunnel3 \
+ "${D}"/usr/share/man/man8/stunnel.{fr,pl}.8
+
+ # The binary was moved to /usr/bin with 4.21,
+ # symlink for backwards compatibility
+ dosym ../bin/stunnel /usr/sbin/stunnel
+
+ dodoc AUTHORS BUGS CREDITS PORTS README TODO ChangeLog
+ dohtml doc/stunnel.html doc/en/VNC_StunnelHOWTO.html tools/ca.html \
+ tools/importCA.html
+
+ insinto /etc/stunnel
+ doins "${FILESDIR}"/stunnel.conf
+ newinitd "${FILESDIR}"/stunnel.initd-start-stop-daemon stunnel
+
+ keepdir /var/run/stunnel
+ fowners stunnel:stunnel /var/run/stunnel
+}
+
+pkg_postinst() {
+ if [ ! -f "${ROOT}"/etc/stunnel/stunnel.key ]; then
+ install_cert /etc/stunnel/stunnel
+ chown stunnel:stunnel "${ROOT}"/etc/stunnel/stunnel.{crt,csr,key,pem}
+ chmod 0640 "${ROOT}"/etc/stunnel/stunnel.{crt,csr,key,pem}
+ fi
+
+ einfo "If you want to run multiple instances of stunnel, create a new config"
+ einfo "file ending with .conf in /etc/stunnel/. **Make sure** you change "
+ einfo "\'pid= \' with a unique filename."
+}