check opensuse os

This commit is contained in:
Guo Yunhe 2023-07-23 17:45:22 +08:00
parent 80feebed16
commit 9f0b9625f7

View File

@ -50,12 +50,13 @@ function checkOS() {
fi fi
fi fi
fi fi
elif [[ -e /etc/system-release ]]; then elif [[ -e /etc/os-release ]]; then
source /etc/os-release source /etc/os-release
if [[ $ID == "fedora" || $ID_LIKE == "fedora" ]]; then if [[ $ID == "fedora" || $ID_LIKE == "fedora" ]]; then
OS="fedora" OS="fedora"
fi elif [[ $ID == "opensuse-leap" || $ID == "opensuse-tumbleweed" ]]; then
if [[ $ID == "centos" || $ID == "rocky" || $ID == "almalinux" ]]; then OS="opensuse"
elif [[ $ID == "centos" || $ID == "rocky" || $ID == "almalinux" ]]; then
OS="centos" OS="centos"
if [[ $VERSION_ID -lt 7 ]]; then if [[ $VERSION_ID -lt 7 ]]; then
echo "⚠️ Your version of CentOS is not supported." echo "⚠️ Your version of CentOS is not supported."
@ -64,8 +65,7 @@ function checkOS() {
echo "" echo ""
exit 1 exit 1
fi fi
fi elif [[ $ID == "ol" ]]; then
if [[ $ID == "ol" ]]; then
OS="oracle" OS="oracle"
if [[ ! $VERSION_ID =~ (8) ]]; then if [[ ! $VERSION_ID =~ (8) ]]; then
echo "Your version of Oracle Linux is not supported." echo "Your version of Oracle Linux is not supported."
@ -73,8 +73,7 @@ function checkOS() {
echo "The script only support Oracle Linux 8." echo "The script only support Oracle Linux 8."
exit 1 exit 1
fi fi
fi elif [[ $ID == "amzn" ]]; then
if [[ $ID == "amzn" ]]; then
OS="amzn" OS="amzn"
if [[ $VERSION_ID != "2" ]]; then if [[ $VERSION_ID != "2" ]]; then
echo "⚠️ Your version of Amazon Linux is not supported." echo "⚠️ Your version of Amazon Linux is not supported."
@ -86,8 +85,10 @@ function checkOS() {
fi fi
elif [[ -e /etc/arch-release ]]; then elif [[ -e /etc/arch-release ]]; then
OS=arch OS=arch
else fi
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora, CentOS, Amazon Linux 2, Oracle Linux 8 or Arch Linux system"
if [[ -z "$OS" ]]; then
echo "Looks like you aren't running this installer on a Debian, Ubuntu, Fedora, openSUSE, CentOS, Amazon Linux 2, Oracle Linux 8 or Arch Linux system"
exit 1 exit 1
fi fi
} }