commit 6d00ffc321fcd5cd4bfd35bce8172e158c836ea6 Author: Elan Ruusamäe <g...@delfi.ee> Date: Wed Oct 19 23:45:33 2016 +0300
restart webserver when adding/removing modules ... but not when upgrading whole set ripped from apache.spec where such process already done decade ago nginx.spec | 52 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) --- diff --git a/nginx.spec b/nginx.spec index a18274e..daa05f8 100644 --- a/nginx.spec +++ b/nginx.spec @@ -42,7 +42,7 @@ Summary(pl.UTF-8): Serwer HTTP i odwrotne proxy o wysokiej wydajności # - mainline: production quality but API can change Name: nginx Version: 1.11.5 -Release: 0.5 +Release: 0.6 License: BSD-like Group: Networking/Daemons/HTTP Source0: http://nginx.org/download/%{name}-%{version}.tar.gz @@ -117,11 +117,48 @@ Requires(pre): /usr/sbin/useradd Requires: rc-scripts >= 0.2.0 Requires: systemd-units >= 38 Suggests: vim-syntax-nginx +Conflicts: rpm < 4.4.2-0.2 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) %define _sysconfdir /etc/%{name} %define _nginxdir /home/services/%{name} +# minimizing 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 modules and +# main package are very important for all this to work. + +# restart webserver at the end of transaction + +%define restart_webserver \ + %systemd_post %{name}.service \ + %service %{name} force-reload \ + %{nil} + +# macro called at module post scriptlet +%define module_post \ +if [ "$1" = "1" ]; then \ + %restart_webserver \ +fi + +# macro called at module postun scriptlet +%define module_postun \ +if [ "$1" = "0" ]; then \ + %restart_webserver \ +fi + +# it's sooo annoying to write them +%define module_scripts() \ +%post %1 \ +%module_post \ +\ +%postun %1 \ +%module_postun + %description nginx ("engine x") is a high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. nginx was written by Igor @@ -370,8 +407,9 @@ for a in access.log error.log; do fi done /sbin/chkconfig --add %{name} -%systemd_post %{name}.service -%service %{name} force-reload + +%posttrans +%restart_webserver %preun if [ "$1" = "0" ];then @@ -387,6 +425,14 @@ if [ "$1" = "0" ]; then fi %systemd_reload +%module_scripts mod_http_geoip +%module_scripts mod_http_image_filter +%module_scripts mod_http_perl +%module_scripts mod_http_xslt_filter +%module_scripts mod_mail +%module_scripts mod_stream +%module_scripts mod_stream_geoip + %files %defattr(644,root,root,755) %doc CHANGES LICENSE README html/index.html conf/nginx.conf ================================================================ ---- gitweb: http://git.pld-linux.org/gitweb.cgi/packages/nginx.git/commitdiff/6d00ffc321fcd5cd4bfd35bce8172e158c836ea6 _______________________________________________ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit