diff options
| author | Joe Orton <jorton@redhat.com> | 2012-01-17 13:17:38 +0000 |
|---|---|---|
| committer | Joe Orton <jorton@redhat.com> | 2012-01-17 13:17:38 +0000 |
| commit | ce009f995d2f7acb3a105c8342c14a7f6a96f71b (patch) | |
| tree | 10fa13454dbcf8673e588b33b73824075cdcddf4 | |
| parent | ba7fac9e71acc5913a54a53d9289b83ed5743001 (diff) | |
| download | httpd-ce009f995d2f7acb3a105c8342c14a7f6a96f71b.tar.gz httpd-ce009f995d2f7acb3a105c8342c14a7f6a96f71b.tar.xz httpd-ce009f995d2f7acb3a105c8342c14a7f6a96f71b.zip | |
complete conversion to systemd, drop init script (#770311)
fix comments in /etc/sysconfig/httpd (#771024)
enable PrivateTmp in service file (#781440)
set LANG=C in /etc/sysconfig/httpd
| -rwxr-xr-x | httpd.init | 124 | ||||
| -rw-r--r-- | httpd.service | 1 | ||||
| -rw-r--r-- | httpd.spec | 62 | ||||
| -rw-r--r-- | httpd.sysconf | 31 |
4 files changed, 45 insertions, 173 deletions
diff --git a/httpd.init b/httpd.init deleted file mode 100755 index 983c95e..0000000 --- a/httpd.init +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/bash -# -# httpd Startup script for the Apache HTTP Server -# -# chkconfig: - 85 15 -# description: The Apache HTTP Server is an efficient and extensible \ -# server implementing the current HTTP standards. -# processname: httpd -# config: /etc/httpd/conf/httpd.conf -# config: /etc/sysconfig/httpd -# pidfile: /var/run/httpd/httpd.pid -# -### BEGIN INIT INFO -# Provides: httpd -# Required-Start: $local_fs $remote_fs $network $named -# Required-Stop: $local_fs $remote_fs $network -# Should-Start: distcache -# Short-Description: start and stop Apache HTTP Server -# Description: The Apache HTTP Server is an extensible server -# implementing the current HTTP standards. -### END INIT INFO - -# Source function library. -. /etc/rc.d/init.d/functions - -if [ -f /etc/sysconfig/httpd ]; then - . /etc/sysconfig/httpd -fi - -# Start httpd in the C locale by default. -HTTPD_LANG=${HTTPD_LANG-"C"} - -# This will prevent initlog from swallowing up a pass-phrase prompt if -# mod_ssl needs a pass-phrase from the user. -INITLOG_ARGS="" - -# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd 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. - -# Path to the apachectl script, server binary, and short-form for messages. -apachectl=/usr/sbin/apachectl -httpd=${HTTPD-/usr/sbin/httpd} -prog=httpd -pidfile=${PIDFILE-/var/run/httpd/httpd.pid} -lockfile=${LOCKFILE-/var/lock/subsys/httpd} -RETVAL=0 -STOP_TIMEOUT=${STOP_TIMEOUT-10} - -# The semantics of these two functions differ from the way apachectl does -# things -- attempting to start while running is a failure, and shutdown -# when not running is also a failure. So we just do it the way init scripts -# are expected to behave here. -start() { - echo -n $"Starting $prog: " - LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS - RETVAL=$? - echo - [ $RETVAL = 0 ] && touch ${lockfile} - return $RETVAL -} - -# When stopping httpd, a delay (of default 10 second) is required -# before SIGKILLing the httpd parent; this gives enough time for the -# httpd parent to SIGKILL any errant children. -stop() { - echo -n $"Stopping $prog: " - killproc -p ${pidfile} -d ${STOP_TIMEOUT} $httpd - RETVAL=$? - echo - [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} -} -reload() { - echo -n $"Reloading $prog: " - if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then - RETVAL=6 - echo $"not reloading due to configuration syntax error" - failure $"not reloading $httpd due to configuration syntax error" - else - # Force LSB behaviour from killproc - LSB=1 killproc -p ${pidfile} $httpd -HUP - RETVAL=$? - if [ $RETVAL -eq 7 ]; then - failure $"httpd shutdown" - fi - fi - echo -} - -# See how we were called. -case "$1" in - start) - start - ;; - stop) - stop - ;; - status) - status -p ${pidfile} $httpd - RETVAL=$? - ;; - restart) - stop - start - ;; - condrestart|try-restart) - if status -p ${pidfile} $httpd >&/dev/null; then - stop - start - fi - ;; - force-reload|reload) - reload - ;; - graceful|help|configtest|fullstatus) - $apachectl $@ - RETVAL=$? - ;; - *) - echo $"Usage: $prog {start|stop|restart|condrestart|try-restart|force-reload|reload|status|fullstatus|graceful|help|configtest}" - RETVAL=2 -esac - -exit $RETVAL diff --git a/httpd.service b/httpd.service index 4fc2b7e..4345ac5 100644 --- a/httpd.service +++ b/httpd.service @@ -10,6 +10,7 @@ ExecStart=@EXEC@ $OPTIONS -k start ExecReload=@EXEC@ $OPTIONS -t ExecReload=/bin/kill -HUP $MAINPID ExecStop=@EXEC@ $OPTIONS -k stop +PrivateTmp=true [Install] WantedBy=multi-user.target @@ -4,16 +4,16 @@ %define mmnisa %{mmn}-%{__isa_name}-%{__isa_bits} %define vstring Fedora %define mpms worker event +%define all_services httpd.service httpd-worker.service httpd-event.service Summary: Apache HTTP Server Name: httpd Version: 2.2.21 -Release: 5%{?dist} +Release: 6%{?dist} URL: http://httpd.apache.org/ Source0: http://www.apache.org/dist/httpd/httpd-%{version}.tar.bz2 Source1: index.html Source3: httpd.logrotate -Source4: httpd.init Source5: httpd.sysconf Source6: httpd-ssl-pass-dialog Source10: httpd.conf @@ -46,14 +46,16 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: autoconf, perl, pkgconfig, findutils, xmlto BuildRequires: zlib-devel, libselinux-devel BuildRequires: apr-devel >= 1.2.0, apr-util-devel >= 1.2.0, pcre-devel >= 5.0 -Requires: initscripts >= 8.36, /etc/mime.types, system-logos >= 7.92.1-1 +Requires: /etc/mime.types, system-logos >= 7.92.1-1 Obsoletes: httpd-suexec -Requires(pre): /usr/sbin/useradd -Requires(post): chkconfig Provides: webserver Provides: mod_dav = %{version}-%{release}, httpd-suexec = %{version}-%{release} Provides: httpd-mmn = %{mmn}, httpd-mmn = %{mmnisa} -Requires: httpd-tools = %{version}-%{release}, apr-util-ldap, systemd-units +Requires: httpd-tools = %{version}-%{release}, apr-util-ldap +Requires(pre): /usr/sbin/useradd +Requires(preun): systemd-units +Requires(postun): systemd-units +Requires(post): systemd-units %description The Apache HTTP Server is a powerful, efficient, and extensible @@ -321,11 +323,6 @@ ln -s ../..%{_localstatedir}/log/httpd $RPM_BUILD_ROOT/etc/httpd/logs ln -s ../..%{_localstatedir}/run/httpd $RPM_BUILD_ROOT/etc/httpd/run ln -s ../..%{_libdir}/httpd/modules $RPM_BUILD_ROOT/etc/httpd/modules -# install SYSV init stuff -mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d -install -m755 $RPM_SOURCE_DIR/httpd.init \ - $RPM_BUILD_ROOT/etc/rc.d/init.d/httpd - # install http-ssl-pass-dialog mkdir -p $RPM_BUILD_ROOT/%{_libexecdir} install -m755 $RPM_SOURCE_DIR/httpd-ssl-pass-dialog \ @@ -377,16 +374,34 @@ chmod 755 $RPM_BUILD_ROOT%{_sbindir}/suexec %post # Register the httpd service -/sbin/chkconfig --add httpd +if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi %preun -if [ $1 = 0 ]; then - /sbin/service httpd stop > /dev/null 2>&1 - /sbin/chkconfig --del httpd +if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable %{all_services} > /dev/null 2>&1 || : + /bin/systemctl stop %{all_services} > /dev/null 2>&1 || : fi +%postun +/bin/systemctl daemon-reload >/dev/null 2>&1 || : + +# Trigger for conversion from SysV, per guidelines at: +# https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd +%triggerun -- httpd < 2.2.21-5 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply httpd +# to migrate them to systemd targets +/usr/bin/systemd-sysv-convert --save httpd.service >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del httpd >/dev/null 2>&1 || : + %posttrans -/sbin/service httpd condrestart >/dev/null 2>&1 || : +/bin/systemctl try-restart %{all_services} >/dev/null 2>&1 || : %define sslcert %{_sysconfdir}/pki/tls/certs/localhost.crt %define sslkey %{_sysconfdir}/pki/tls/private/localhost.key @@ -394,16 +409,17 @@ fi %post -n mod_ssl umask 077 -if [ ! -f %{sslkey} ] ; then -%{_bindir}/openssl genrsa -rand /proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime 1024 > %{sslkey} 2> /dev/null +if [ -f %{sslkey} -o -f %{sslcert} ]; then + exit 0 fi +%{_bindir}/openssl genrsa -rand /proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime 1024 > %{sslkey} 2> /dev/null + FQDN=`hostname` if [ "x${FQDN}" = "x" ]; then FQDN=localhost.localdomain fi -if [ ! -f %{sslcert} ] ; then cat << EOF | %{_bindir}/openssl req -new -key %{sslkey} \ -x509 -days 365 -set_serial $RANDOM -extensions v3_req \ -out %{sslcert} 2>/dev/null @@ -415,7 +431,6 @@ SomeOrganizationalUnit ${FQDN} root@${FQDN} EOF -fi %check # Check the built modules are all PIC @@ -452,7 +467,6 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) %{_sysconfdir}/httpd/conf/magic %config(noreplace) %{_sysconfdir}/logrotate.d/httpd -%{_sysconfdir}/rc.d/init.d/httpd %dir %{_sysconfdir}/httpd/conf.d %{_sysconfdir}/httpd/conf.d/README @@ -525,6 +539,12 @@ rm -rf $RPM_BUILD_ROOT %{_sysconfdir}/rpm/macros.httpd %changelog +* Mon Jan 16 2012 Joe Orton <jorton@redhat.com> - 2.2.21-6 +- complete conversion to systemd, drop init script (#770311) +- fix comments in /etc/sysconfig/httpd (#771024) +- enable PrivateTmp in service file (#781440) +- set LANG=C in /etc/sysconfig/httpd + * Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.21-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild diff --git a/httpd.sysconf b/httpd.sysconf index b57ac38..46230e4 100644 --- a/httpd.sysconf +++ b/httpd.sysconf @@ -1,38 +1,13 @@ # Configuration file for the httpd service. # -# The default processing model (MPM) is the process-based -# 'prefork' model. A thread-based model, 'worker', is also -# available, but does not work with some modules (such as PHP). -# The service must be stopped before changing this variable. -# -#HTTPD=/usr/sbin/httpd.worker - -# # To pass additional options (for instance, -D definitions) to the # httpd binary at startup, set OPTIONS here. # #OPTIONS= # -# By default, the httpd process is started in the C locale; to -# change the locale in which the server runs, the HTTPD_LANG -# variable can be set. -# -#HTTPD_LANG=C - -# -# When stopping the server a 10 second timeout is allowed before -# forcibly terminating the parent process (with a SIGKILL signal). -# To allow a longer delay, set the STOP_TIMEOUT variable. -# -#STOP_TIMEOUT=10 - -# -# By default, the httpd process will create the file -# /var/run/httpd/httpd.pid in which it records its process -# identification number when it starts. If an alternate location is -# specified in httpd.conf (via the PidFile directive), the new -# location needs to be reported in the PIDFILE. +# This setting ensures the httpd process is started in the "C" +# locale by default: # -#PIDFILE=/var/run/httpd/httpd.pid +LANG=C |
