Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
Adding os verification support for rhel and fedora
Browse files Browse the repository at this point in the history
  • Loading branch information
tsorya committed Jun 21, 2020
1 parent 532817b commit a426a99
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions create_full_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@ function error () {
echo $@ 1>&2
}

# Check OS
OS=$(awk -F= '/^ID=/ { print $2 }' /etc/os-release | tr -d '"')
if [[ ! ${OS} =~ ^(centos)$ ]] && [[ ! ${OS} =~ ^(rhel)$ ]] && [[ ! ${OS} =~ ^(fedora)$ ]]; then
error "\"${OS}\" is an unsupported OS. We support only CentOS, RHEL or FEDORA."
exit 1
fi

#Check CentOS version
VER=$(awk -F= '/^VERSION_ID=/ { print $2 }' /etc/os-release | tr -d '"' | cut -f1 -d'.')
VER_SUPPORTED=8

if [[ ${OS} =~ ^(centos)$ && ${VER} -ne ${VER_SUPPORTED} ]]; then
error "CentOS version ${VER_SUPPORTED} is required."
exit 1
elif [[ ${OS} =~ ^(rhel)$ && ${VER} -ne ${VER_SUPPORTED} ]]
then
error "RHEL version ${VER_SUPPORTED} is required."
exit 1
fi
# TODO add minimum version fedora validation


echo "Installing environment"
scripts/install_environment.sh
echo "Done installing"
Expand Down

0 comments on commit a426a99

Please sign in to comment.