Skip to content

Commit

Permalink
avoid false detection of redhat systems by moving them to the end of …
Browse files Browse the repository at this point in the history
…detection, fix #2402
  • Loading branch information
mpapis committed Dec 6, 2013
1 parent 1212571 commit 962d17e
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions scripts/functions/utility_system
Expand Up @@ -64,24 +64,6 @@ __rvm_detect_system()
_system_name="Debian"
_system_version="$(awk -F'=' '$1=="VERSION_ID"{gsub(/"/,"");print $2}' /etc/os-release | \awk -F. '{print $1}')" #'
_system_arch="$( dpkg --print-architecture )"
elif
[[ -f /etc/fedora-release ]]
then
_system_name="Fedora"
_system_version="$(GREP_OPTIONS="" \grep -Eo '[0-9]+' /etc/fedora-release)"
elif
[[ -f /etc/centos-release ]]
then
_system_name="CentOS"
_system_version="$(GREP_OPTIONS="" \grep -Eo '[0-9\.]+' /etc/centos-release | \awk -F. '{print $1}')"
elif
[[ -f /etc/redhat-release ]]
then
if GREP_OPTIONS="" \grep -E 'CentOS|ClearOS' /etc/redhat-release >/dev/null
then _system_name="CentOS"
else _system_name="RedHat"
fi
_system_version="$(GREP_OPTIONS="" \grep -Eo '[0-9\.]+' /etc/redhat-release | \awk -F. '{print $1}')"
elif
[[ -f /etc/system-release ]] &&
GREP_OPTIONS="" \grep "Amazon Linux AMI" /etc/system-release >/dev/null
Expand Down Expand Up @@ -111,6 +93,24 @@ __rvm_detect_system()
_system_type="BSD"
_system_name="Synology"
_system_version="libc-$(ldd --version | \awk 'NR==1 {print $NF}' | \awk -F. '{print $1"."$2}')"
elif
[[ -f /etc/fedora-release ]]
then
_system_name="Fedora"
_system_version="$(GREP_OPTIONS="" \grep -Eo '[0-9]+' /etc/fedora-release)"
elif
[[ -f /etc/centos-release ]]
then
_system_name="CentOS"
_system_version="$(GREP_OPTIONS="" \grep -Eo '[0-9\.]+' /etc/centos-release | \awk -F. '{print $1}')"
elif
[[ -f /etc/redhat-release ]]
then
if GREP_OPTIONS="" \grep -E 'CentOS|ClearOS' /etc/redhat-release >/dev/null
then _system_name="CentOS"
else _system_name="RedHat"
fi
_system_version="$(GREP_OPTIONS="" \grep -Eo '[0-9\.]+' /etc/redhat-release | \awk -F. '{print $1}')"
else
_system_version="libc-$(ldd --version | \awk 'NR==1 {print $NF}' | \awk -F. '{print $1"."$2}')"
fi
Expand Down

0 comments on commit 962d17e

Please sign in to comment.