summaryrefslogtreecommitdiff
path: root/community/stunnel
diff options
context:
space:
mode:
Diffstat (limited to 'community/stunnel')
-rw-r--r--community/stunnel/Makefile.patch21
-rw-r--r--community/stunnel/PKGBUILD47
-rw-r--r--community/stunnel/stunnel.install35
-rw-r--r--community/stunnel/stunnel.rc.d36
4 files changed, 139 insertions, 0 deletions
diff --git a/community/stunnel/Makefile.patch b/community/stunnel/Makefile.patch
new file mode 100644
index 000000000..27be911d6
--- /dev/null
+++ b/community/stunnel/Makefile.patch
@@ -0,0 +1,21 @@
+--- tools/Makefile.in 2010-03-31 04:45:09.000000000 -0500
++++ tools/Makefile.in 2010-04-11 17:17:41.000000000 -0500
+@@ -334,8 +334,7 @@
+
+ info-am:
+
+-install-data-am: install-confDATA install-data-local \
+- install-examplesDATA
++install-data-am: install-confDATA install-examplesDATA
+
+ install-dvi: install-dvi-am
+
+@@ -377,7 +376,7 @@
+ clean-local distclean distclean-generic distclean-libtool \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-confDATA install-data install-data-am \
+- install-data-local install-dvi install-dvi-am \
++ install-dvi install-dvi-am \
+ install-examplesDATA install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
diff --git a/community/stunnel/PKGBUILD b/community/stunnel/PKGBUILD
new file mode 100644
index 000000000..f617a4f3e
--- /dev/null
+++ b/community/stunnel/PKGBUILD
@@ -0,0 +1,47 @@
+# $Id: PKGBUILD 43034 2011-03-23 21:42:21Z kchen $
+# Maintainer: Kaiting Chen <kaitocracy@gmail.com>
+# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
+# Contributor: Kevin Piche <kevin@archlinux.org>
+
+pkgname=stunnel
+pkgver=4.35
+pkgrel=1
+pkgdesc="A program that allows you to encrypt arbitrary TCP connections inside SSL"
+arch=('i686' 'x86_64')
+url="http://www.stunnel.org"
+license=('GPL')
+depends=('openssl' 'tcp_wrappers')
+install=stunnel.install
+options=('!libtool')
+source=("ftp://ftp.stunnel.org/stunnel/$pkgname-$pkgver.tar.gz"
+ 'Makefile.patch' 'stunnel.rc.d')
+md5sums=('2c8e153caee9d954fb7d00980968b50d'
+ 'f15398497e10e080c2406d2fc541660c'
+ 'cb647c71ff4cb1e035b6e515d5f13ebf')
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ # don't create a certificate...
+ patch -p0 < $srcdir/Makefile.patch
+
+ ./configure --prefix=/usr \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --enable-ipv6
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR=$pkgdir install
+
+ for i in ca.pl importCA.sh; do
+ install -Dm755 tools/$i $pkgdir/usr/share/stunnel/$i
+ done
+ install -Dm755 $srcdir/stunnel.rc.d $pkgdir/etc/rc.d/stunnel
+ sed -e "s:/usr/var/lib/stunnel/:/var/run/stunnel:g" \
+ -e "s:/usr/etc/stunnel/:/etc/stunnel/:g" \
+ -e "s:nobody:stunnel:g" -e "s:nogroup:stunnel:g" \
+ -i ${pkgdir}/etc/stunnel/stunnel.conf-sample
+ install -Dm644 tools/stunnel.cnf $pkgdir/etc/stunnel/stunnel.cnf
+}
diff --git a/community/stunnel/stunnel.install b/community/stunnel/stunnel.install
new file mode 100644
index 000000000..f7bbbffcb
--- /dev/null
+++ b/community/stunnel/stunnel.install
@@ -0,0 +1,35 @@
+post_install() {
+ # add stunnel group
+ if [ ! `grep stunnel /etc/group` ]; then
+ groupadd -g 16 stunnel &>/dev/null
+ fi
+
+ # add stunnel user
+ id stunnel &>/dev/null || \
+ useradd -u 16 -g stunnel -d /var/run/stunnel -s /bin/false stunnel
+
+ # create chroot dir if necessary.
+ if [ ! -d /var/run/stunnel ]; then
+ install -d -m 770 -o stunnel -g stunnel /var/run/stunnel
+ fi
+
+ cat << EOF
+
+NOTE
+----
+Copy /etc/stunnel/stunnel.conf-sample to /etc/stunnel/stunnel.conf
+& edit it to match your setup before invoking the daemon (/etc/rc.d/stunnel).
+
+EOF
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+pre_remove() {
+ # remove users & groups
+ userdel stunnel &> /dev/null
+ groupdel stunnel &> /dev/null
+ rm -rf /var/run/stunnel
+}
diff --git a/community/stunnel/stunnel.rc.d b/community/stunnel/stunnel.rc.d
new file mode 100644
index 000000000..15816abe8
--- /dev/null
+++ b/community/stunnel/stunnel.rc.d
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/stunnel`
+case "$1" in
+ start)
+ stat_busy "Starting stunnel"
+ [ -z "$PID" ] && /usr/bin/stunnel
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon stunnel
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping stunnel"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon stunnel
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0