diff options
Diffstat (limited to 'migrate-service')
-rwxr-xr-x | migrate-service | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/migrate-service b/migrate-service deleted file mode 100755 index de08435..0000000 --- a/migrate-service +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -#--------------------------------------------------------------- -# Project : Mandriva Linux -# Module : rpm-helper -# File : migrate-service -# Version : $Id$ -# Authors : Andrey Borzenkov -# Created On : Sat Mar 12 18:37:00 2011 -# Purpose : helper script for rpm scriptlets to migrate -# from SysV script to systemd unit. -#--------------------------------------------------------------- - -if [ $# -lt 3 ]; then - echo "usage: $0 {pre|post} <service name> <unit name> ..." 1>&2 - exit 1 -fi - -phase=$1 # pre/post -srv=$2 # name of the SysV script -shift 2 # systemd units - -if [ $phase = pre ]; then - # create flag that service was active and stop it - # As we are booted under systemd, we can just as well ask it ... - /bin/rm -f /tmp/systemd-migrate-active-$srv - if /bin/mountpoint -q /sys/fs/cgroup/systemd; then - active=$(/bin/systemctl show --no-pager -p ActiveState $srv.service 2> /dev/null) - if [ "${active#ActiveState=}" = active ]; then - /bin/touch /tmp/systemd-migrate-active-$srv - /bin/systemctl stop $srv.service - fi - fi - - # enable units if service was active in run-levels 3 or 5. - # This loosely corresponds to systemctl is-enabled. We assume, that - # units do include correct [Install] entries. - if /sbin/chkconfig --no-redirect --level=3 $srv || \ - /sbin/chkconfig --no-redirect --level=5 $srv; then - /bin/systemctl --no-reload --quiet enable "$@" || : - fi -else - # Reload daemon after old package was removed - # Restart new units if old SysV script was started. - if /bin/mountpoint -q /sys/fs/cgroup/systemd; then - /bin/systemctl daemon-reload - if [ -f /tmp/systemd-migrate-active-$srv ]; then - /bin/systemctl start "$@" - fi - fi - /bin/rm -f /tmp/systemd-migrate-active-$srv -fi - -# migrate-service ends here |