]> 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 66c418a89c448a553d2d96838b2848574bb6bb2b..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
@@ -2039,4 +2043,56 @@ else: \
 };} \
 %{nil}
 
+
+# pre/post script for -systemd subpackages
+#
+# Author: Bartlomiej Zimon <uzi18@o2.pl>
+#
+# Usage:
+# %systemd_reload
+# %systemd_post service_name1.service service_name2.service
+# %systemd_preun  service_name1.service service_name2.service
+#
+# Sample:
+# %post systemd
+# %systemd_reload
+# or if service must be enabled by default:
+# %post systemd
+# %systemd_post %{name}.service
+#
+# %preun systemd
+# %systemd_preun %{name}.service
+#
+# %postun systemd
+# %systemd_reload
+#
+# Requirements:
+# BuildRequires: rpmbuild(macros) >= 1.627
+# Requires:     systemd-units >= 37-0.10
+
+%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 --quiet enable %{*} || : \
+       fi \
+       if [ $1 -gt 1 ] && [ -z "$NORESTART" ]; then \
+               /bin/systemctl --quiet try-restart %{*} || : \
+       fi \
+%{nil}
+
+%systemd_preun() \
+       if [ $1 -eq 0 ]; then \
+               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
+
 # EOF
This page took 0.030689 seconds and 4 git commands to generate.