aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rwxr-xr-xreread-services31
-rw-r--r--rpm-helper.macros.in4
3 files changed, 36 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 7111fc5..d396f48 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
2011-11-03 Colin Guthrie <colin@mageia.org> 0.24.3
* normalise systemd unit names when created from sysvinit service name
to ensure symlinked units are not used to enable/disable services
+ * add a new helper to reload systemd (reread unit files) on %postun
2011-10-30 Colin Guthrie <colin@mageia.org> 0.24.2
* change how systemd units are passed to the helper to synthesise
diff --git a/reread-services b/reread-services
new file mode 100755
index 0000000..73092d6
--- /dev/null
+++ b/reread-services
@@ -0,0 +1,31 @@
+#!/bin/sh
+#---------------------------------------------------------------
+# Project : Mageia Linux
+# Module : rpm-helper
+# File : reread-services
+# Version : $Id$
+# Authors : Colin Guthrie
+# Created On : Thu Nov 3 10:00:00 2011
+# Purpose : helper script for rpm scriptlets to ensure
+# a service is reread by the init system
+#---------------------------------------------------------------
+
+if [ $# -lt 1 ]; then
+ echo "usage: $0 <pkg name>" 1>&2
+ exit 1
+fi
+
+# What init system are we currently using?
+if /bin/mountpoint -q /sys/fs/cgroup/systemd; then
+ init=systemd
+else
+ init=sysvinit
+fi
+
+pkg=$1 # name of the package
+
+if [ x$init = xsystemd ]; then
+ /bin/systemctl daemon-reload || :
+fi
+
+# reread-services ends here
diff --git a/rpm-helper.macros.in b/rpm-helper.macros.in
index 813b65b..2c88716 100644
--- a/rpm-helper.macros.in
+++ b/rpm-helper.macros.in
@@ -22,6 +22,10 @@
%_preun_service() %_del_service_helper %{name} $1 %{*} \
%{nil}
+%_reread_services_helper %_rpm_helper_dir/reread-services
+%_postun_service() %_reread_services_helper %{name} \
+%{nil}
+
%_add_user_helper %_rpm_helper_dir/add-user
%_pre_useradd() %_add_user_helper %{name} $1 %{1} %{2} %{3} \
%{nil}