CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
104 lines
3.6 KiB
Bash
Executable File
104 lines
3.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
rm_leftovers() {
|
|
# remove pyc files generated by python
|
|
rm -rf "$RPM_INSTALL_PREFIX0/@CMAKE_INSTALL_LIBEXECDIR@/amdsmi_cli/subcommands/__pycache__"
|
|
rm -rf "$RPM_INSTALL_PREFIX0/@CMAKE_INSTALL_LIBEXECDIR@/amdsmi_cli/__pycache__"
|
|
rm -rf "$RPM_INSTALL_PREFIX0/@SHARE_INSTALL_PREFIX@/amdsmi/__pycache__"
|
|
|
|
# remove build and egg files
|
|
rm -rf "$RPM_INSTALL_PREFIX0/@SHARE_INSTALL_PREFIX@/amdsmi.egg-info"
|
|
rm -rf "$RPM_INSTALL_PREFIX0/@SHARE_INSTALL_PREFIX@/build"
|
|
|
|
# remove dist files (only applies to old setuptools versions like on RHEL8)
|
|
rm -rf "$RPM_INSTALL_PREFIX0/@SHARE_INSTALL_PREFIX@/dist"
|
|
|
|
# remove leftover doc files
|
|
if test -e "$RPM_INSTALL_PREFIX0/@SHARE_INSTALL_PREFIX@/../doc/amd_smi*"; then
|
|
rm -rf "$RPM_INSTALL_PREFIX0/@SHARE_INSTALL_PREFIX@/../doc/amd_smi*"
|
|
fi
|
|
}
|
|
|
|
|
|
rm_logFolder() {
|
|
rm -rf /var/log/amd_smi_lib
|
|
}
|
|
|
|
|
|
rm_rocm_tests_dir(){
|
|
if [ -d "$RPM_INSTALL_PREFIX0/share/amd_smi/tests/" ]; then
|
|
rm -rf "$RPM_INSTALL_PREFIX0/share/amd_smi/tests/"
|
|
echo "Removed ROCm tests directory."
|
|
fi
|
|
}
|
|
|
|
|
|
rm_logrotateConfig() {
|
|
# Drop our /etc/logrotate.d/amd_smi.conf snippet. We no longer mutate
|
|
# the system logrotate.timer or move cron.daily/logrotate to
|
|
# cron.hourly, so there is nothing else to restore here.
|
|
# Older packages (pre-cleanup) may have left a backup behind --
|
|
# restore it on a best-effort basis so a subsequent upgrade does not
|
|
# leave the user stuck with our hourly override.
|
|
local logrotateConfFile=/etc/logrotate.d/amd_smi.conf
|
|
if [ -f "$logrotateConfFile" ]; then
|
|
rm -f "$logrotateConfFile"
|
|
fi
|
|
if [ -f /etc/cron.hourly/logrotate ] && [ ! -f /etc/cron.daily/logrotate ]; then
|
|
mv /etc/cron.hourly/logrotate /etc/cron.daily/logrotate
|
|
fi
|
|
if [ -f /lib/systemd/system/logrotate.timer.backup ]; then
|
|
mv -f /lib/systemd/system/logrotate.timer.backup /lib/systemd/system/logrotate.timer
|
|
if command -v systemctl >/dev/null 2>&1; then
|
|
systemctl reenable --now logrotate.timer >/dev/null 2>&1 || true
|
|
fi
|
|
fi
|
|
}
|
|
|
|
rm_python_lib() {
|
|
# get python version
|
|
local python3_minor_version
|
|
python3_minor_version=$(python3 -c 'import sys;print(sys.version_info.minor)')
|
|
if [ $? -ne 0 ]; then
|
|
echo "[WARNING] Could not determine python version. "\
|
|
"AMD-SMI python library will not be uninstalled."
|
|
return
|
|
fi
|
|
|
|
# check if python version is supported
|
|
if [ "$python3_minor_version" -lt 6 ]; then
|
|
echo "[WARNING] AMD-SMI python library is not supported on python version 3.$python3_minor_version. "\
|
|
"AMD-SMI python library will not be uninstalled."
|
|
return
|
|
fi
|
|
|
|
# Remove old python library
|
|
local pip_list_output
|
|
pip_list_output=$(python3 -m pip list --format=columns --disable-pip-version-check)
|
|
# check pip list output for amdsmi
|
|
if [[ $pip_list_output == *"amdsmi"* ]]; then
|
|
PIP_ROOT_USER_ACTION=ignore PIP_BREAK_SYSTEM_PACKAGES=1 python3 -m pip uninstall amdsmi --yes --quiet --disable-pip-version-check
|
|
fi
|
|
|
|
pip_list_output=$(python3 -m pip list --format=columns --disable-pip-version-check)
|
|
# check pip list output for amdsmi
|
|
if [[ $pip_list_output == *"amdsmi"* ]]; then
|
|
echo "[WARNING] AMD-SMI python library (amdsmi) is still installed in pip. "\
|
|
"Check post install to ensure version is correct"
|
|
else
|
|
echo "Removed AMD-SMI python library (amdsmi)..."
|
|
fi
|
|
}
|
|
|
|
|
|
if [ "$1" -le 1 ]; then
|
|
# perform the below actions for rpm remove($1=0) or upgrade($1=1) operations
|
|
# remove old gpuv-smi symlink
|
|
rm -f $RPM_INSTALL_PREFIX0/bin/gpuv-smi &> /dev/null
|
|
rm_python_lib
|
|
rm_leftovers
|
|
rm_logFolder
|
|
rm_rocm_tests_dir
|
|
rm_logrotateConfig
|
|
fi
|