Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37550059
en ru br
Репозитории ALT
S:2.4.57-alt2
D:2.2.9-alt11
5.1: 2.2.24-alt2.M51.1
4.1: 2.2.8-alt1
4.0: 2.2.6-alt4
+updates:2.2.6-alt2
3.0: 2.0.55-alt1
+backports:2.0.59-alt0.M30.1
www.altlinux.org/Changes

Другие репозитории
Upstream:2.2.8

Группа :: Система/Серверы
Пакет: apache2

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: apache2-2.4.25-alt-apachectl.patch
Скачать


diff --git a/support/apachectl.in b/support/apachectl.in
index 3281c2e..eb0e7b7 100644
--- a/support/apachectl.in
+++ b/support/apachectl.in
@@ -45,8 +45,9 @@ ARGV="$@"
 HTTPD='@exp_sbindir@/@progname@'
 #
 # pick up any necessary environment variables
-if test -f @exp_sbindir@/envvars; then
-  . @exp_sbindir@/envvars
+ENVVARS="@exp_sbindir@/envvars"
+if test -f "$ENVVARS"; then
+	. "$ENVVARS"
 fi
 #
 # a command that outputs a formatted text version of the HTML at the
@@ -66,19 +67,207 @@ ULIMIT_MAX_FILES="@APACHECTL_ULIMIT@"
 # --------------------                              --------------------
 # ||||||||||||||||||||   END CONFIGURATION SECTION  ||||||||||||||||||||
 
+# Source function library.
+. /etc/init.d/functions
+SourceIfExists /etc/sysconfig/httpd2
+
+# Set HTTPD=httpd2.worker in /etc/sysconfig/httpd2 to use a server
+# with the thread-based "worker" MPM; BE WARNED that some modules may not
+# work correctly with a thread-based MPM; notably PHP will refuse to start.
+name=`echo $HTTPD | sed -r '\@^.*/[^/[:space:]]+[[:space:]]*$@s@^.*/([^/[:space:]]+)[[:space:]]*$@\1@'`
+BINARY=/usr/sbin/$name
+BASENAME="$(basename "$BINARY")"
+moduledir=/usr/lib64/apache2/modules
+moduleargs=
+PIDFILE=/var/run/httpd2/httpd.pid
+PIDFILE_A1=/var/run/httpd.pid
+PIDFILE_A1_PERL=/var/run/httpd-perl.pid
+LOCKFILE=/var/lock/subsys/httpd2
+RETVAL=0
+
+export TMPDIR=/var/spool/apache2/tmp
+
+# For check vars
+numcheck() {
+	head -n 1 \
+		| grep -q '^[[:space:]]*0*[1-9][0-9]*[[:space:]]*$'
+}
+
+# Check vars
+if ! echo "$WAITSTOP" | numcheck ; then
+	WAITSTOP=300
+fi
+if ! echo "$WAITGRACEFULSTOP" | numcheck ; then
+	WAITGRACEFULSTOP=3000
+fi
+if ! echo "$USLEEPSTART" | numcheck ; then
+	USLEEPSTART=300000
+fi
+if ! echo "$LOOPSSTART" | numcheck ; then
+	LOOPSSTART=10
+fi
+
+### Hacks for the apache1 + proxified apache2
+if [ -e "$PIDFILE_A1" -o -e "$PIDFILE_A1_PERL" ]; then
+    DEFINE="-DA1PROXIED"
+fi
+
 # Set the maximum number of file descriptors allowed per child process.
 if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then
     $ULIMIT_MAX_FILES
 fi
 
+# Change the major functions into functions.
+moduleargs() {
+	for module in ${moduledir}/*.so ; do
+		if [ -x ${module} ] ; then
+			module=`echo ${module} | 
+			sed -e 's/.*\///g; s/^mod_//g; s/^lib//g; s/\.so//g;'|
+			tr '[:lower:]' '[:upper:]'`
+			moduleargs="${moduleargs} -DHAVE_$module"
+		fi
+	done
+	echo ${moduleargs}
+}
+
+configtest() {
+	"$BINARY" -t `moduleargs` $OPTIONS $DEFINE
+	RETVAL=$?
+	return $RETVAL
+}
+
+start()
+{
+	initlog $INITLOG_ARGS -n "$BASENAME" -c "limited -n $BASENAME -- $BINARY -k start $OPTIONS $DEFINE" || :
+	poststart
+	RETVAL=$?
+	return $RETVAL
+}
+
+stop()
+{
+	if initlog $INITLOG_ARGS -n "$BASENAME" -c "limited -n $BASENAME -- $BINARY -k stop $OPTIONS $DEFINE"; then
+		usleep 100000
+		poststop
+		RETVAL=$?
+	else
+		RETVAL=$?
+	fi
+	return $RETVAL
+}
+
+graceful_stop()
+{
+	if  initlog $INITLOG_ARGS -n "$BASENAME" -c "limited -n $BASENAME -- $BINARY -k graceful-stop $OPTIONS $DEFINE"; then
+		sleep 1
+		poststop
+		RETVAL=$?
+	else
+		RETVAL=$?
+	fi
+	return $RETVAL
+}
+
+briefstatus()
+{
+	status --pidfile "$PIDFILE" --expect-user root \
+		--expect-user root --name $name -- $BINARY
+	RETVAL=$?
+	return $RETVAL
+}
+
+poststart()
+{
+	for (( i=$LOOPSSTART; $i>0; i=(($i-1)) )); do
+		usleep $USLEEPSTART
+		if briefstatus >/dev/null 2>&1; then
+			touch "$LOCKFILE"
+			RETVAL=$?
+			break
+		else
+			RETVAL=$?
+		fi
+	done
+	return $RETVAL
+}
+
+poststop()
+{
+	if ! briefstatus >/dev/null 2>&1; then
+		rm -f "$LOCKFILE"
+		RETVAL=$?
+	else
+		RETVAL=255
+		printf "Service %s has not stopped.\n" "$name"
+	fi
+	return $RETVAL
+}
+
+fullstatus()
+{
+	if briefstatus >/dev/null 2>&1; then
+	    RETVAL=$?
+	    $LYNX $STATUSURL
+	else
+	    RETVAL=$?
+	    msg_not_running "$name"
+	    echo
+	fi
+	return $RETVAL
+}
+
+stop_wait()
+{
+	for (( i=$1; $i>0; i=(($i-1)) )); do
+		poststop >/dev/null 2>&1
+		RETVAL=$?
+		if [ $RETVAL -eq 255 ]; then
+			sleep 1
+		else
+			return $RETVAL
+		fi
+	done
+	poststop >/dev/null 2>&1
+	RETVAL=$?
+	return $RETVAL
+}
+
 ERROR=0
 if [ "x$ARGV" = "x" ] ; then 
     ARGV="-h"
 fi
 
 case $ACMD in
-start|stop|restart|graceful|graceful-stop)
-    $HTTPD -k $ARGV
+start)
+    start
+    ERROR=$?
+    ;;
+stop)
+    stop
+    ERROR=$?
+    ;;
+graceful-stop)
+    graceful_stop
+    ERROR=$?
+    ;;
+wait-stop)
+    stop
+    ERROR=$?
+    if [ $RETVAL -eq 255 ]; then
+	    stop_wait $WAITSTOP
+	    ERROR=$?
+    fi
+    ;;
+wait-graceful-stop)
+    graceful_stop
+    ERROR=$?
+    if [ $RETVAL -eq 255 ]; then
+	    stop_wait $WAITGRACEFULSTOP
+	    ERROR=$?
+    fi
+    ;;
+restart|graceful)
+    initlog $INITLOG_ARGS -n "$BASENAME" -c "limited -n $BASENAME -- $BINARY -k $ARGV $OPTIONS $DEFINE"
     ERROR=$?
     ;;
 startssl|sslstart|start-SSL)
@@ -87,18 +276,32 @@ startssl|sslstart|start-SSL)
     echo and then use "apachectl start".
     ERROR=2
     ;;
+poststart)
+    poststart
+    ERROR=$?
+    ;;
+poststop)
+    poststop
+    ERROR=$?
+    ;;
 configtest)
-    $HTTPD -t
+    configtest
+    ERROR=$?
+    ;;
+briefstatus)
+    briefstatus
     ERROR=$?
     ;;
 status)
-    $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
+    fullstatus | awk ' /process$/ { print; exit } { print } '
+    ERROR=$?
     ;;
 fullstatus)
-    $LYNX $STATUSURL
+    fullstatus
+    ERROR=$?
     ;;
 *)
-    $HTTPD "$@"
+    initlog -n "$BASENAME" -c "limited -n $BASENAME -- $BINARY $ARGV $OPTIONS $DEFINE"
     ERROR=$?
 esac
 
diff --git a/support/Makefile.in b/support/Makefile.in
index 745d86c..0283b38 100644
--- a/support/Makefile.in
+++ b/support/Makefile.in
@@ -3,8 +3,9 @@ DISTCLEAN_TARGETS = apxs apachectl dbmmanage log_server_status \
 
 CLEAN_TARGETS = suexec
 
-bin_PROGRAMS = htpasswd htdigest htdbm ab logresolve httxt2dbm
-sbin_PROGRAMS = htcacheclean rotatelogs $(NONPORTABLE_SUPPORT)
+bin_PROGRAMS = htpasswd htdigest htdbm ab logresolve httxt2dbm check_forensic
+sbin_PROGRAMS = htcacheclean rotatelogs $(NONPORTABLE_SUPPORT) \
+		a2chkconfig a2chkconfig_list a2disextra a2dismod a2disport a2dissite a2enextra a2enmod a2enport a2ensite
 TARGETS  = $(bin_PROGRAMS) $(sbin_PROGRAMS)
 
 PROGRAM_LDADD        = $(UTIL_LDFLAGS) $(PROGRAM_DEPENDENCIES) $(EXTRA_LIBS) $(AP_LIBS)
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin