[lighttpd] Migrate to systemd.

Jon Ciesla limb at fedoraproject.org
Mon Feb 10 15:25:35 UTC 2014


commit 8e0570522d54e71cc35ad4a058482690d4400235
Author: Jon Ciesla <limburgher at gmail.com>
Date:   Mon Feb 10 09:23:57 2014 -0600

    Migrate to systemd.

 lighttpd.spec |   61 ++++++++++++++++++++------------------------------------
 1 files changed, 22 insertions(+), 39 deletions(-)
---
diff --git a/lighttpd.spec b/lighttpd.spec
index 8a989f9..6014578 100644
--- a/lighttpd.spec
+++ b/lighttpd.spec
@@ -1,13 +1,5 @@
 %define webroot /var/www/lighttpd
 
-# RHEL4's rpm doesn't have the bcond macros
-%if 0%{?rhel} <= 4
-%define with()          %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
-%define without()       %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
-%define bcond_with()    %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
-%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
-%endif
-
 # We have an bunch of --with/--without options to pass, make it easy with bcond
 %define confswitch() %{expand:%%{?with_%{1}:--with-%{1}}%%{!?with_%{1}:--without-%{1}}}
 
@@ -18,6 +10,7 @@
 %bcond_without kerberos5
 %bcond_without pcre
 %bcond_without fam
+%bcond_with lua
 # We can't have bcond names with hyphens
 %bcond_with    webdavprops
 %bcond_with    webdavlocks
@@ -25,17 +18,10 @@
 %bcond_with    memcache
 
 # No poweredby.png image in EL5 and earlier (it's in Fedora and EL6+)
-%if 0%{?rhel} <= 5
-%bcond_with    systemlogos
-%else
+%if 0%{?el5}
 %bcond_without systemlogos
-%endif
-
-# LUA support requires lua >= 5.1 but EPEL4 provides only 5.0, so disable
-%if 0%{?rhel} <= 4
-%bcond_with    lua
 %else
-%bcond_without lua
+%bcond_without systemlogos
 %endif
 
 # The /var/run/lighttpd directory uses tmpfiles.d when mounted using tmpfs
@@ -45,8 +31,8 @@
 %bcond_with    tmpfiles
 %endif
 
-# Replace sysvinit script with systemd service file for F16+
-%if 0%{?fedora} >= 16
+# Replace sysvinit script with systemd service file for RHEL7+
+%if 0%{?fedora} || 0%{?rhel} >= 7
 %bcond_without systemd
 %else
 %bcond_with    systemd
@@ -55,7 +41,7 @@
 Summary: Lightning fast webserver with light system requirements
 Name: lighttpd
 Version: 1.4.34
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: BSD
 Group: System Environment/Daemons
 URL: http://www.lighttpd.net/
@@ -74,16 +60,16 @@ Source101: lighttpd-mod_geoip.txt
 Patch0: lighttpd-1.4.28-defaultconf.patch
 Patch1: lighttpd-1.4.34-mod_geoip.patch
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-# For the target poweredby.png image (skip requirement + provide image on RHEL)
+# For the target poweredby.png image (skip requirement + provide image on EL5)
 %if %{with systemlogos}
 Requires: system-logos >= 7.92.1
 %endif
 Requires(pre): /usr/sbin/useradd
 %if %{with systemd}
-Requires(post): systemd-units
-Requires(post): systemd-sysv
-Requires(preun): systemd-units
-Requires(postun): systemd-units
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
+BuildRequires: systemd
 %else
 Requires(post): /sbin/chkconfig
 Requires(preun): /sbin/service, /sbin/chkconfig
@@ -99,8 +85,8 @@ BuildRequires: /usr/bin/awk
 %{?with_gdbm:BuildRequires: gdbm-devel}
 %{?with_memcache:BuildRequires: memcached-devel}
 %{?with_lua:BuildRequires: lua-devel}
-# On RHEL <= 5 we still need this because of the "broken" lua
-%if 0%{?rhel} <= 5
+# On EL5 we still need this because of the "broken" lua
+%if 0%{?el5}
 BuildRequires: readline-devel
 %endif
 
@@ -199,7 +185,7 @@ mkdir -p %{buildroot}%{webroot}
 install -p -m 0644 %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} \
     %{buildroot}%{webroot}/
 
-# Symlink for the powered-by-$DISTRO image (install empty image on RHEL)
+# Symlink for the powered-by-$DISTRO image (install empty image on EL5)
 %if %{with systemlogos}
 ln -s %{_datadir}/pixmaps/poweredby.png \
 %else
@@ -241,30 +227,24 @@ rm -rf %{buildroot}
 
 %post
 %if %{with systemd}
-if [ $1 -eq 1 ] ; then 
-    /bin/systemctl daemon-reload &>/dev/null || :
-fi
+%systemd_post lighttpd.service
 %else
 /sbin/chkconfig --add lighttpd
 %endif
 
 %preun
-if [ $1 -eq 0 ]; then
 %if %{with systemd}
-    /bin/systemctl --no-reload disable lighttpd.service &>/dev/null || :
-    /bin/systemctl stop lighttpd.service &>/dev/null || :
+%systemd_preun lighttpd.service
 %else
+if [ $1 -eq 0 ]; then
     /sbin/service lighttpd stop &>/dev/null || :
     /sbin/chkconfig --del lighttpd
-%endif
 fi
+%endif
 
 %postun
 %if %{with systemd}
-/bin/systemctl daemon-reload &>/dev/null || :
-if [ $1 -ge 1 ]; then
-    /bin/systemctl try-restart lighttpd.service &>/dev/null || :
-fi
+%systemd_postun_with_restart lighttpd.service
 %else
 if [ $1 -ge 1 ]; then
     /sbin/service lighttpd condrestart &>/dev/null || :
@@ -333,6 +313,9 @@ fi
 
 
 %changelog
+* Mon Feb 10 2014 Jon Ciesla <limburgher at gmail.com> - 1.4.34-2
+- Apply Ken Dreyer's spec patches from BZ 850188.
+
 * Wed Feb 05 2014 Jon Ciesla <limburgher at gmail.com> - 1.4.34-1
 - 1.4.34, multiple security fixes.
 


More information about the scm-commits mailing list