summaryrefslogtreecommitdiff
path: root/community/stunnel
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2011-12-27 23:14:54 +0000
committerroot <root@rshg054.dnsready.net>2011-12-27 23:14:54 +0000
commitb3288f94e625603d6b5b23740b721287e75eead7 (patch)
treeeff707b86ebe69b25cbd9f7b6549e7d8d76f4e46 /community/stunnel
parent342100843ef3e4379443c526403fac1b1cb6416a (diff)
Tue Dec 27 23:14:54 UTC 2011
Diffstat (limited to 'community/stunnel')
-rw-r--r--community/stunnel/PKGBUILD18
-rw-r--r--community/stunnel/stunnel.install32
-rw-r--r--community/stunnel/stunnel.rc.d30
-rw-r--r--community/stunnel/stunnel.tmpfiles.conf1
4 files changed, 47 insertions, 34 deletions
diff --git a/community/stunnel/PKGBUILD b/community/stunnel/PKGBUILD
index 17296a913..a501645fb 100644
--- a/community/stunnel/PKGBUILD
+++ b/community/stunnel/PKGBUILD
@@ -1,11 +1,11 @@
-# $Id: PKGBUILD 60289 2011-12-08 23:55:42Z lfleischer $
+# $Id: PKGBUILD 61258 2011-12-26 17:36:12Z dreisner $
# Maintainer: Kaiting Chen <kaitocracy@gmail.com>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>
# Contributor: Kevin Piche <kevin@archlinux.org>
pkgname=stunnel
pkgver=4.50
-pkgrel=1
+pkgrel=3
pkgdesc="A program that allows you to encrypt arbitrary TCP connections inside SSL"
arch=('i686' 'x86_64')
url="http://www.stunnel.org"
@@ -15,11 +15,14 @@ install=$pkgname.install
options=('!libtool')
source=("ftp://ftp.stunnel.org/stunnel/$pkgname-$pkgver.tar.gz"{,.asc}
'Makefile.patch'
- 'stunnel.rc.d')
+ 'stunnel.rc.d'
+ 'stunnel.tmpfiles.conf')
+
md5sums=('d68b4565294496a8bdf23c728a679f53'
'ea9e85daef0cc96ce21649901b3514f7'
'f15398497e10e080c2406d2fc541660c'
- 'cb647c71ff4cb1e035b6e515d5f13ebf')
+ 'cb647c71ff4cb1e035b6e515d5f13ebf'
+ '2e065a39998e57727ee79887bbd1751e')
build() {
cd "$srcdir/$pkgname-$pkgver"
@@ -46,9 +49,14 @@ package() {
install -Dm644 tools/stunnel.cnf "$pkgdir/etc/stunnel/stunnel.cnf"
install -Dm755 "$srcdir/stunnel.rc.d" "$pkgdir/etc/rc.d/stunnel"
+ install -Dm644 "$srcdir/stunnel.tmpfiles.conf" "$pkgdir/usr/lib/tmpfiles.d/stunnel.conf"
+
+ # move systemd service into place
+ install -dm755 "$pkgdir/lib/systemd/system"
+ mv "tools/stunnel.service" "$pkgdir/lib/systemd/system/"
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" \
+ -e "s:no\(body\|group\):stunnel:g" \
-i "$pkgdir/etc/stunnel/stunnel.conf-sample"
}
diff --git a/community/stunnel/stunnel.install b/community/stunnel/stunnel.install
index f7bbbffcb..d9998e4da 100644
--- a/community/stunnel/stunnel.install
+++ b/community/stunnel/stunnel.install
@@ -1,35 +1,31 @@
post_install() {
# add stunnel group
- if [ ! `grep stunnel /etc/group` ]; then
- groupadd -g 16 stunnel &>/dev/null
+ if ! getent group stunnel >/dev/null 2>&1; then
+ groupadd -g 16 stunnel
fi
# add stunnel user
- id stunnel &>/dev/null || \
+ if ! getent passwd stunnel >/dev/null 2>&1; then
useradd -u 16 -g stunnel -d /var/run/stunnel -s /bin/false stunnel
-
+ fi
+
# create chroot dir if necessary.
if [ ! -d /var/run/stunnel ]; then
- install -d -m 770 -o stunnel -g stunnel /var/run/stunnel
+ install -dm770 -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
+ post_install "$@"
}
pre_remove() {
# remove users & groups
- userdel stunnel &> /dev/null
- groupdel stunnel &> /dev/null
- rm -rf /var/run/stunnel
+ if getent passwd stunnel >/dev/null 2>&1; then
+ userdel stunnel
+ fi
+
+ if getent group stunnel >/dev/null 2>&1; then
+ groupdel stunnel
+ fi
}
diff --git a/community/stunnel/stunnel.rc.d b/community/stunnel/stunnel.rc.d
index 15816abe8..ee67e20ce 100644
--- a/community/stunnel/stunnel.rc.d
+++ b/community/stunnel/stunnel.rc.d
@@ -3,26 +3,35 @@
. /etc/rc.conf
. /etc/rc.d/functions
-PID=`pidof -o %PPID /usr/bin/stunnel`
+pidfile=/var/run/stunnel.pid
+if [[ -r $pidfile ]]; then
+ read -r PID < "$pidfile"
+ if [[ $PID && ! -d /proc/$PID ]]; then
+ # stale pidfile
+ unset PID
+ rm -f "$pidfile"
+ fi
+fi
+
case "$1" in
start)
stat_busy "Starting stunnel"
- [ -z "$PID" ] && /usr/bin/stunnel
- if [ $? -gt 0 ]; then
- stat_fail
- else
+ if [[ -z $PID ]] && /usr/bin/stunnel; then
add_daemon stunnel
stat_done
+ else
+ stat_fail
+ exit 1
fi
;;
stop)
stat_busy "Stopping stunnel"
- [ ! -z "$PID" ] && kill $PID &> /dev/null
- if [ $? -gt 0 ]; then
- stat_fail
- else
+ if [[ $PID ]] && kill $PID &>/dev/null; then
rm_daemon stunnel
stat_done
+ else
+ stat_fail
+ exit 1
fi
;;
restart)
@@ -31,6 +40,5 @@ case "$1" in
$0 start
;;
*)
- echo "usage: $0 {start|stop|restart}"
+ echo "usage: $0 {start|stop|restart}"
esac
-exit 0
diff --git a/community/stunnel/stunnel.tmpfiles.conf b/community/stunnel/stunnel.tmpfiles.conf
new file mode 100644
index 000000000..f118e68a0
--- /dev/null
+++ b/community/stunnel/stunnel.tmpfiles.conf
@@ -0,0 +1 @@
+d /var/run/stunnel 0770 stunnel stunnel -