]> git.pld-linux.org Git - packages/rpm-build-macros.git/blobdiff - rpm.macros
- 1.631: when service restart was disabled, print restart message
[packages/rpm-build-macros.git] / rpm.macros
index c419c2232718fb6791f19644872d2d572f718151..8093b1fd1861c0ae637f1dbd5029adf8ef9f200d 100644 (file)
@@ -560,7 +560,7 @@ if [ -d "$RPM_BUILD_ROOT" ]; then \
                        modulecount=$(echo "$modulelist" | wc -l); \
                        printf "Stripping %d kernel modules..." $modulecount; \
                        echo "$modulelist" | xargs -l512 chmod u+w; \
-                       echo "$modulelist" | xargs -l512 %{__strip} --strip-unneeded --remove-section=.comment --remove-section=.note.GNU-stack; \
+                       echo "$modulelist" | xargs -l512 %{__strip} -g --remove-section=.comment --remove-section=.note.GNU-stack; \
                        echo "DONE"; \
                fi; \
        fi; \
@@ -1244,8 +1244,7 @@ fi \
 # Requires:    rc-scripts
 # -n option:
 # BuildRequires:       rpmbuild(macros) >= 1.450
-%service(qn) {{%(export noop=%{-n:1} quiet=%{-q:1}; /usr/lib/rpm/service_generator.sh %{*}) };}
-
+%service(qn) {{%(export noop=%{-n:1} quiet=%{-q:1} RPM_BUILD_ROOT=%{buildroot}; /usr/lib/rpm/service_generator.sh %{*}) };}
 
 # Java macros. based on jpackage macros.java
 #
@@ -1984,10 +1983,15 @@ else: \
 # %cacti_import_template %{resourcedir}/cacti_host_template_varnish.xml
 #
 # Requires:    cacti >= 0.8.7e-8
-# BuildRequires:       rpmbuild(macros) >= 1.554
+# BuildRequires:       rpmbuild(macros) >= 1.630
+# Note: 1.1 (cacti-0.8.7h) adds requirement for --with-template-rras or --with-user-rras option
 
 %cacti_import_template() {\
-/usr/share/cacti/cli/import_template.php --filename=%1 || :; \
+v=$(%{__sed} -rne 's/.+Add Graphs Script ([0-9\.]+).+/\1/p' /usr/share/cacti/cli/import_template.php); \
+if [ "$v" != "1.0" ]; then \
+       rra="--with-template-rras"; \
+fi; \
+/usr/share/cacti/cli/import_template.php --filename=%1 $rra || :; \
 }%{nil}
 
 # pre/post script for -upstart subpackages
@@ -2045,50 +2049,49 @@ else: \
 # Author: Bartlomiej Zimon <uzi18@o2.pl>
 #
 # Usage:
-# %systemd_post
-# %systemd_enable service_name.service
-# %systemd_preun  service_name.service
-# %systemd_postun service_name.service
+# %systemd_reload
+# %systemd_post service_name1.service service_name2.service
+# %systemd_preun  service_name1.service service_name2.service
 #
 # Sample:
 # %post systemd
-# %systemd_post
+# %systemd_reload
 # or if service must be enabled by default:
 # %post systemd
-# %systemd_post
-# %systemd_enable %{name}
+# %systemd_post %{name}.service
 #
 # %preun systemd
-# %systemd_preun %{name}
+# %systemd_preun %{name}.service
 #
 # %postun systemd
-# %systemd_postun %{name}
+# %systemd_reload
 #
 # Requirements:
-# BuildRequires: rpmbuild(macros) >= 1.622
-# Requires:     rc-scripts >= ...
+# BuildRequires: rpmbuild(macros) >= 1.627
+# Requires:     systemd-units >= 37-0.10
 
-%systemd_enable() \
-       if [ $1 -eq 1 ]; then  \
-               /bin/systemctl enable %1 >/dev/null 2>&1 || : \
-       fi
+%systemd_reload /bin/systemd_booted && SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog /bin/systemctl --quiet daemon-reload || :
 
 %systemd_post() \
+       export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
+       /bin/systemd_booted && /bin/systemctl --quiet daemon-reload || : \
        if [ $1 -eq 1 ]; then \
-               /bin/systemctl daemon-reload >/dev/null 2>&1 || : \
-       fi
+               /bin/systemctl --quiet enable %{*} || : \
+       fi \
+       if [ $1 -gt 1 ] && [ -z "$NORESTART" ]; then \
+               /bin/systemctl --quiet try-restart %{*} || : \
+       fi \
+%{nil}
 
 %systemd_preun() \
        if [ $1 -eq 0 ]; then \
-               /bin/systemctl --no-reload disable %1 > /dev/null 2>&1 || : \
-               /bin/systemctl stop %1 > /dev/null 2>&1 || : \
-       fi
-
-%systemd_postun() \
-    /bin/systemctl daemon-reload >/dev/null 2>&1 || : \
-    if [ $1 -ge 1 ]; then \
-               /bin/systemctl try-restart %1 >/dev/null 2>&1 || : \
-       fi
+               export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog; \
+               /bin/systemctl --no-reload --quiet disable %{*} || : \
+               if /bin/systemd_booted; then \
+                       /bin/systemctl --quiet stop %{*} || : \
+               fi \
+       fi \
+%{nil}
 
 %systemdunitdir /lib/systemd/system
 
This page took 0.078159 seconds and 4 git commands to generate.