[packages/rpm-build-macros] pass RPM_SKIP_AUTO_RESTART value of a service to %systemd_post

gotar gotar at pld-linux.org
Wed Aug 24 15:30:53 CEST 2016


commit 2aa558856f3867c114d738121603d471b82a0dec
Author: Tomasz Pala <gotar at pld-linux.org>
Date:   Wed Aug 24 15:18:21 2016 +0200

    pass RPM_SKIP_AUTO_RESTART value of a service to %systemd_post

 rpm.macros           | 8 +++++---
 service_generator.sh | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/rpm.macros b/rpm.macros
index 7edf4cf..c7d7db3 100644
--- a/rpm.macros
+++ b/rpm.macros
@@ -1434,6 +1434,9 @@ fi \
 # calls usual service restart on package %post, but skips the restart if
 # administrator has disabled automatic service restarts in either global
 # /etc/sysconfig/rpm or per service /etc/sysconfig/SERVICE file.
+# NOTE: systemd_booted machines do not print
+#		Run "{command}" to restart {service}.
+# message for packages without native systemd unit (not here, no %systemd_post).
 #
 # Usage:
 #   %service [-q] [-n] SERVICE ACTION ["SERVICE NICE DESCRIPTION"]
@@ -2217,13 +2220,13 @@ fi; \
 	/bin/systemd_booted && /bin/systemctl --quiet stop %{*} || : \
 %{nil}
 
-# doesn't honour RPM_SKIP_AUTO_RESTART, avoid using
+# NOTE: doesn't honour RPM_SKIP_AUTO_RESTART, avoid using
 %systemd_service_restart() \
 	export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
 	/bin/systemd_booted && /bin/systemctl --quiet try-restart %{*} || : \
 %{nil}
 
-# doesn't honour RPM_SKIP_AUTO_RESTART, avoid using
+# NOTE: doesn't honour RPM_SKIP_AUTO_RESTART, avoid using
 %systemd_service_reload() \
 	export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
 	/bin/systemd_booted && /bin/systemctl --quiet reload %{*} || : \
@@ -2245,7 +2248,6 @@ want_enable_service() { \
 	done \
 %{nil}
 
-# TODO: resurrect RPM_SKIP_AUTO_RESTART by using $(skip_auto_restart) function defined by %service from service_generator.sh
 %systemd_post() \
 	export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
 	/bin/systemd_booted && /bin/systemctl --quiet daemon-reload || : \
diff --git a/service_generator.sh b/service_generator.sh
index 39551a8..7fa360b 100755
--- a/service_generator.sh
+++ b/service_generator.sh
@@ -65,6 +65,7 @@ if [ "$check" = 1 ]; then
 			if [ -f /var/lock/subsys/$service ]; then
 				echo 'Run "/sbin/service $service restart" to restart $desc.'
 			fi
+		else	NORESTART=1	# for %systemd_post if called after
 		fi
 	EOF
 	echo 'fi'
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-macros.git/commitdiff/15bb28975891c3661d6a0671b1d8febc91e72496



More information about the pld-cvs-commit mailing list