Don't crash [un]install scripts on python failure

Change-Id: Icfbcc647bda94dd2ff2f65016de5c80af5d1ec79
Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
This commit is contained in:
Galantsev, Dmitrii
2023-10-31 01:45:38 -05:00
committed by Maisam Arif
parent c2e12feb6a
commit 08268ba1c1
4 changed files with 14 additions and 10 deletions
+3 -2
View File
@@ -106,7 +106,8 @@ do_ldconfig() {
do_install_amdsmi_python_lib() {
# get python version
local python3_minor_version=$(python3 -c 'import sys;print(sys.version_info.minor)')
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 installed."
@@ -135,7 +136,7 @@ do_install_amdsmi_python_lib() {
case "$1" in
( configure )
do_install_amdsmi_python_lib
do_install_amdsmi_python_lib || return 0
do_ldconfig
do_configureLogrotate || return 0
;;
+4 -3
View File
@@ -35,7 +35,8 @@ return_logrotateToOrigConfig() {
rm_python_lib() {
# get python version
local python3_minor_version=$(python3 -c 'import sys;print(sys.version_info.minor)')
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."
@@ -44,7 +45,7 @@ rm_python_lib() {
# check if python version is supported
if [ "$python3_minor_version" -lt 6 ]; then
echo "[INFO] AMD-SMI python library is not supported on python version 3.$python3_minor_version. "\
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
@@ -62,7 +63,7 @@ case "$1" in
( remove | upgrade)
# remove old gpuv-smi symlink
rm -f @CPACK_PACKAGING_INSTALL_PREFIX@/bin/gpuv-smi &> /dev/null
rm_python_lib
rm_python_lib || return 0
rm_ldconfig
rm_pyc
rm_logFolder
+3 -2
View File
@@ -106,7 +106,8 @@ do_ldconfig() {
do_install_amdsmi_python_lib() {
# get python version
local python3_minor_version=$(python3 -c 'import sys;print(sys.version_info.minor)')
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 installed."
@@ -135,7 +136,7 @@ do_install_amdsmi_python_lib() {
# post install or upgrade, $i is 1 or 2 -> do these actions
if [ "$1" -ge 1 ]; then
do_install_amdsmi_python_lib
do_install_amdsmi_python_lib || return 0
do_ldconfig
do_configureLogrotate || return 0
fi
+4 -3
View File
@@ -27,7 +27,8 @@ return_logrotateToOrigConfig() {
rm_python_lib() {
# get python version
local python3_minor_version=$(python3 -c 'import sys;print(sys.version_info.minor)')
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."
@@ -36,7 +37,7 @@ rm_python_lib() {
# check if python version is supported
if [ "$python3_minor_version" -lt 6 ]; then
echo "[INFO] AMD-SMI python library is not supported on python version 3.$python3_minor_version. "\
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
@@ -54,7 +55,7 @@ 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 @CPACK_PACKAGING_INSTALL_PREFIX@/bin/gpuv-smi &> /dev/null
rm_python_lib
rm_python_lib || return 0
rm_pyc
rm_logFolder
return_logrotateToOrigConfig