[arch-commits] Commit in lighttpd/trunk (PKGBUILD lighttpd.logrotate.d lighttpd.rc.d)
Pierre Schmitz
pierre at archlinux.org
Mon Aug 30 07:08:32 UTC 2010
Date: Monday, August 30, 2010 @ 03:08:32
Author: pierre
Revision: 89199
Make rc-script more robust
Modified:
lighttpd/trunk/PKGBUILD
lighttpd/trunk/lighttpd.logrotate.d
lighttpd/trunk/lighttpd.rc.d
----------------------+
PKGBUILD | 6 ++---
lighttpd.logrotate.d | 1
lighttpd.rc.d | 52 +++++++++++++++++++++++++++++++++----------------
3 files changed, 40 insertions(+), 19 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2010-08-30 06:15:33 UTC (rev 89198)
+++ PKGBUILD 2010-08-30 07:08:32 UTC (rev 89199)
@@ -3,7 +3,7 @@
pkgname=lighttpd
pkgver=1.4.28
-pkgrel=1
+pkgrel=2
pkgdesc='a secure, fast, compliant and very flexible web-server'
license=('custom')
arch=('i686' 'x86_64')
@@ -19,8 +19,8 @@
source=("http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-${pkgver}.tar.bz2"
'lighttpd.rc.d' 'lighttpd.logrotate.d' 'lighttpd.conf')
md5sums=('586eb535d31ac299652495b058dd87c4'
- '953fe1f6ed9064bfeaf2f05e8b908ed8'
- '4b22edb80454cd815f076288aa117452'
+ '701141f42df90097bbfc5c7f1f63beb9'
+ '913e2157fa78d990c32146f387d44c2b'
'2803a9ee7f20409c69f1566d2d90720e')
build() {
Modified: lighttpd.logrotate.d
===================================================================
--- lighttpd.logrotate.d 2010-08-30 06:15:33 UTC (rev 89198)
+++ lighttpd.logrotate.d 2010-08-30 07:08:32 UTC (rev 89199)
@@ -1,4 +1,5 @@
/var/log/lighttpd/*log {
+ missingok
postrotate
/etc/rc.d/lighttpd reload >/dev/null || true
endscript
Modified: lighttpd.rc.d
===================================================================
--- lighttpd.rc.d 2010-08-30 06:15:33 UTC (rev 89198)
+++ lighttpd.rc.d 2010-08-30 07:08:32 UTC (rev 89199)
@@ -11,41 +11,63 @@
get_pid() {
local pid_file=$(get_pid_file)
local pid=$(pidof -o %PPID lighttpd-angel)
+ # only needed when updating from 1.4.26
+ # TODO: remove in future versions
+ local old_pid=$(pidof -o %PPID lighttpd)
if [ -r "${pid_file}" ]; then
cat "${pid_file}"
elif [ -n "${pid}" ]; then
echo "${pid}"
+ elif [ -n "${old_pid}" ]; then
+ echo "${old_pid}"
else
echo ''
fi
}
test_config() {
+ stat_busy 'Checking configuration'
+ if [ $(id -u) -ne 0 ]; then
+ stat_append '(This script must be run as root)'
+ stat_die
+ fi
+
+ if [ ! -r /etc/lighttpd/lighttpd.conf ]; then
+ stat_append '(/etc/lighttpd/lighttpd.conf not found)'
+ stat_die
+ fi
+
+ local d
+ for d in /var/{run,log,cache}/lighttpd; do
+ if [ ! -d $d ]; then
+ stat_append "(directory $d not found)"
+ stat_die
+ fi
+ done
+
/usr/sbin/lighttpd -t -f /etc/lighttpd/lighttpd.conf >/dev/null 2>&1
if [ $? -gt 0 ]; then
- stat_append ' (error in lighttpd.conf)'
- stat_fail
- exit 1
+ stat_append '(error in /etc/lighttpd/lighttpd.conf)'
+ stat_die
fi
+
+ stat_done
}
start() {
stat_busy 'Starting lighttpd'
- test_config
local PID=$(get_pid)
if [ -z "$PID" ]; then
nohup /usr/sbin/lighttpd-angel -D -f /etc/lighttpd/lighttpd.conf >>/var/log/lighttpd/lighttpd-angel.log 2>&1 &
if [ $? -gt 0 ]; then
- stat_fail
- exit 1
+ stat_die
else
add_daemon lighttpd
stat_done
fi
else
- stat_fail
- exit 1
+ stat_die
fi
}
@@ -54,8 +76,7 @@
local PID=$(get_pid)
[ -n "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
- stat_fail
- exit 1
+ stat_die
else
local pid_file=$(get_pid_file)
[ -f "${pid_file}" ] && rm -f "${pid_file}"
@@ -66,12 +87,10 @@
reload() {
stat_busy 'Reloading lighttpd'
- test_config
local PID=$(get_pid)
[ -n "$PID" ] && kill -HUP $PID &> /dev/null
if [ $? -gt 0 ]; then
- stat_fail
- exit 1
+ stat_die
else
stat_done
fi
@@ -80,23 +99,24 @@
case "$1" in
start)
+ test_config
start
;;
stop)
+ test_config
stop
;;
reload)
+ test_config
reload
;;
restart)
- stat_busy 'Checking lighttpd.conf'
test_config
- stat_done
stop
start
;;
status)
- stat_busy 'Checking lighttpd status';
+ stat_busy 'Checking lighttpd status'
ck_status lighttpd
;;
*)
More information about the arch-commits
mailing list