#!/bin/sh #--------------------------------------------------------------- # Project : Mandriva Linux # Module : rpm-helper # File : del-service # Version : $Id$ # Author : Frederic Lepied # Created On : Tue Jul 9 08:11:26 2002 # Purpose : helper script for rpm scriptlets to remove a # service. #--------------------------------------------------------------- if [ $# != 3 ]; then echo "usage: $0 " 1>&2 exit 1 fi pkg=$1 # name of the package num=$2 # number of packages installed srv=$3 # name of the service systemd=no sysv=no options=--quiet [ -x /bin/systemctl -a -r /lib/systemd/system/${srv}.service ] && systemd=yes [ -r /etc/rc.d/init.d/${srv} ] && sysv=yes [ $sysv = yes ] && options="$options --no-reload" unit=${srv}.service if [ $num = 0 ]; then # Will be redirected to systemd if needed if [ -z "$DURING_INSTALL" ]; then /sbin/service $srv stop > /dev/null || : fi # support for systemd. chkconfig will do daemon-reload for us if [ $systemd = yes ]; then /bin/systemctl $options disable ${unit} fi if [ $sysv = yes ]; then /sbin/chkconfig --del $srv fi fi # del-service ends here