Files
rocm-systems/src/RPM_postun.in
T
Galantsev, Dmitrii 6e52a113a2 SYSTEMCTL: Check if running before stopping
When uninstalling the RDC application - the user is greeted with an
annoying "Failed to stop rdc.service..." message if the RDC is not
running.
This change makes sure RDC is active before trying to stop it.

Change-Id: I6fa57bfd4b9c348514cd6c38e60ed3930d32b62c
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
2023-05-31 11:41:25 -05:00

32 строки
619 B
Bash
Исполняемый файл

#!/bin/bash
stop_rdc() {
#stop RDC service if systemd exists and service is running
if [ -d /run/systemd/system ] && $( systemctl is-active --quiet rdc ); then
systemctl stop rdc
fi
return 0
}
rm_rdc_service() {
local LINK=@DISTRO_ROOT@/rdc.service
if [ -L $LINK ]; then
unlink $LINK
fi
return 0
}
reload_systemd() {
if [ -d /run/systemd/system ]; then
systemctl daemon-reload
fi
return 0
}
if [ $1 -le 1 ]; then
# perform the below actions for rpm remove($1=0) or upgrade($1=1) operations
stop_rdc
rm_rdc_service
reload_systemd
fi