[httpd] complete conversion to systemd, drop init script (#770311) fix comments in /etc/sysconfig/httpd (#77
jorton
jorton at fedoraproject.org
Tue Jan 17 13:17:48 UTC 2012
commit ce009f995d2f7acb3a105c8342c14a7f6a96f71b
Author: Joe Orton <jorton at redhat.com>
Date: Tue Jan 17 13:17:38 2012 +0000
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
httpd.init | 124 ---------------------------------------------------------
httpd.service | 1 +
httpd.spec | 62 +++++++++++++++++++----------
httpd.sysconf | 31 +-------------
4 files changed, 45 insertions(+), 173 deletions(-)
---
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
diff --git a/httpd.spec b/httpd.spec
index c5e6241..1171b45 100644
--- a/httpd.spec
+++ b/httpd.spec
@@ -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 at 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 at 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
More information about the scm-commits
mailing list