]> git.pld-linux.org Git - packages/rpm-pld-macros.git/blobdiff - rpm.macros
- introduce %systemd_reload macro
[packages/rpm-pld-macros.git] / rpm.macros
index 66c418a89c448a553d2d96838b2848574bb6bb2b..5875e026e475689e6515047b6bc8927b67d532ed 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; \
@@ -2039,4 +2039,54 @@ 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.626
+# 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 ]; then \
+               /bin/systemctl --quiet try-restart %{*} || : \
+       fi \
+
+%systemd_preun() \
+       if [ $1 -eq 0 ]; then \
+               export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog; \
+               /bin/systemctl --no-reaload --quiet disable %{*} || : \
+               if /bin/systemd_booted; then \
+                       /bin/systemctl --quiet stop %{*} || : \
+               fi \
+       fi
+
+%systemdunitdir /lib/systemd/system
+
 # EOF
This page took 0.101262 seconds and 4 git commands to generate.