From 35447b830b5428e807c0715e9b2d7905d69c0a26 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Wed, 21 Sep 2005 16:40:28 +0000 Subject: [PATCH] - %posttrans to minimize apache restarts commited Changed files: apache.spec -> 1.409 --- apache.spec | 383 +++++++++++++++------------------------------------- 1 file changed, 106 insertions(+), 277 deletions(-) diff --git a/apache.spec b/apache.spec index 4820b72..dabbf8f 100644 --- a/apache.spec +++ b/apache.spec @@ -16,7 +16,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 @@ -105,9 +107,10 @@ BuildRequires: libtool >= 2:1.5 %{?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 @@ -147,6 +150,8 @@ Provides: user(http) 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 @@ -1002,11 +1007,6 @@ rm -rf $RPM_BUILD_ROOT /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 @@ -1046,354 +1046,183 @@ if [ -f /etc/sysconfig/apache.rpmsave ]; then 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." +%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. + +# 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 -%preun mod_actions -if [ "$1" = "0" ]; then - if [ -f /var/lock/subsys/httpd ]; then - /etc/rc.d/init.d/httpd restart 1>&2 - 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 -- 2.44.0