From 61ad6381aab88dc86fd23ccb4adaebec3e472e9b Mon Sep 17 00:00:00 2001 From: AravindanC Date: Wed, 4 Dec 2024 21:52:39 -0800 Subject: [PATCH] Enable distro id based checks in rocm-core post/pre scripts Change-Id: I1970dc3a36b8bd47d238b032afe5714c3e7f8e57 --- rocm-core.postinst | 6 +++--- rocm-core.prerm | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rocm-core.postinst b/rocm-core.postinst index 5ee9337454..f72d384163 100755 --- a/rocm-core.postinst +++ b/rocm-core.postinst @@ -36,7 +36,7 @@ do_update_alternatives(){ # Update the /opt/rocm symlink # For custom location installation of rpm package, /opt/rocm symlink is not required # TBD: For custom location installation of deb package. - if [[ "$DISTRIB_ID" == "Ubuntu" ]] || [[ "$RPM_INSTALL_PREFIX0" == "/opt/rocm-"* ]] ; then + if [[ ${ID_LIKE:-$ID} == "debian" ]] || [[ "$RPM_INSTALL_PREFIX0" == "/opt/rocm-"* ]] ; then update-alternatives --install "/opt/rocm" "rocm" "@CPACK_PACKAGING_INSTALL_PREFIX@" "$altscore" fi @@ -45,7 +45,7 @@ do_update_alternatives(){ if [ -d "$loc" ] then mkdir -p "$loc/rocm" - if [[ "$DISTRIB_ID" == "Ubuntu" ]] ; then + if [[ ${ID_LIKE:-$ID} == "debian" ]] ; then update-alternatives --install "$loc/rocm/@ROCM_VERSION@" "rocmmod@ROCM_VERSION@" "@CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/rocmmod" "$altscore" else update-alternatives --install "$loc/rocm/@ROCM_VERSION@" "rocmmod@ROCM_VERSION@" "$RPM_INSTALL_PREFIX0/@CMAKE_INSTALL_LIBDIR@/rocmmod" "$altscore" @@ -56,7 +56,7 @@ do_update_alternatives(){ true } -if [ -e /etc/lsb-release ] && source /etc/lsb-release && [ "$DISTRIB_ID" = "Ubuntu" ] +if [ -e /etc/os-release ] && source /etc/os-release && [[ ${ID_LIKE:-$ID} == "debian" ]] then case "$1" in (configure) diff --git a/rocm-core.prerm b/rocm-core.prerm index f57109a435..c500ef831f 100755 --- a/rocm-core.prerm +++ b/rocm-core.prerm @@ -4,18 +4,18 @@ do_update_alternatives(){ # skip update if program doesn't exist command -v update-alternatives >/dev/null || return 0 # Update the /opt/rocm symlink - if [[ "$DISTRIB_ID" == "Ubuntu" ]] || [[ "$RPM_INSTALL_PREFIX0" == "/opt/rocm-"* ]] ; then + if [[ ${ID_LIKE:-$ID} == "debian" ]] || [[ "$RPM_INSTALL_PREFIX0" == "/opt/rocm-"* ]] ; then update-alternatives --remove "rocm" "@CPACK_PACKAGING_INSTALL_PREFIX@" fi - if [[ "$DISTRIB_ID" == "Ubuntu" ]] ; then + if [[ ${ID_LIKE:-$ID} == "debian" ]] ; then update-alternatives --remove "rocmmod@ROCM_VERSION@" "@CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/rocmmod"|| true else update-alternatives --remove "rocmmod@ROCM_VERSION@" "$RPM_INSTALL_PREFIX0/@CMAKE_INSTALL_LIBDIR@/rocmmod"|| true fi } -if [ -e /etc/lsb-release ] && source /etc/lsb-release && [ "$DISTRIB_ID" = "Ubuntu" ] +if [ -e /etc/os-release ] && source /etc/os-release && [[ ${ID_LIKE:-$ID} == "debian" ]] then case "$1" in (remove | upgrade)