[httpd-itk] Add separate self own systemd service file and update instruction how to use it (bz#804349).

Pavel Alexeev hubbitus at fedoraproject.org
Sun Mar 18 16:31:54 UTC 2012


commit e1e50159f016ea9126ba1f3c803a095f4f366534
Author: Pavel Alexeev (aka Pahan-Hubbitus) <pahan at hubbitus.info>
Date:   Sun Mar 18 20:31:42 2012 +0400

    Add separate self own systemd service file and update instruction how to use it (bz#804349).

 README.Fedora  |   13 ++++++++++---
 httpd-itk.spec |   41 ++++++++++++++++++++++++++++++++++++-----
 2 files changed, 46 insertions(+), 8 deletions(-)
---
diff --git a/README.Fedora b/README.Fedora
index 63d0254..84d1eff 100644
--- a/README.Fedora
+++ b/README.Fedora
@@ -1,7 +1,14 @@
 It is only additional MPM for Apache web server.
-To enable it just set
-HTTPD=/usr/sbin/httpd.itk
-in /etc/sysconfig/httpd and restart daemon:
+
+To enable it:
+1) If you are use moderm systemd:
+systemctl stop httpd.service
+systemctl disable httpd.service
+systemctl enable httpd-itk.service
+systemctl start httpd-itk.service
+
+2) If you are still using old sysvinit style:
+Set HTTPD=/usr/sbin/httpd.itk in /etc/sysconfig/httpd and restart daemon:
 service httpd restart
 
 For more information about Apache refer to man and manuals in main httpd package
diff --git a/httpd-itk.spec b/httpd-itk.spec
index adcf0e8..e29f3da 100644
--- a/httpd-itk.spec
+++ b/httpd-itk.spec
@@ -1,11 +1,10 @@
-%define contentdir /var/www
-%define mmn 20051115
-%define mpms worker event
+%global contentdir /var/www
+%global mmn 20051115
 
 Summary:		MPM Itk for Apache HTTP Server
 Name:		httpd-itk
 Version:		2.2.22
-Release:		5%{?dist}
+Release:		6%{?dist}
 URL:			http://mpm-itk.sesse.net/
 License:		ASL 2.0
 Group:		System Environment/Daemons
@@ -19,6 +18,7 @@ Patch99:		httpd-2.2.19-build.patch
 Patch100:		http://mpm-itk.sesse.net/apache2.2-mpm-itk-2.2.17-01.patch
 
 Source1:		README.Fedora
+Source2:		httpd-itk.service
 
 # Other patches (greather than 200) from main httpd package. Unfortunately I can't gone it there
 # to do not miss something urgent (see comment and links in first changelog entry)!!
@@ -47,6 +47,11 @@ Conflicts:	pcre < 4.0
 # used only environment, but package provide fully independent binary file.
 Requires:		httpd >= %{version}
 
+BuildRequires:		systemd-units
+Requires(preun):	systemd-units
+Requires(postun):	systemd-units
+Requires(post):	systemd-units
+
 %description
 The Apache HTTP Server is a powerful, efficient, and extensible web server.
 
@@ -122,8 +127,30 @@ mpmbuild itk --enable-modules=none
 %install
 rm -rf %{buildroot}
 
-install -Dm 755 itk/httpd %{buildroot}%{_sbindir}/httpd.itk
 install -m 600 %{SOURCE1} .
+install -Dm 755 itk/httpd %{buildroot}%{_sbindir}/httpd.itk
+install -Dm 600 %{SOURCE2} %{buildroot}/%{_unitdir}/%{name}.service
+
+%post
+# Register the httpd service
+if [ $1 -eq 1 ] ; then
+	# Initial installation
+	/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
+
+%preun
+if [ $1 -eq 0 ] ; then
+	# Package removal, not upgrade
+	/bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || :
+	/bin/systemctl stop %{name}.service > /dev/null 2>&1 || :
+fi
+
+%postun
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+	# Package upgrade, not uninstall
+	/bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || :
+fi
 
 %clean
 rm -rf %{buildroot}
@@ -132,8 +159,12 @@ rm -rf %{buildroot}
 %defattr(-,root,root,-)
 %doc README.Fedora
 %{_sbindir}/httpd.itk
+%{_unitdir}/%{name}.service
 
 %changelog
+* Sun Mar 18 2012 Pavel Alexeev <Pahan at Hubbitus.info> - 2.2.22-6
+- Add separate self own systemd service file and update instruction how to use it (bz#804349).
+
 * Thu Mar 8 2012 Pavel Alexeev <Pahan at Hubbitus.info> - 2.2.22-5
 - Up apr and upr-utils required BR to 1.3 (http://centos.org/modules/newbb/print.php?form=1&topic_id=35915&forum=37&order=ASC&start=0).
 	Do not build for El5 untill this requirement will be met.


More information about the scm-commits mailing list