[thttpd/f22] SPEC cleanup.

Christopher Meng cicku at fedoraproject.org
Tue Feb 17 03:36:44 UTC 2015


commit 2607638df75c667dde9d9ecbc42da6bdb53b29fa
Author: Christopher Meng <i at cicku.me>
Date:   Tue Feb 17 11:36:07 2015 +0800

    SPEC cleanup.

 thttpd.spec |  109 ++++++++++++++++++++++++----------------------------------
 1 files changed, 45 insertions(+), 64 deletions(-)
---
diff --git a/thttpd.spec b/thttpd.spec
index 93f17da..3420db2 100644
--- a/thttpd.spec
+++ b/thttpd.spec
@@ -1,41 +1,39 @@
 # Where the default web root will be configured and default files installed
-%define webroot /var/www/thttpd
-
-Summary: Tiny, turbo, throttleable lightweight http server
-Name: thttpd
-Version: 2.25b
-Release: 33%{?dist}
-License: BSD
-Group: System Environment/Daemons
-URL: http://www.acme.com/software/thttpd/
-Source0: http://www.acme.com/software/thttpd/thttpd-%{version}.tar.gz
-Source1: thttpd.service
-Source2: thttpd.logrotate
-Source10: index.html
-Source11: thttpd_powered_3.png
-Patch0: thttpd-2.25b-CVE-2005-3124.patch
-Patch1: thttpd-2.25b-fixes.patch
-Patch2: thttpd-2.25b-getline.patch
-Requires: system-logos >= 7.92.1
-BuildRequires: systemd-units
-Requires(pre): /usr/sbin/useradd, /usr/sbin/groupadd
+%global webroot /var/www/thttpd
+
+Name:           thttpd
+Version:        2.25b
+Release:        33%{?dist}
+Summary:        Tiny, turbo, throttleable lightweight http server
+License:        BSD
+URL:            http://www.acme.com/software/thttpd/
+Source0:        http://www.acme.com/software/thttpd/thttpd-%{version}.tar.gz
+Source1:        thttpd.service
+Source2:        thttpd.logrotate
+Source10:       index.html
+Source11:       thttpd_powered_3.png
+Patch0:         thttpd-2.25b-CVE-2005-3124.patch
+Patch1:         thttpd-2.25b-fixes.patch
+Patch2:         thttpd-2.25b-getline.patch
+BuildRequires:  systemd
+Requires:       system-logos >= 7.92.1
+Requires(pre):  shadow-utils
 Requires(post): systemd-sysv
-Requires(post): systemd-units
-Requires(preun): systemd-units
-Requires(postun): systemd-units
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
 
 %description
 Thttpd is a very compact no-frills httpd serving daemon that can handle
-very high loads.  While lacking many of the advanced features of
-Apache, thttpd operates without forking and is extremely efficient in
-memory use.  Basic support for cgi scripts, authentication, and ssi is
-provided for.  Advanced features include the ability to throttle traffic.
+very high loads. While lacking many of the advanced features of Apache, 
+thttpd operates without forking and is extremely efficient in memory use. 
+Basic support for cgi scripts, authentication, and ssi is provided for. 
+Advanced features include the ability to throttle traffic.
 
 Available rpmbuild rebuild options :
 --with : showversion expliciterrors makeweb
 --without : indexes
 
-
 %prep
 %setup -q
 %patch0 -p1 -b .CVE-2005-3124
@@ -44,10 +42,9 @@ Available rpmbuild rebuild options :
 # Convert man pages to UTF8
 for man in *.8 */*.8 */*.1; do
     iconv -f iso8859-1 -t utf-8 -o tmp ${man}
-    %{__mv} -f tmp ${man}
+    mv -f tmp ${man}
 done
 
-
 %build
 %configure
 # Hacks :-)
@@ -59,44 +56,42 @@ done
 %{!?_with_showversion:    %{__perl} -pi -e 's/#define SHOW_SERVER_VERSION/#undef SHOW_SERVER_VERSION/g' config.h}
 %{!?_with_expliciterrors: %{__perl} -pi -e 's/#define EXPLICIT_ERROR_PAGES/#undef EXPLICIT_ERROR_PAGES/g' config.h}
 # (list SUBDIRS to exclude "cgi-src")
-%{__make} %{?_smp_mflags} SUBDIRS="extras" WEBDIR=%{webroot} STATICFLAG="" \
+%make_build SUBDIRS="extras" WEBDIR=%{webroot} STATICFLAG="" \
     CCOPT="%{optflags} -D_FILE_OFFSET_BITS=64"
 
-
 %install
 # Prepare required directories
-%{__mkdir_p} %{buildroot}%{webroot}
-%{__mkdir_p} %{buildroot}%{_mandir}/man{1,8}
-%{__mkdir_p} %{buildroot}%{_sbindir}
-%{__mkdir_p} %{buildroot}%{_unitdir}
+mkdir -p %{buildroot}%{webroot}          \
+         %{buildroot}%{_mandir}/man{1,8} \
+         %{buildroot}%{_sbindir}         \
+         %{buildroot}%{_unitdir}
 
 # Install init script and logrotate entry
-%{__install} -Dpm 0644 %{SOURCE1} %{buildroot}%{_unitdir}/
-%{__install} -Dpm 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/thttpd
+install -Dpm0644 %{SOURCE1} %{buildroot}%{_unitdir}/
+install -Dpm0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/thttpd
 
 # Main install (list SUBDIRS to exclude "cgi-src")
-%{__make} install SUBDIRS="extras" \
+make install SUBDIRS="extras" \
     BINDIR=%{buildroot}%{_sbindir} \
     MANDIR=%{buildroot}%{_mandir} \
     WEBDIR=%{buildroot}%{webroot}
 
 # Rename htpasswd in case apache is installed too
-%{__mkdir_p} %{buildroot}%{_bindir}
-%{__mv} %{buildroot}%{_sbindir}/htpasswd \
+mkdir -p %{buildroot}%{_bindir}
+mv %{buildroot}%{_sbindir}/htpasswd \
         %{buildroot}%{_bindir}/thtpasswd
-%{__mv} %{buildroot}%{_mandir}/man1/htpasswd.1 \
+mv %{buildroot}%{_mandir}/man1/htpasswd.1 \
         %{buildroot}%{_mandir}/man1/thtpasswd.1
 
 # Install the default index.html and related files
-%{__install} -pm 0644 %{SOURCE10} %{SOURCE11} \
+install -pm0644 %{SOURCE10} %{SOURCE11} \
     %{buildroot}%{webroot}/
 
 # Symlink for the powered-by-$DISTRO image
-%{__ln_s} %{_datadir}/pixmaps/poweredby.png \
-    %{buildroot}%{webroot}/poweredby.png
+ln -s %{_datadir}/pixmaps/poweredby.png %{buildroot}%{webroot}/poweredby.png
 
 # Install a default configuration file
-%{__cat} << EOF > %{buildroot}%{_sysconfdir}/thttpd.conf
+cat << EOF > %{buildroot}%{_sysconfdir}/thttpd.conf
 # BEWARE : No empty lines are allowed!
 # This section overrides defaults
 dir=%{webroot}
@@ -114,31 +109,19 @@ pidfile=/var/run/thttpd.pid
 # charset=iso-8859-1
 EOF
 
-
 %pre
 /usr/sbin/groupadd -r www &>/dev/null || :
-/usr/sbin/useradd -s /bin/false -c "Web server user" \
+/usr/sbin/useradd -s /bin/false -c "Thttpd Web Server User" \
     -d %{webroot} -M -r -g www thttpd &>/dev/null || :
 
 %post
-if [ $1 -eq 1 ] ; then 
-    # Initial installation 
-    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
-fi
+%systemd_post %{SOURCE1}
 
 %preun
-if [ $1 -eq 0 ] ; then
-    # Package removal, not upgrade
-    /bin/systemctl --no-reload disable thttpd.service > /dev/null 2>&1 || :
-    /bin/systemctl stop thttpd.service > /dev/null 2>&1 || :
-fi
+%systemd_preun %{SOURCE1}
 
 %postun
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ] ; then
-    # Package upgrade, not uninstall
-    /bin/systemctl try-restart thttpd.service >/dev/null 2>&1 || :
-fi
+%systemd_postun %{SOURCE1}
 
 %triggerun -- thttpd < 2.25b-25
 # Save the current service runlevel info
@@ -150,7 +133,6 @@ fi
 /sbin/chkconfig --del thttpd >/dev/null 2>&1 || :
 /bin/systemctl try-restart thttpd.service >/dev/null 2>&1 || :
 
-
 %files
 %doc README TODO
 %{_unitdir}/thttpd.service
@@ -173,7 +155,6 @@ fi
 # Hack to own parent directory for the default "webroot". Remove if needed.
 %dir /var/www
 
-
 %changelog
 * Thu Aug 21 2014 Kevin Fenzi <kevin at scrye.com> - 2.25b-33
 - Rebuild for rpm bug 1131960


More information about the scm-commits mailing list