diff options
author | Dexter Morgan <dmorgan@mageia.org> | 2011-10-27 22:47:46 +0000 |
---|---|---|
committer | Dexter Morgan <dmorgan@mageia.org> | 2011-10-27 22:47:46 +0000 |
commit | c64fa938609c6bee9dd02adc1a37df89a9ebd116 (patch) | |
tree | 20da84dbd8cc32fb518e4bf777359664dba63a88 /postun-unit | |
parent | b1c56622b1c4a3e390de269e8c28af133f2472c9 (diff) | |
download | rpm-helper-c64fa938609c6bee9dd02adc1a37df89a9ebd116.tar rpm-helper-c64fa938609c6bee9dd02adc1a37df89a9ebd116.tar.gz rpm-helper-c64fa938609c6bee9dd02adc1a37df89a9ebd116.tar.bz2 rpm-helper-c64fa938609c6bee9dd02adc1a37df89a9ebd116.tar.xz rpm-helper-c64fa938609c6bee9dd02adc1a37df89a9ebd116.zip |
Add systemd support ( mdv )
Diffstat (limited to 'postun-unit')
-rwxr-xr-x | postun-unit | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/postun-unit b/postun-unit new file mode 100755 index 0000000..dfc4b82 --- /dev/null +++ b/postun-unit @@ -0,0 +1,40 @@ +#!/bin/sh +#--------------------------------------------------------------- +# Project : Mandriva Linux +# Module : rpm-helper +# File : postun-unit +# Version : $Id$ +# Authors : Andrey Borzenkov +# Created On : Sat Mar 12 18:05:00 2011 +# Purpose : helper script for rpm scriptlets to remove a +# systemd unit. +#--------------------------------------------------------------- + +# Reload systemd configuration and try to restart units +# It has to be done in postun because package removal may delete +# some links and we need to inform systemd about it + +/bin/mountpoint -q /sys/fs/cgroup/systemd || exit 0 + +if [ $# -lt 3 ]; then + echo "usage: $0 <pkg name> <number installed> <unit> ..." 1>&2 + exit 1 +fi + +pkg=$1 # name of the package +num=$2 # number of packages installed +shift 2 # systemd units + +/bin/systemctl daemon-reload + +if [ $num -ge 1 ]; then + if [ -z "$DURING_INSTALL" ]; then + # New package may have removed some units so restart will + # fail for them; catch it. + # TODO find a way to pass parameters from current packages + # into script installed by previous version + /bin/systemctl try-restart "$@" || : + fi +fi + +# postun-unit ends here |