[SCM] Debian packaging for apache2 branch, master, updated. debian/2.4.4-2-121-gdf90ce1
Arno Töll
arno at debian.org
Fri Jun 7 16:45:34 UTC 2013
The following commit has been merged in the master branch:
commit 2fec719c4c807c5b7dacb2df242deb090f129cc6
Author: Arno Töll <arno at debian.org>
Date: Fri Jun 7 15:50:28 2013 +0200
Fix indentation mess in the init script, make it more explicit about the return state
diff --git a/debian/apache2.init b/debian/apache2.init
index 863eff7..b7d3011 100755
--- a/debian/apache2.init
+++ b/debian/apache2.init
@@ -20,29 +20,29 @@ DAEMON=/usr/sbin/$NAME
SCRIPTNAME="${0##*/}"
SCRIPTNAME="${SCRIPTNAME##[KS][0-9][0-9]}"
if [ -n "$APACHE_CONFDIR" ] ; then
- if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
- DIR_SUFFIX="${APACHE_CONFDIR##/etc/apache2-}"
- else
- DIR_SUFFIX=
- fi
+ if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
+ DIR_SUFFIX="${APACHE_CONFDIR##/etc/apache2-}"
+ else
+ DIR_SUFFIX=
+ fi
elif [ "${SCRIPTNAME##apache2-}" != "$SCRIPTNAME" ] ; then
- DIR_SUFFIX="-${SCRIPTNAME##apache2-}"
- APACHE_CONFDIR=/etc/apache2$DIR_SUFFIX
+ DIR_SUFFIX="-${SCRIPTNAME##apache2-}"
+ APACHE_CONFDIR=/etc/apache2$DIR_SUFFIX
else
- DIR_SUFFIX=
- APACHE_CONFDIR=/etc/apache2
+ DIR_SUFFIX=
+ APACHE_CONFDIR=/etc/apache2
fi
if [ -z "$APACHE_ENVVARS" ] ; then
- APACHE_ENVVARS=$APACHE_CONFDIR/envvars
+ APACHE_ENVVARS=$APACHE_CONFDIR/envvars
fi
export APACHE_CONFDIR APACHE_ENVVARS
ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
if [ "$APACHE_CONFDIR" != /etc/apache2 ] ; then
- ENV="$ENV APACHE_CONFDIR=$APACHE_CONFDIR"
+ ENV="$ENV APACHE_CONFDIR=$APACHE_CONFDIR"
fi
if [ "$APACHE_ENVVARS" != "$APACHE_CONFDIR/envvars" ] ; then
- ENV="$ENV APACHE_ENVVARS=$APACHE_ENVVARS"
+ ENV="$ENV APACHE_ENVVARS=$APACHE_ENVVARS"
fi
@@ -56,21 +56,21 @@ HTCACHECLEAN_OPTIONS=""
APACHE_HTTPD=$(. $APACHE_ENVVARS && echo $APACHE_HTTPD)
if [ -z "$APACHE_HTTPD" ] ; then
- APACHE_HTTPD=/usr/sbin/apache2
+ APACHE_HTTPD=/usr/sbin/apache2
fi
# Read configuration variable file if it is present
if [ -f /etc/default/apache2$DIR_SUFFIX ] ; then
- . /etc/default/apache2$DIR_SUFFIX
+ . /etc/default/apache2$DIR_SUFFIX
elif [ -f /etc/default/apache2 ] ; then
- . /etc/default/apache2
+ . /etc/default/apache2
fi
PIDFILE=$(. $APACHE_ENVVARS && echo $APACHE_PID_FILE)
VERBOSE=no
if [ -f /etc/default/rcS ]; then
- . /etc/default/rcS
+ . /etc/default/rcS
fi
. /lib/lsb/init-functions
@@ -83,44 +83,44 @@ APACHE2_INIT_MESSAGE=""
apache_wait_start() {
- local STATUS=$1
- local i=0
- while : ; do
- PIDTMP=$(pidofproc -p $PIDFILE $DAEMON)
- if [ -n "${PIDTMP:-}" ] && kill -0 "${PIDTMP:-}" 2> /dev/null; then
- return $STATUS
- fi
-
- if [ $i = "20" ] ; then
- APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX instance did not start within 20 seconds. Please read the log files to discover problems"
- return 2
- fi
-
- [ "$VERBOSE" != no ] && log_progress_msg "."
- sleep 1
- i=$(($i+1))
- done
+ local STATUS=$1
+ local i=0
+ while : ; do
+ PIDTMP=$(pidofproc -p $PIDFILE $DAEMON)
+ if [ -n "${PIDTMP:-}" ] && kill -0 "${PIDTMP:-}" 2> /dev/null; then
+ return $STATUS
+ fi
+
+ if [ $i = "20" ] ; then
+ APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX instance did not start within 20 seconds. Please read the log files to discover problems"
+ return 2
+ fi
+
+ [ "$VERBOSE" != no ] && log_progress_msg "."
+ sleep 1
+ i=$(($i+1))
+ done
}
apache_wait_stop() {
- local STATUS=$1
-
- PIDTMP=$(pidofproc -p $PIDFILE $DAEMON)
- if [ -n "${PIDTMP:-}" ] && kill -0 "${PIDTMP:-}" 2> /dev/null; then
- local i=0
- while kill -0 "${PIDTMP:-}" 2> /dev/null; do
- if [ $i = '60' ]; then
- break
- STATUS=2
- fi
- [ "$VERBOSE" != no ] && log_progress_msg "."
- sleep 1
- i=$(($i+1))
- done
- return $STATUS
- else
- return $STATUS
- fi
+ local STATUS=$1
+
+ PIDTMP=$(pidofproc -p $PIDFILE $DAEMON)
+ if [ -n "${PIDTMP:-}" ] && kill -0 "${PIDTMP:-}" 2> /dev/null; then
+ local i=0
+ while kill -0 "${PIDTMP:-}" 2> /dev/null; do
+ if [ $i = '60' ]; then
+ break
+ STATUS=2
+ fi
+ [ "$VERBOSE" != no ] && log_progress_msg "."
+ sleep 1
+ i=$(($i+1))
+ done
+ return $STATUS
+ else
+ return $STATUS
+ fi
}
@@ -135,17 +135,17 @@ do_start()
# 2 if daemon could not be started
if pidofproc -p $PIDFILE "$DAEMON" > /dev/null 2>&1 ; then
- return 1
- fi
-
- if $APACHE2CTL configtest > /dev/null 2>&1; then
- $APACHE2CTL start
- apache_wait_start $?
- return $?
- else
- APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed. Please run '$APACHE2CTL configtest' manually and read the log file to discover problems"
- return 2
- fi
+ return 1
+ fi
+
+ if $APACHE2CTL configtest > /dev/null 2>&1; then
+ $APACHE2CTL start
+ apache_wait_start $?
+ return $?
+ else
+ APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed. Please run '$APACHE2CTL configtest' manually and read the log file to discover problems"
+ return 2
+ fi
}
#
@@ -159,45 +159,45 @@ do_stop()
# 2 if daemon could not be stopped
# other if a failure occurred
- # either "stop" or "graceful-stop"
- local STOP=$1
- # can't use pidofproc from LSB here
- local AP_RET=0
-
- if pidof $DAEMON > /dev/null 2>&1 ; then
- if [ -e $PIDFILE ] && pidof $DAEMON | tr ' ' '\n' | grep -w $(cat $PIDFILE) > /dev/null 2>&1 ; then
- AP_RET=2
- else
- AP_RET=1
- fi
- else
- AP_RET=0
- fi
-
- # AP_RET is:
- # 0 if Apache (whichever) is not running
- # 1 if Apache (whichever) is running
- # 2 if Apache from the PIDFILE is running
-
- if [ $AP_RET = 0 ] ; then
- return 1
- fi
-
- if [ $AP_RET = 2 ] && $APACHE2CTL configtest > /dev/null 2>&1; then
- $APACHE2CTL $STOP > /dev/null 2>&1
- apache_wait_stop $?
- return $?
- else
- if [ $AP_RET = 2 ]; then
- APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed, so we are trying to kill it manually. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!"
- killproc -p $PIDFILE $DAEMON
- apache_wait_stop $?
- return $?
- elif [ $AP_RET = 1 ] ; then
- APACHE2_INIT_MESSAGE="There are processes named 'apache2' running which do not match your pid file which are left untouched in the name of safety, Please review the situation by hand".
- return 2
- fi
- fi
+ # either "stop" or "graceful-stop"
+ local STOP=$1
+ # can't use pidofproc from LSB here
+ local AP_RET=0
+
+ if pidof $DAEMON > /dev/null 2>&1 ; then
+ if [ -e $PIDFILE ] && pidof $DAEMON | tr ' ' '\n' | grep -w $(cat $PIDFILE) > /dev/null 2>&1 ; then
+ AP_RET=2
+ else
+ AP_RET=1
+ fi
+ else
+ AP_RET=0
+ fi
+
+ # AP_RET is:
+ # 0 if Apache (whichever) is not running
+ # 1 if Apache (whichever) is running
+ # 2 if Apache from the PIDFILE is running
+
+ if [ $AP_RET = 0 ] ; then
+ return 1
+ fi
+
+ if [ $AP_RET = 2 ] && $APACHE2CTL configtest > /dev/null 2>&1; then
+ $APACHE2CTL $STOP > /dev/null 2>&1
+ apache_wait_stop $?
+ return $?
+ else
+ if [ $AP_RET = 2 ]; then
+ APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed, so we are trying to kill it manually. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!"
+ killproc -p $PIDFILE $DAEMON
+ apache_wait_stop $?
+ return $?
+ elif [ $AP_RET = 1 ] ; then
+ APACHE2_INIT_MESSAGE="There are processes named 'apache2' running which do not match your pid file which are left untouched in the name of safety, Please review the situation by hand".
+ return 2
+ fi
+ fi
}
@@ -206,38 +206,38 @@ do_stop()
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
- if $APACHE2CTL configtest > /dev/null 2>&1; then
+ if $APACHE2CTL configtest > /dev/null 2>&1; then
if ! pidofproc -p $PIDFILE "$DAEMON" > /dev/null 2>&1 ; then
- APACHE2_INIT_MESSAGE="Apache2 is not running"
- return 2
- fi
- $APACHE2CTL graceful > /dev/null 2>&1
- return $?
- else
- APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed. Not doing anything."
- return 0
- fi
+ APACHE2_INIT_MESSAGE="Apache2 is not running"
+ return 2
+ fi
+ $APACHE2CTL graceful > /dev/null 2>&1
+ return $?
+ else
+ APACHE2_INIT_MESSAGE="The apache2$DIR_SUFFIX configtest failed. Not doing anything."
+ return 2
+ fi
}
check_htcacheclean() {
- [ "$HTCACHECLEAN_MODE" = "daemon" ] || return 1
- [ "$HTCACHECLEAN_RUN" = "yes" ] && return 0
-
- MODSDIR=$(. $APACHE_ENVVARS && echo $APACHE_MODS_ENABLED)
- [ "$HTCACHECLEAN_RUN" = "auto" \
- -a -e ${MODSDIR:-$APACHE_CONFDIR/mods-enabled}/disk_cache.load ] && \
- return 0
- return 1
+ [ "$HTCACHECLEAN_MODE" = "daemon" ] || return 1
+ [ "$HTCACHECLEAN_RUN" = "yes" ] && return 0
+
+ MODSDIR=$(. $APACHE_ENVVARS && echo $APACHE_MODS_ENABLED)
+ [ "$HTCACHECLEAN_RUN" = "auto" \
+ -a -e ${MODSDIR:-$APACHE_CONFDIR/mods-enabled}/disk_cache.load ] && \
+ return 0
+ return 1
}
start_htcacheclean() {
$HTCACHECLEAN $HTCACHECLEAN_OPTIONS -d$HTCACHECLEAN_DAEMON_INTERVAL \
- -i -p$HTCACHECLEAN_PATH -l$HTCACHECLEAN_SIZE
+ -i -p$HTCACHECLEAN_PATH -l$HTCACHECLEAN_SIZE
}
stop_htcacheclean() {
- pkill -P 1 -f "htcacheclean.* -p$HTCACHECLEAN_PATH " 2> /dev/null || return 1
+ pkill -P 1 -f "htcacheclean.* -p$HTCACHECLEAN_PATH " 2> /dev/null || return 1
}
@@ -245,20 +245,20 @@ stop_htcacheclean() {
[ -x $APACHE_HTTPD ] || exit 0
if [ ! -x $APACHE_HTTPD ] ; then
- echo "No apache MPM package installed"
- exit 0
+ echo "No apache MPM package installed"
+ exit 0
fi
if [ -z "$PIDFILE" ] ; then
- echo ERROR: APACHE_PID_FILE needs to be defined in $APACHE_ENVVARS >&2
- exit 2
+ echo ERROR: APACHE_PID_FILE needs to be defined in $APACHE_ENVVARS >&2
+ exit 2
fi
if check_htcacheclean ; then
- if [ ! -d "$HTCACHECLEAN_PATH" ] ; then
- echo "htcacheclean is configured, but directory $HTCACHECLEAN_PATH does not exist!" >&2
- exit 2
- fi
+ if [ ! -d "$HTCACHECLEAN_PATH" ] ; then
+ echo "htcacheclean is configured, but directory $HTCACHECLEAN_PATH does not exist!" >&2
+ exit 2
+ fi
fi
@@ -267,84 +267,110 @@ case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
do_start
- RET_STATUS=$?
+ RET_STATUS=$?
case "$RET_STATUS" in
0|1)
- log_end_msg 0
- [ "$VERBOSE" != no ] && [ $RET_STATUS = 1 ] && log_warning_msg "Server was already running"
- if check_htcacheclean ; then
- [ "$VERBOSE" != no ] && log_daemon_msg "Starting HTTP cache cleaning daemon" "htcacheclean"
- start_htcacheclean
- [ "$VERBOSE" != no ] && log_end_msg $?
- fi
- ;;
+ log_end_msg 0
+ [ "$VERBOSE" != no ] && [ $RET_STATUS = 1 ] && log_warning_msg "Server was already running"
+ if check_htcacheclean ; then
+ [ "$VERBOSE" != no ] && log_daemon_msg "Starting HTTP cache cleaning daemon" "htcacheclean"
+ start_htcacheclean
+ [ "$VERBOSE" != no ] && log_end_msg $?
+ fi
+ ;;
2)
- log_end_msg 1
- [ -n "$APACHE2_INIT_MESSAGE" ] && echo $APACHE2_INIT_MESSAGE >&2
- log_failure_msg
- ;;
+ log_end_msg 1
+ [ -n "$APACHE2_INIT_MESSAGE" ] && echo $APACHE2_INIT_MESSAGE >&2
+ log_failure_msg
+ exit 1
+ ;;
esac
;;
stop|graceful-stop)
log_daemon_msg "Stopping $DESC" "$NAME"
do_stop "$1"
- RET_STATUS=$?
+ RET_STATUS=$?
case "$RET_STATUS" in
0|1)
- log_end_msg 0
- [ "$VERBOSE" != no ] && [ $RET_STATUS = 1 ] && log_warning_msg "Server was not running"
-
- ;;
- 2) log_end_msg 1 ;;
+ log_end_msg 0
+ [ "$VERBOSE" != no ] && [ $RET_STATUS = 1 ] && log_warning_msg "Server was not running"
+ ;;
+ 2)
+ log_end_msg 1
+ exit 1
+ ;;
esac
- [ "$VERBOSE" != no ] && [ "x$APACHE2_INIT_MESSAGE" != "x" ] && log_warning_msg "$APACHE2_INIT_MESSAGE"
+ [ "$VERBOSE" != no ] && [ "x$APACHE2_INIT_MESSAGE" != "x" ] && log_warning_msg "$APACHE2_INIT_MESSAGE"
- if check_htcacheclean ; then
- [ "$VERBOSE" != no ] && log_daemon_msg "Stopping HTTP cache cleaning daemon" "htcacheclean"
- stop_htcacheclean
- [ "$VERBOSE" != no ] && log_end_msg $?
- fi
+ if check_htcacheclean ; then
+ [ "$VERBOSE" != no ] && log_daemon_msg "Stopping HTTP cache cleaning daemon" "htcacheclean"
+ stop_htcacheclean
+ [ "$VERBOSE" != no ] && log_end_msg $?
+ fi
;;
status)
- status_of_proc -p $PIDFILE "apache2" "$NAME" && exit 0 || exit $?
+ status_of_proc -p $PIDFILE "apache2" "$NAME"
+ exit $?
;;
reload|force-reload|graceful)
log_daemon_msg "Reloading $DESC" "$NAME"
do_reload
- log_end_msg $?
- [ "$VERBOSE" != no ] && [ "x$APACHE2_INIT_MESSAGE" != "x" ] && log_warning_msg "$APACHE2_INIT_MESSAGE"
+ RET_STATUS=$?
+ case "$RET_STATUS" in
+ 0|1)
+ log_end_msg 0
+ [ "$VERBOSE" != no ] && [ $RET_STATUS = 1 ] && log_warning_msg "Server was already running"
+ ;;
+ 2)
+ log_end_msg 1
+ log_failure_msg
+ exit 1
+ ;;
+ esac
+ [ "$VERBOSE" != no ] && [ "x$APACHE2_INIT_MESSAGE" != "x" ] && log_warning_msg "$APACHE2_INIT_MESSAGE"
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop stop
case "$?" in
- 0|1)
- do_start
- case "$?" in
- 0) log_end_msg 0 ;;
- 1) log_end_msg 1 ;; # Old process is still running
- *) log_end_msg 1 ;; # Failed to start
- esac
- ;;
- *)
- # Failed to stop
- log_end_msg 1
- ;;
+ 0|1)
+ do_start
+ case "$?" in
+ 0)
+ log_end_msg 0
+ ;;
+ 1|*)
+ log_end_msg 1 # Old process is still or failed to running
+ exit 1
+ ;;
+ esac
+ ;;
+ *)
+ # Failed to stop
+ log_end_msg 1
+ exit 1
+ ;;
esac
;;
start-htcacheclean)
- log_daemon_msg "Starting htcacheclean"
- start_htcachelean
- log_end_msg $?
- ;;
+ log_daemon_msg "Starting htcacheclean"
+ start_htcachelean
+ log_end_msg $?
+ exit $?
+ ;;
stop-htcacheclean)
- log_daemon_msg "Stopping htcacheclean"
- stop_htcacheclean
- log_end_msg $?
- ;;
+ log_daemon_msg "Stopping htcacheclean"
+ stop_htcacheclean
+ log_end_msg $?
+ exit $?
+ ;;
*)
echo "Usage: $SCRIPTNAME {start|stop|graceful-stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean}" >&2
exit 3
;;
esac
+
+exit 0
+
+# vim: syntax=sh ts=4 sw=4 sts=4 sr noet
diff --git a/debian/changelog b/debian/changelog
index 9efc775..1a8ccd5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,8 +20,11 @@ apache2 (2.4.4-6) UNRELEASED; urgency=low
* Apply patch submitted by Robert Luberda and redirect all output of
apache2-maintscript-helper to stderr (Closes: #711478)
* Tell about essential operations in the init script (Closes: #711120)
+ * Fix indentation mess in the init script, and add modelines
+ * Make sure /etc/init.d/apache2 reload does not always return. Thanks to
+ Thorsten Glaser for suggesting a patch (Closes: #711117)
- -- Arno Töll <arno at debian.org> Fri, 07 Jun 2013 15:07:48 +0200
+ -- Arno Töll <arno at debian.org> Fri, 07 Jun 2013 15:48:48 +0200
apache2 (2.4.4-5) unstable; urgency=low
--
Debian packaging for apache2
More information about the Pkg-apache-commits
mailing list