SPECS: apache.spec - %posttrans to minimize apache restarts commited
glen
glen at pld-linux.org
Wed Sep 21 18:40:34 CEST 2005
Author: glen Date: Wed Sep 21 16:40:34 2005 GMT
Module: SPECS Tag: HEAD
---- Log message:
- %posttrans to minimize apache restarts commited
---- Files affected:
SPECS:
apache.spec (1.408 -> 1.409)
---- Diffs:
================================================================
Index: SPECS/apache.spec
diff -u SPECS/apache.spec:1.408 SPECS/apache.spec:1.409
--- SPECS/apache.spec:1.408 Fri Sep 16 23:44:51 2005
+++ SPECS/apache.spec Wed Sep 21 18:40:28 2005
@@ -17,7 +17,9 @@
# - check if all modules (*.so) are exactly the same for different MPMs
# - install stage fails with distcc (make -jN)
# - /var/run/apache is also owned by apache1.spec, so rename it to /var/run/httpd spec here (NOTE: if you fix this also adjust apache-mod_fastcgi.spec)
+# - does main package really need apxs dep?
# - review: http://securitytracker.com/alerts/2005/Aug/1014826.html
+# - http://www.gentoo.org/security/en/glsa/glsa-200509-12.xml (ssl and pcre)
#
# Conditional build:
%bcond_without ssl # build without SSL support
@@ -106,9 +108,10 @@
%{?with_ssl:BuildRequires: openssl-tools >= 0.9.7d}
%{?with_external_pcre:BuildRequires: pcre-devel}
BuildRequires: perl-devel >= 1:5.6
+BuildRequires: rpm-build >= 4.4.0
BuildRequires: postgresql-devel
BuildRequires: rpm-perlprov >= 4.1-13
-BuildRequires: rpmbuild(macros) >= 1.202
+BuildRequires: rpmbuild(macros) >= 1.228
BuildRequires: zlib-devel
PreReq: perl-base
PreReq: rc-scripts >= 0.4.0.15
@@ -148,6 +151,8 @@
Provides: webserver = apache
Obsoletes: apache-extra
Obsoletes: apache6
+# 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 _sysconfdir /etc/httpd
@@ -1003,11 +1008,6 @@
/sbin/chkconfig --add httpd
umask 137
touch /var/log/httpd/{access,error,agent,referer}_log
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
%preun
if [ "$1" = "0" ]; then
@@ -1047,354 +1047,183 @@
mv -f /etc/sysconfig/{apache.rpmsave,httpd}
fi
-%post mod_actions
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%posttrans
+# minimizing apache 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 apache modules and
+# main package are very important for all this to work.
-%preun mod_actions
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
+# restart webserver at the end of transaction
+%service httpd restart
+
+# macro called at module post scriptlet
+%define module_post \
+if [ "$1" = "1" ]; then \
+ %service -q httpd restart \
+fi
+
+# macro called at module postun scriptlet
+%define module_postun \
+if [ "$1" = "0" ]; then \
+ %service -q httpd restart \
fi
+%post mod_actions
+%module_post
+
+%postun mod_actions
+%module_postun
+
%post mod_auth
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_auth
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_auth
+%module_postun
%post mod_auth_anon
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_auth_anon
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_auth_anon
+%module_postun
%post mod_auth_dbm
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_auth_dbm
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_auth_dbm
+%module_postun
%post mod_autoindex
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_autoindex
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_autoindex
+%module_postun
%post mod_cache
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_cache
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_cache
+%module_postun
%post mod_cgid
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_cgid
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_cgid
+%module_postun
%post mod_charset_lite
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_charset_lite
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_charset_lite
+%module_postun
%post mod_dav
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_dav
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_dav
+%module_postun
%post mod_auth_digest
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_auth_digest
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_auth_digest
+%module_postun
%post mod_deflate
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_deflate
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_deflate
+%module_postun
%post mod_dir
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_dir
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_dir
+%module_postun
%post mod_expires
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_expires
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_expires
+%module_postun
%post mod_file_cache
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_file_cache
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_file_cache
+%module_postun
%post mod_headers
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_headers
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_headers
+%module_postun
%post mod_imap
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_imap
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_imap
+%module_postun
%post mod_info
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_info
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_info
+%module_postun
%post mod_proxy
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_proxy
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_proxy
+%module_postun
%post mod_rewrite
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_rewrite
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_rewrite
+%module_postun
%post mod_ssl
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_ssl
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_ssl
+%module_postun
%post mod_status
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_status
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_status
+%module_postun
%post mod_usertrack
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_usertrack
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_usertrack
+%module_postun
%post mod_unique_id
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_unique_id
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_unique_id
+%module_postun
%post mod_vhost_alias
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
-fi
+%module_post
-%preun mod_vhost_alias
-if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
-fi
+%postun mod_vhost_alias
+%module_postun
%post cgi_test
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-else
- echo "Run \"/etc/rc.d/init.d/httpd start\" to start apache HTTP daemon."
+if [ "$1" = "1" ]; then
+ %service -q httpd reload
fi
-%preun cgi_test
+%postun cgi_test
if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
+ %service -q httpd reload
fi
%files
@@ -1833,6 +1662,9 @@
All persons listed below can be reached at <cvs_login>@pld-linux.org
$Log$
+Revision 1.409 2005/09/21 16:40:28 glen
+- %posttrans to minimize apache restarts commited
+
Revision 1.408 2005/09/16 21:44:51 adamg
- BuildRequires: postgresql-devel (thx to kamyk for noticing that one)
@@ -1860,8 +1692,8 @@
- unify poldek upgrade script
Revision 1.400 2005/07/08 20:42:57 twittner
-- use %%banner macro instead of `echo' (not tested)
-- formatting %%banner messages
+- use %banner macro instead of `echo' (not tested)
+- formatting %banner messages
Revision 1.399 2005/07/08 17:54:24 paszczus
- should be s/form/from/g as i think
================================================================
---- CVS-web:
http://cvs.pld-linux.org/SPECS/apache.spec?r1=1.408&r2=1.409&f=u
More information about the pld-cvs-commit
mailing list