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
145 lines
5.1 KiB
Bash
Executable File
145 lines
5.1 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Copyright (C) Advanced Micro Devices. All rights reserved.
|
|
#
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
# this software and associated documentation files (the "Software"), to deal in
|
|
# the Software without restriction, including without limitation the rights to
|
|
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
# the Software, and to permit persons to whom the Software is furnished to do so,
|
|
# subject to the following conditions:
|
|
#
|
|
# The above copyright notice and this permission notice shall be included in all
|
|
# copies or substantial portions of the Software.
|
|
#
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
echo "Removing AMDSMI LIB Packages..."
|
|
|
|
# Other prerm actions
|
|
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-libamd_smi_lib.conf
|
|
ldconfig
|
|
fi
|
|
}
|
|
|
|
|
|
rm_leftovers() {
|
|
# remove pyc files generated by python
|
|
rm -rf "@CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/amdsmi_cli/subcommands/__pycache__"
|
|
rm -rf "@CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/amdsmi_cli/__pycache__"
|
|
rm -rf "@CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/amdsmi/__pycache__"
|
|
|
|
# remove build and egg files
|
|
rm -rf "@CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/amdsmi.egg-info"
|
|
rm -rf "@CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/build"
|
|
|
|
# remove leftover doc files
|
|
if test -e "@CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/../doc/amd_smi*"; then
|
|
rm -rf "@CPACK_PACKAGING_INSTALL_PREFIX@/@SHARE_INSTALL_PREFIX@/../doc/amd_smi*"
|
|
fi
|
|
}
|
|
|
|
rm_logFolder() {
|
|
rm -rf /var/log/amd_smi_lib
|
|
}
|
|
|
|
|
|
rm_rocm_tests_dir(){
|
|
if [ -d "@CPACK_PACKAGING_INSTALL_PREFIX@/share/amd_smi/tests/" ]; then
|
|
rm -rf "@CPACK_PACKAGING_INSTALL_PREFIX@/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
|
|
}
|
|
|
|
|
|
case "$1" in
|
|
( remove | upgrade)
|
|
# remove old gpuv-smi symlink
|
|
rm -f @CPACK_PACKAGING_INSTALL_PREFIX@/bin/gpuv-smi &> /dev/null
|
|
echo "Removing AMDSMI Lib Packages..."
|
|
rm_python_lib
|
|
echo "python library removed"
|
|
rm_ldconfig
|
|
echo "ldconfig removed"
|
|
rm_leftovers
|
|
echo "leftovers removed"
|
|
rm_logFolder
|
|
echo "log folder removed"
|
|
rm_rocm_tests_dir
|
|
echo "rocm tests directory removed"
|
|
rm_logrotateConfig
|
|
echo "logrotate configuration removed"
|
|
;;
|
|
( purge )
|
|
;;
|
|
( * )
|
|
exit 0
|
|
;;
|
|
esac
|