diff options
author | Colin Guthrie <colin@mageia.org> | 2011-11-03 10:08:04 +0000 |
---|---|---|
committer | Colin Guthrie <colin@mageia.org> | 2011-11-03 10:08:04 +0000 |
commit | 4d8033547dd28b3f15a5232cb3d2dfd706864d68 (patch) | |
tree | 85749f1e96f7fbf0bec6d0f3ac74ab68fe5cf077 | |
parent | ba0cef25f5b93d5d03e62b5ffdbc64a01b8c7c5c (diff) | |
download | rpm-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.
-rw-r--r-- | NEWS | 1 | ||||
-rwxr-xr-x | reread-services | 31 | ||||
-rw-r--r-- | rpm-helper.macros.in | 4 |
3 files changed, 36 insertions, 0 deletions
@@ -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} |