aboutsummaryrefslogtreecommitdiffstats
path: root/reread-services
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2011-11-03 10:08:04 +0000
committerColin Guthrie <colin@mageia.org>2011-11-03 10:08:04 +0000
commit4d8033547dd28b3f15a5232cb3d2dfd706864d68 (patch)
tree85749f1e96f7fbf0bec6d0f3ac74ab68fe5cf077 /reread-services
parentba0cef25f5b93d5d03e62b5ffdbc64a01b8c7c5c (diff)
downloadrpm-helper-4d8033547dd28b3f15a5232cb3d2dfd706864d68.tar
rpm-helper-4d8033547dd28b3f15a5232cb3d2dfd706864d68.tar.gz
rpm-helper-4d8033547dd28b3f15a5232cb3d2dfd706864d68.tar.bz2
rpm-helper-4d8033547dd28b3f15a5232cb3d2dfd706864d68.tar.xz
rpm-helper-4d8033547dd28b3f15a5232cb3d2dfd706864d68.zip
Add a new service helper for postun.
At the moment this is only used to reload systemd if it's running.
Diffstat (limited to 'reread-services')
-rwxr-xr-xreread-services31
1 files changed, 31 insertions, 0 deletions
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