apachectl: cleanup and replace script wholesale (#1641237)
* drop "apachectl fullstatus" support * run systemctl with --no-pager option * implement graceful&graceful-stop by signal directly run "httpd -t" from legacy action script Resolves: rhbz#1641237
This commit is contained in:
parent
9e462af294
commit
b86b48c4a2
@ -1,2 +1,2 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
exec /sbin/apachectl configtest "$@"
|
exec /usr/sbin/httpd -t
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
exec /sbin/apachectl graceful "$@"
|
exec /sbin/apachectl graceful
|
||||||
|
62
apachectl.sh
Executable file
62
apachectl.sh
Executable file
@ -0,0 +1,62 @@
|
|||||||
|
#!/usr/bin/sh
|
||||||
|
#
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
|
# this work for additional information regarding copyright ownership.
|
||||||
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
# (the "License"); you may not use this file except in compliance with
|
||||||
|
# the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
if [ "x$1" = "x-k" ]; then
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
ACMD="$1"
|
||||||
|
ARGV="$@"
|
||||||
|
SVC='httpd.service'
|
||||||
|
|
||||||
|
if [ "x$2" != "x" ] ; then
|
||||||
|
echo Passing arguments to httpd using apachectl is no longer supported.
|
||||||
|
echo You can only start/stop/restart httpd using this script.
|
||||||
|
echo To pass extra arguments to httpd, see the $SVC'(8)'
|
||||||
|
echo man page.
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $ACMD in
|
||||||
|
start|stop|restart|status)
|
||||||
|
/usr/bin/systemctl --no-pager $ACMD $SVC
|
||||||
|
ERROR=$?
|
||||||
|
;;
|
||||||
|
graceful)
|
||||||
|
if /usr/bin/systemctl -q is-active $SVC; then
|
||||||
|
/usr/bin/systemctl kill --signal=SIGUSR1 $SVC
|
||||||
|
else
|
||||||
|
/usr/bin/systemctl start $SVC
|
||||||
|
fi
|
||||||
|
ERROR=$?
|
||||||
|
;;
|
||||||
|
graceful-stop)
|
||||||
|
/usr/bin/systemctl kill --signal=SIGWINCH $SVC
|
||||||
|
ERROR=$?
|
||||||
|
;;
|
||||||
|
configtest)
|
||||||
|
/usr/sbin/service ${SVC/.service//} $ACMD
|
||||||
|
ERROR=$?
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo apachectl: The \"$ACMD\" option is not supported. 1>&2
|
||||||
|
ERROR=2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit $ERROR
|
||||||
|
|
@ -1,94 +0,0 @@
|
|||||||
|
|
||||||
- fail gracefully if links is not installed on target system
|
|
||||||
- source sysconfig/httpd for custom env. vars etc.
|
|
||||||
- make httpd -t work even in SELinux
|
|
||||||
- pass $OPTIONS to all $HTTPD invocation
|
|
||||||
|
|
||||||
Upstream-HEAD: vendor
|
|
||||||
Upstream-2.0: vendor
|
|
||||||
Upstream-Status: Vendor-specific changes for better initscript integration
|
|
||||||
|
|
||||||
--- httpd-2.4.1/support/apachectl.in.apctl
|
|
||||||
+++ httpd-2.4.1/support/apachectl.in
|
|
||||||
@@ -44,19 +44,25 @@ ARGV="$@"
|
|
||||||
# the path to your httpd binary, including options if necessary
|
|
||||||
HTTPD='@exp_sbindir@/@progname@'
|
|
||||||
#
|
|
||||||
-# pick up any necessary environment variables
|
|
||||||
-if test -f @exp_sbindir@/envvars; then
|
|
||||||
- . @exp_sbindir@/envvars
|
|
||||||
-fi
|
|
||||||
#
|
|
||||||
# a command that outputs a formatted text version of the HTML at the
|
|
||||||
# url given on the command line. Designed for lynx, however other
|
|
||||||
# programs may work.
|
|
||||||
-LYNX="@LYNX_PATH@ -dump"
|
|
||||||
+if [ -x "@LYNX_PATH@" ]; then
|
|
||||||
+ LYNX="@LYNX_PATH@ -dump"
|
|
||||||
+else
|
|
||||||
+ LYNX=none
|
|
||||||
+fi
|
|
||||||
#
|
|
||||||
# the URL to your server's mod_status status page. If you do not
|
|
||||||
# have one, then status and fullstatus will not work.
|
|
||||||
STATUSURL="http://localhost:@PORT@/server-status"
|
|
||||||
+
|
|
||||||
+# Source /etc/sysconfig/httpd for $HTTPD setting, etc.
|
|
||||||
+if [ -r /etc/sysconfig/httpd ]; then
|
|
||||||
+ . /etc/sysconfig/httpd
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
#
|
|
||||||
# Set this variable to a command that increases the maximum
|
|
||||||
# number of file descriptors allowed per child process. This is
|
|
||||||
@@ -76,9 +82,27 @@ if [ "x$ARGV" = "x" ] ; then
|
|
||||||
ARGV="-h"
|
|
||||||
fi
|
|
||||||
|
|
||||||
+function checklynx() {
|
|
||||||
+if [ "$LYNX" = "none" ]; then
|
|
||||||
+ echo "The 'links' package is required for this functionality."
|
|
||||||
+ exit 8
|
|
||||||
+fi
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+function testconfig() {
|
|
||||||
+# httpd is denied terminal access in SELinux, so run in the
|
|
||||||
+# current context to get stdout from $HTTPD -t.
|
|
||||||
+if test -x /usr/sbin/selinuxenabled && /usr/sbin/selinuxenabled; then
|
|
||||||
+ runcon -- `id -Z` $HTTPD $OPTIONS -t
|
|
||||||
+else
|
|
||||||
+ $HTTPD $OPTIONS -t
|
|
||||||
+fi
|
|
||||||
+ERROR=$?
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
case $ACMD in
|
|
||||||
start|stop|restart|graceful|graceful-stop)
|
|
||||||
- $HTTPD -k $ARGV
|
|
||||||
+ $HTTPD $OPTIONS -k $ARGV
|
|
||||||
ERROR=$?
|
|
||||||
;;
|
|
||||||
startssl|sslstart|start-SSL)
|
|
||||||
@@ -88,17 +112,18 @@ startssl|sslstart|start-SSL)
|
|
||||||
ERROR=2
|
|
||||||
;;
|
|
||||||
configtest)
|
|
||||||
- $HTTPD -t
|
|
||||||
- ERROR=$?
|
|
||||||
+ testconfig
|
|
||||||
;;
|
|
||||||
status)
|
|
||||||
+ checklynx
|
|
||||||
$LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
|
|
||||||
;;
|
|
||||||
fullstatus)
|
|
||||||
+ checklynx
|
|
||||||
$LYNX $STATUSURL
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
- $HTTPD "$@"
|
|
||||||
+ $HTTPD $OPTIONS "$@"
|
|
||||||
ERROR=$?
|
|
||||||
esac
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
|||||||
|
|
||||||
Make apachectl run via systemctl.
|
|
||||||
|
|
||||||
Note: "apachectl graceful" is documented to start httpd if not running.
|
|
||||||
|
|
||||||
Upstream-Status: vendor specific patch
|
|
||||||
|
|
||||||
--- httpd-2.4.34/support/apachectl.in.apctlsystemd
|
|
||||||
+++ httpd-2.4.34/support/apachectl.in
|
|
||||||
@@ -58,11 +58,6 @@
|
|
||||||
# have one, then status and fullstatus will not work.
|
|
||||||
STATUSURL="http://localhost:@PORT@/server-status"
|
|
||||||
|
|
||||||
-# Source /etc/sysconfig/httpd for $HTTPD setting, etc.
|
|
||||||
-if [ -r /etc/sysconfig/httpd ]; then
|
|
||||||
- . /etc/sysconfig/httpd
|
|
||||||
-fi
|
|
||||||
-
|
|
||||||
#
|
|
||||||
# Set this variable to a command that increases the maximum
|
|
||||||
# number of file descriptors allowed per child process. This is
|
|
||||||
@@ -100,9 +95,28 @@
|
|
||||||
ERROR=$?
|
|
||||||
}
|
|
||||||
|
|
||||||
+if [ "x$2" != "x" ] ; then
|
|
||||||
+ echo Passing arguments to httpd using apachectl is no longer supported.
|
|
||||||
+ echo You can only start/stop/restart httpd using this script.
|
|
||||||
+ echo "To pass extra arguments to httpd, see the httpd.service(8)"
|
|
||||||
+ echo man page.
|
|
||||||
+fi
|
|
||||||
+
|
|
||||||
case $ACMD in
|
|
||||||
-start|stop|restart|graceful|graceful-stop)
|
|
||||||
- $HTTPD $OPTIONS -k $ARGV
|
|
||||||
+start|stop|restart|status)
|
|
||||||
+ /usr/bin/systemctl $ACMD httpd.service
|
|
||||||
+ ERROR=$?
|
|
||||||
+ ;;
|
|
||||||
+graceful)
|
|
||||||
+ if /usr/bin/systemctl -q is-active httpd.service; then
|
|
||||||
+ /usr/bin/systemctl reload httpd.service
|
|
||||||
+ else
|
|
||||||
+ /usr/bin/systemctl start httpd.service
|
|
||||||
+ fi
|
|
||||||
+ ERROR=$?
|
|
||||||
+ ;;
|
|
||||||
+graceful-stop)
|
|
||||||
+ /usr/bin/systemctl stop httpd.service
|
|
||||||
ERROR=$?
|
|
||||||
;;
|
|
||||||
startssl|sslstart|start-SSL)
|
|
||||||
@@ -114,10 +128,6 @@
|
|
||||||
configtest)
|
|
||||||
testconfig
|
|
||||||
;;
|
|
||||||
-status)
|
|
||||||
- checklynx
|
|
||||||
- $LYNX $STATUSURL | awk ' /process$/ { print; exit } { print } '
|
|
||||||
- ;;
|
|
||||||
fullstatus)
|
|
||||||
checklynx
|
|
||||||
$LYNX $STATUSURL
|
|
18
httpd.spec
18
httpd.spec
@ -13,7 +13,7 @@
|
|||||||
Summary: Apache HTTP Server
|
Summary: Apache HTTP Server
|
||||||
Name: httpd
|
Name: httpd
|
||||||
Version: 2.4.38
|
Version: 2.4.38
|
||||||
Release: 5%{?dist}
|
Release: 6%{?dist}
|
||||||
URL: https://httpd.apache.org/
|
URL: https://httpd.apache.org/
|
||||||
Source0: https://www.apache.org/dist/httpd/httpd-%{version}.tar.bz2
|
Source0: https://www.apache.org/dist/httpd/httpd-%{version}.tar.bz2
|
||||||
Source1: index.html
|
Source1: index.html
|
||||||
@ -45,7 +45,6 @@ Source26: 10-listen443.conf
|
|||||||
Source27: httpd.socket
|
Source27: httpd.socket
|
||||||
Source28: 00-optional.conf
|
Source28: 00-optional.conf
|
||||||
Source29: 01-md.conf
|
Source29: 01-md.conf
|
||||||
# Documentation
|
|
||||||
Source30: README.confd
|
Source30: README.confd
|
||||||
Source31: README.confmod
|
Source31: README.confmod
|
||||||
Source32: httpd.service.xml
|
Source32: httpd.service.xml
|
||||||
@ -57,11 +56,10 @@ Source42: httpd-init.service
|
|||||||
Source43: httpd-ssl-gencerts
|
Source43: httpd-ssl-gencerts
|
||||||
Source44: httpd@.service
|
Source44: httpd@.service
|
||||||
Source45: config.layout
|
Source45: config.layout
|
||||||
|
Source46: apachectl.sh
|
||||||
# build/scripts patches
|
# build/scripts patches
|
||||||
Patch1: httpd-2.4.1-apctl.patch
|
|
||||||
Patch2: httpd-2.4.9-apxs.patch
|
Patch2: httpd-2.4.9-apxs.patch
|
||||||
Patch3: httpd-2.4.1-deplibs.patch
|
Patch3: httpd-2.4.1-deplibs.patch
|
||||||
Patch6: httpd-2.4.34-apctlsystemd.patch
|
|
||||||
# Needed for socket activation and mod_systemd patch
|
# Needed for socket activation and mod_systemd patch
|
||||||
Patch19: httpd-2.4.25-detect-systemd.patch
|
Patch19: httpd-2.4.25-detect-systemd.patch
|
||||||
# Features/functional changes
|
# Features/functional changes
|
||||||
@ -210,10 +208,8 @@ interface for storing and accessing per-user session data.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch1 -p1 -b .apctl
|
|
||||||
%patch2 -p1 -b .apxs
|
%patch2 -p1 -b .apxs
|
||||||
%patch3 -p1 -b .deplibs
|
%patch3 -p1 -b .deplibs
|
||||||
%patch6 -p1 -b .apctlsystemd
|
|
||||||
|
|
||||||
%patch19 -p1 -b .detectsystemd
|
%patch19 -p1 -b .detectsystemd
|
||||||
|
|
||||||
@ -482,7 +478,8 @@ install -m755 $RPM_SOURCE_DIR/httpd-ssl-pass-dialog \
|
|||||||
install -m755 $RPM_SOURCE_DIR/httpd-ssl-gencerts \
|
install -m755 $RPM_SOURCE_DIR/httpd-ssl-gencerts \
|
||||||
$RPM_BUILD_ROOT%{_libexecdir}/httpd-ssl-gencerts
|
$RPM_BUILD_ROOT%{_libexecdir}/httpd-ssl-gencerts
|
||||||
|
|
||||||
# Install action scripts
|
# Install scripts
|
||||||
|
install -p -m 755 $RPM_SOURCE_DIR/apachectl.sh $RPM_BUILD_ROOT%{_sbindir}/apachectl
|
||||||
mkdir -p $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/httpd
|
mkdir -p $RPM_BUILD_ROOT%{_libexecdir}/initscripts/legacy-actions/httpd
|
||||||
for f in graceful configtest; do
|
for f in graceful configtest; do
|
||||||
install -p -m 755 $RPM_SOURCE_DIR/action-${f}.sh \
|
install -p -m 755 $RPM_SOURCE_DIR/action-${f}.sh \
|
||||||
@ -736,6 +733,13 @@ exit $rv
|
|||||||
%{_rpmconfigdir}/macros.d/macros.httpd
|
%{_rpmconfigdir}/macros.d/macros.httpd
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Feb 28 2019 Joe Orton <jorton@redhat.com> - 2.4.38-6
|
||||||
|
- apachectl: cleanup and replace script wholesale (#1641237)
|
||||||
|
* drop "apachectl fullstatus" support
|
||||||
|
* run systemctl with --no-pager option
|
||||||
|
* implement graceful&graceful-stop by signal directly
|
||||||
|
- run "httpd -t" from legacy action script
|
||||||
|
|
||||||
* Tue Feb 05 2019 Lubos Uhliarik <luhliari@redhat.com> - 2.4.38-5
|
* Tue Feb 05 2019 Lubos Uhliarik <luhliari@redhat.com> - 2.4.38-5
|
||||||
- segmentation fault fix (FIPS)
|
- segmentation fault fix (FIPS)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user