move osname/osversion checks to beginning of checkos function

This commit is contained in:
ronivay
2021-05-03 17:38:14 +03:00
parent f71634e960
commit 6eff84ff5d

View File

@@ -869,6 +869,9 @@ function RollBackInstallation {
function CheckOS { function CheckOS {
OSVERSION=$(grep ^VERSION_ID /etc/os-release | cut -d'=' -f2 | grep -Eo "[0-9]{1,2}" | head -1)
OSNAME=$(grep ^NAME /etc/os-release | cut -d'=' -f2 | sed 's/"//g' | awk '{print $1}')
cmdlog "which yum" cmdlog "which yum"
if [[ "$(which yum 2>>$LOGFILE)" ]]; then if [[ "$(which yum 2>>$LOGFILE)" ]]; then
PKG_FORMAT="rpm" PKG_FORMAT="rpm"
@@ -888,9 +891,6 @@ function CheckOS {
return 0 return 0
fi fi
OSVERSION=$(grep ^VERSION_ID /etc/os-release | cut -d'=' -f2 | grep -Eo "[0-9]{1,2}" | head -1)
OSNAME=$(grep ^NAME /etc/os-release | cut -d'=' -f2 | sed 's/"//g' | awk '{print $1}')
if [[ ! $OSNAME =~ ^(Debian|Ubuntu|CentOS|AlmaLinux)$ ]]; then if [[ ! $OSNAME =~ ^(Debian|Ubuntu|CentOS|AlmaLinux)$ ]]; then
printfail "Only Ubuntu/Debian/CentOS/AlmaLinux supported" printfail "Only Ubuntu/Debian/CentOS/AlmaLinux supported"
exit 1 exit 1