Files
rocm-systems/RPM/preun.in
T

42 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/bash
#set -x
set -e
packageName="amd-smi-lib"
logPath=/var/log/amd_smi_lib
logName=AMD-SMI-lib.log
logFile="${logPath}/${logName}"
logrotateConfFile=/etc/logrotate.d/amd_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
}
2023-09-15 03:04:50 -05:00
rm_pyc() {
# remove pyc files generated by python
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/amdsmi_cli/__pycache__
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/amdsmi/__pycache__
}
2022-08-11 19:34:40 -05:00
if [ $1 -le 1 ]; then
# perform the below actions for rpm remove($1=0) or upgrade($1=1) operations
2023-09-15 03:04:50 -05:00
rm_pyc
rm_logFolder
return_logrotateToOrigConfig
2022-08-11 19:34:40 -05:00
fi