From 30f4b82b8a48218ffe5ad8ce15e6ee0892a451db Mon Sep 17 00:00:00 2001 From: yogeshbirla Date: Thu, 12 May 2022 10:46:47 -0700 Subject: [PATCH] Add sles15 support to `install-powershell.sh` (#16984) Co-authored-by: Yogesh Birla --- tools/install-powershell.sh | 9 +++++---- tools/installpsh-suse.sh | 6 ++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/install-powershell.sh b/tools/install-powershell.sh index ce4711d142..f13e76665b 100755 --- a/tools/install-powershell.sh +++ b/tools/install-powershell.sh @@ -95,10 +95,6 @@ install(){ else DistroBasedOn='redhat' fi - elif [ -f /etc/SuSE-release ] ; then - DistroBasedOn='suse' - PSUEDONAME=$( (tr "\n" ' '| sed s/VERSION.*//) < /etc/SuSE-release ) - REV=$( (grep 'VERSION' | sed s/.*=\ //) < /etc/SuSE-release ) elif [ -f /etc/mandrake-release ] ; then DistroBasedOn='mandrake' PSUEDONAME=$( (sed s/.*\(// | sed s/\)//) < /etc/mandrake-release ) @@ -117,6 +113,11 @@ install(){ if [ -f /etc/UnitedLinux-release ] ; then DIST="${DIST}[$( (tr "\n" ' ' | sed s/VERSION.*//) < /etc/UnitedLinux-release )]" fi + osname=$(source /etc/os-release; echo $PRETTY_NAME) + if [[ $osname = *SUSE* ]]; then + DistroBasedOn='suse' + REV=$(source /etc/os-release; echo $VERSION_ID) + fi OS=$(lowercase $OS) DistroBasedOn=$(lowercase $DistroBasedOn) fi diff --git a/tools/installpsh-suse.sh b/tools/installpsh-suse.sh index 4e2c5cd024..5c1dd857b9 100755 --- a/tools/installpsh-suse.sh +++ b/tools/installpsh-suse.sh @@ -71,8 +71,6 @@ else else DistroBasedOn='redhat' fi - elif [ -f /etc/SuSE-release ] ; then - DistroBasedOn='suse' elif [ -f /etc/mandrake-release ] ; then DistroBasedOn='mandrake' elif [ -f /etc/debian_version ] ; then @@ -82,6 +80,10 @@ else DIST="${DIST}[$( (tr "\n" ' ' | sed s/VERSION.*//) < /etc/UnitedLinux-release )]" DistroBasedOn=unitedlinux fi + osname=$(source /etc/os-release; echo $PRETTY_NAME) + if [[ $osname = *SUSE* ]]; then + DistroBasedOn='suse' + fi OS=$(lowercase "$OS") DistroBasedOn=$(lowercase "$DistroBasedOn") fi