Files
rocm-systems/DEBIAN/prerm.in
T
Charis Poag 4613e8dec3 Update logging and README for other project usage
Updates:
    * [rocm-smi] Logging now can update files on
      per-project-basis for install/remove
    * [rocm-smi] README now has latest build
      instructions, including test builds
    * [rocm-smi] Updated README to include
      revision dates

Change-Id: Ifb19a6f32ccf6938f47225db53fef88021909264
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
2023-07-20 19:09:11 -05:00

55 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -e
packageName="rocm-smi-lib"
logPath=/var/log/rocm_smi_lib
logName=ROCm-SMI-lib.log
logFile="${logPath}/${logName}"
logrotateConfFile=/etc/logrotate.d/rocm_smi.conf
rm_logFolder() {
sudo rm -rf "$logPath"
}
return_logrotateToOrigConfig() {
if [ -f $logrotateConfFile ]; then
sudo rm -rf "${logrotateConfFile}"
fi
if [ -f /etc/cron.hourly/logrotate ]; then
sudo mv /etc/cron.hourly/logrotate /etc/cron.daily/logrotate
fi
if [ -f /lib/systemd/system/logrotate.timer.backup ]; then
sudo cp /lib/systemd/system/logrotate.timer.backup /lib/systemd/system/logrotate.timer
sudo rm -rf /lib/systemd/system/logrotate.timer.backup
sudo systemctl reenable --now logrotate.timer
fi
}
rm_ldconfig() {
# left-hand term originates from ENABLE_LDCONFIG = ON/OFF at package build
if [ "@ENABLE_LDCONFIG@" == "ON" ]; then
rm -f /etc/ld.so.conf.d/x86_64-librocm_smi_lib.conf
ldconfig
fi
}
rm_pyc() {
# remove pyc file generated by python
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/rocm_smi/__pycache__
}
case "$1" in
( remove | upgrade)
rm_ldconfig
rm_pyc
rm_logFolder
return_logrotateToOrigConfig
;;
( purge )
;;
( * )
exit 0
;;
esac