Blame SOURCES/httpd-2.4.1-apctl.patch

af9b8b
af9b8b
- fail gracefully if links is not installed on target system
af9b8b
- source sysconfig/httpd for custom env. vars etc.
af9b8b
- make httpd -t work even in SELinux
af9b8b
- pass $OPTIONS to all $HTTPD invocation
af9b8b
af9b8b
Upstream-HEAD: vendor
af9b8b
Upstream-2.0: vendor
af9b8b
Upstream-Status: Vendor-specific changes for better initscript integration
af9b8b
af9b8b
--- httpd-2.4.1/support/apachectl.in.apctl
af9b8b
+++ httpd-2.4.1/support/apachectl.in
af9b8b
@@ -44,19 +44,25 @@ ARGV="$@"
af9b8b
 # the path to your httpd binary, including options if necessary
af9b8b
 HTTPD='@exp_sbindir@/@progname@'
af9b8b
 #
af9b8b
-# pick up any necessary environment variables
af9b8b
-if test -f @exp_sbindir@/envvars; then
af9b8b
-  . @exp_sbindir@/envvars
af9b8b
-fi
af9b8b
 #
af9b8b
 # a command that outputs a formatted text version of the HTML at the
af9b8b
 # url given on the command line.  Designed for lynx, however other
af9b8b
 # programs may work.  
af9b8b
-LYNX="@LYNX_PATH@ -dump"
af9b8b
+if [ -x "@LYNX_PATH@" ]; then
af9b8b
+  LYNX="@LYNX_PATH@ -dump"
af9b8b
+else
af9b8b
+  LYNX=none
af9b8b
+fi
af9b8b
 #
af9b8b
 # the URL to your server's mod_status status page.  If you do not
af9b8b
 # have one, then status and fullstatus will not work.
af9b8b
 STATUSURL="http://localhost:@PORT@/server-status"
af9b8b
+
af9b8b
+# Source /opt/rh/httpd24/root/etc/sysconfig/httpd for $HTTPD setting, etc.
af9b8b
+if [ -r /opt/rh/httpd24/root/etc/sysconfig/httpd ]; then
af9b8b
+   . /opt/rh/httpd24/root/etc/sysconfig/httpd
af9b8b
+fi
af9b8b
+
af9b8b
 #
af9b8b
 # Set this variable to a command that increases the maximum
af9b8b
 # number of file descriptors allowed per child process. This is
af9b8b
@@ -76,9 +82,27 @@ if [ "x$ARGV" = "x" ] ; then 
af9b8b
     ARGV="-h"
af9b8b
 fi
af9b8b
 
af9b8b
+function checklynx() {
af9b8b
+if [ "$LYNX" = "none" ]; then
af9b8b
+   echo "The 'links' package is required for this functionality."
af9b8b
+   exit 8
af9b8b
+fi
af9b8b
+}
af9b8b
+
af9b8b
+function testconfig() {
af9b8b
+# httpd is denied terminal access in SELinux, so run in the
af9b8b
+# current context to get stdout from $HTTPD -t.
af9b8b
+if test -x /usr/sbin/selinuxenabled && /usr/sbin/selinuxenabled; then
af9b8b
+  runcon -- `id -Z` $HTTPD $OPTIONS -t
af9b8b
+else
af9b8b
+  $HTTPD $OPTIONS -t
af9b8b
+fi
af9b8b
+ERROR=$?
af9b8b
+}
af9b8b
+
af9b8b
 case $ACMD in
af9b8b
 start|stop|restart|graceful|graceful-stop)
af9b8b
-    $HTTPD -k $ARGV
af9b8b
+    $HTTPD $OPTIONS -k $ARGV
af9b8b
     ERROR=$?
af9b8b
     ;;
af9b8b
 startssl|sslstart|start-SSL)
af9b8b
@@ -88,17 +112,18 @@ startssl|sslstart|start-SSL)
af9b8b
     ERROR=2
af9b8b
     ;;
af9b8b
 configtest)
af9b8b
-    $HTTPD -t
af9b8b
-    ERROR=$?
af9b8b
+    testconfig
af9b8b
     ;;
af9b8b
 status)
af9b8b
+    checklynx
af9b8b
     $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
af9b8b
     ;;
af9b8b
 fullstatus)
af9b8b
+    checklynx
af9b8b
     $LYNX $STATUSURL
af9b8b
     ;;
af9b8b
 *)
af9b8b
-    $HTTPD "$@"
af9b8b
+    $HTTPD $OPTIONS "$@"
af9b8b
     ERROR=$?
af9b8b
 esac
af9b8b