]> Raphaƫl G. Git Repositories - ihttpd/blob - SOURCES/httpd-2.4.1-apctl.patch
Version 2.4.62
[ihttpd] / SOURCES / httpd-2.4.1-apctl.patch
1
2 - fail gracefully if links is not installed on target system
3 - source sysconfig/httpd for custom env. vars etc.
4 - make httpd -t work even in SELinux
5 - pass $OPTIONS to all $HTTPD invocation
6
7 Upstream-HEAD: vendor
8 Upstream-2.0: vendor
9 Upstream-Status: Vendor-specific changes for better initscript integration
10
11 --- httpd-2.4.1/support/apachectl.in.apctl
12 +++ httpd-2.4.1/support/apachectl.in
13 @@ -44,19 +44,25 @@ ARGV="$@"
14 # the path to your httpd binary, including options if necessary
15 HTTPD='@exp_sbindir@/@progname@'
16 #
17 -# pick up any necessary environment variables
18 -if test -f @exp_sbindir@/envvars; then
19 - . @exp_sbindir@/envvars
20 -fi
21 #
22 # a command that outputs a formatted text version of the HTML at the
23 # url given on the command line. Designed for lynx, however other
24 # programs may work.
25 -LYNX="@LYNX_PATH@ -dump"
26 +if [ -x "@LYNX_PATH@" ]; then
27 + LYNX="@LYNX_PATH@ -dump"
28 +else
29 + LYNX=none
30 +fi
31 #
32 # the URL to your server's mod_status status page. If you do not
33 # have one, then status and fullstatus will not work.
34 STATUSURL="http://localhost:@PORT@/server-status"
35 +
36 +# Source /etc/sysconfig/httpd for $HTTPD setting, etc.
37 +if [ -r /etc/sysconfig/httpd ]; then
38 + . /etc/sysconfig/httpd
39 +fi
40 +
41 #
42 # Set this variable to a command that increases the maximum
43 # number of file descriptors allowed per child process. This is
44 @@ -76,9 +82,27 @@ if [ "x$ARGV" = "x" ] ; then
45 ARGV="-h"
46 fi
47
48 +function checklynx() {
49 +if [ "$LYNX" = "none" ]; then
50 + echo "The 'links' package is required for this functionality."
51 + exit 8
52 +fi
53 +}
54 +
55 +function testconfig() {
56 +# httpd is denied terminal access in SELinux, so run in the
57 +# current context to get stdout from $HTTPD -t.
58 +if test -x /usr/sbin/selinuxenabled && /usr/sbin/selinuxenabled; then
59 + runcon -- `id -Z` $HTTPD $OPTIONS -t
60 +else
61 + $HTTPD $OPTIONS -t
62 +fi
63 +ERROR=$?
64 +}
65 +
66 case $ACMD in
67 start|stop|restart|graceful|graceful-stop)
68 - $HTTPD -k $ARGV
69 + $HTTPD $OPTIONS -k $ARGV
70 ERROR=$?
71 ;;
72 startssl|sslstart|start-SSL)
73 @@ -88,17 +112,18 @@ startssl|sslstart|start-SSL)
74 ERROR=2
75 ;;
76 configtest)
77 - $HTTPD -t
78 - ERROR=$?
79 + testconfig
80 ;;
81 status)
82 + checklynx
83 $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
84 ;;
85 fullstatus)
86 + checklynx
87 $LYNX $STATUSURL
88 ;;
89 *)
90 - $HTTPD "$@"
91 + $HTTPD $OPTIONS "$@"
92 ERROR=$?
93 esac
94