SPECS: lighttpd.spec - use %posttrans scriptlet to restart webserv...

glen glen at pld-linux.org
Sun Jan 15 12:23:35 CET 2006


Author: glen                         Date: Sun Jan 15 11:23:35 2006 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- use %posttrans scriptlet to restart webserver once and after all modules have
  been upgraded, so that webserver isn't restarted at the middle of upgrade
  which can make it die because version mismatch of not-yet-upgraded module
  package.
- rel 1

---- Files affected:
SPECS:
   lighttpd.spec (1.153 -> 1.154) 

---- Diffs:

================================================================
Index: SPECS/lighttpd.spec
diff -u SPECS/lighttpd.spec:1.153 SPECS/lighttpd.spec:1.154
--- SPECS/lighttpd.spec:1.153	Sun Jan 15 11:08:42 2006
+++ SPECS/lighttpd.spec	Sun Jan 15 12:23:29 2006
@@ -37,15 +37,15 @@
 %define _source http://www.lighttpd.net/download/%{name}-%{version}.tar.gz
 %endif
 
-%define		_rel 0.1
+%define		_rel 1
 
 Summary:	Fast and light HTTP server
 Summary(pl):	Szybki i lekki serwer HTTP
 Name:		lighttpd
 Version:	1.4.9
 Release:	%{_rel}%{?_snap:.%(echo %{_snap}|tr - _)}
-Group:		Networking/Daemons
 License:	BSD
+Group:		Networking/Daemons
 Source0:	%{_source}
 # Source0-md5:	20a171774a0615069de3704db52483aa
 Source1:	%{name}.init
@@ -63,7 +63,7 @@
 Source10:	http://gdl.hopto.org/~spider/pldstats/gfx/pld1.png
 # Source10-md5:	486ecec3f6f4fe7f9bf7cee757b864f4
 Source11:	%{name}-pld.html
-Patch0:	%{name}-proxy-fix-redirects.patch
+Patch0:		%{name}-proxy-fix-redirects.patch
 URL:		http://www.lighttpd.net/
 %{?with_xattr:BuildRequires:	attr-devel}
 BuildRequires:	autoconf
@@ -92,12 +92,13 @@
 Requires(pre):	/usr/bin/getgid
 Requires(pre):	/usr/sbin/groupadd
 Requires(pre):	/usr/sbin/useradd
-Requires(pre):	sh-utils
 Requires:	rc-scripts
 Provides:	group(http)
 Provides:	group(lighttpd)
 Provides:	user(lighttpd)
 Provides:	webserver
+# for the posttrans scriptlet, conflicts because in vserver environment rpm package is not installed.
+Conflicts:	rpm < 4.4.2-0.2
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define		_libdir		%{_prefix}/%{_lib}/%{name}
@@ -309,8 +310,6 @@
 
 %post
 /sbin/chkconfig --add %{name}
-%service %{name} restart "LigHTTPd webserver"
-exit 0
 
 %preun
 if [ "$1" = "0" ]; then
@@ -325,6 +324,44 @@
 	%groupremove http
 fi
 
+%posttrans
+# minimizing lighttpd restarts logics. we restart webserver:
+#
+# 1. at the end of transaction. (posttrans, feature from rpm 4.4.2)
+# 2. first install of module (post: $1 = 1)
+# 2. uninstall of module (postun: $1 == 0)
+#
+# the strict internal deps between lighttpd modules and
+# main package are very important for all this to work.
+%service %{name} restart "LigHTTPd webserver"
+exit 0
+
+# macro called at module post scriptlet
+%define	module_post \
+if [ "$1" = "1" ]; then \
+	%service -q lighttpd restart \
+fi
+
+# macro called at module postun scriptlet
+%define	module_postun \
+if [ "$1" = "0" ]; then \
+	%service -q lighttpd restart \
+fi
+
+# it's sooo annoying to write them
+%define	module_scripts() \
+%post %1 \
+%module_post \
+\
+%postun %1 \
+%module_postun
+
+%module_scripts mod_compress
+%module_scripts mod_cml
+%module_scripts mod_mysql_vhost
+%module_scripts mod_trigger_b4_dl
+%module_scripts mod_webdav
+
 %triggerpostun -- %{name} <= 1.3.6-2
 # upgraded
 if [ "$1" = "2" ]; then
@@ -415,6 +452,13 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.154  2006/01/15 11:23:29  glen
+- use %posttrans scriptlet to restart webserver once and after all modules have
+  been upgraded, so that webserver isn't restarted at the middle of upgrade
+  which can make it die because version mismatch of not-yet-upgraded module
+  package.
+- rel 1
+
 Revision 1.153  2006/01/15 10:08:42  paszczus
 - updated to FINAL 1.4.9
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/lighttpd.spec?r1=1.153&r2=1.154&f=u



More information about the pld-cvs-commit mailing list