Skip to content

Commit

Permalink
Fix support for Debian Buster (10) (#4203)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkuczynski committed Oct 10, 2017
1 parent 7d98955 commit 7d4d9fd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
2 changes: 2 additions & 0 deletions scripts/functions/detect_system
Expand Up @@ -111,6 +111,7 @@ __rvm_detect_system()
_system_name="Solaris"
_system_version="$(command uname -v)"
_system_arch="$(command isainfo -k)"

if
[[ "${_system_version}" == joyent* ]]
then
Expand Down Expand Up @@ -185,6 +186,7 @@ __rvm_detect_system()
return 1
;;
esac

_system_type="${_system_type//[ \/]/_}"
_system_name="${_system_name//[ \/]/_}"
_system_name_lowercase="$(echo ${_system_name} | \command \tr '[A-Z]' '[a-z]')"
Expand Down
7 changes: 7 additions & 0 deletions scripts/functions/detect_systems/os_release
Expand Up @@ -21,6 +21,13 @@ __rvm_detect_system_from_os_release()
_system_name="Debian"
_system_version="$(awk -F'=' '$1=="VERSION_ID"{gsub(/"/,"");print $2}' /etc/os-release | \command \awk -F. '{print $1}' | head -n 1)"
_system_arch="$( dpkg --print-architecture )"

if
[ -z "$_system_version" ]
then
_system_version="$(\command \cat /etc/debian_version | \command \awk -F. '{print $1}' | head -n 1)"
fi

__rvm_detect_debian_major_version_from_codename
;;

Expand Down
22 changes: 13 additions & 9 deletions scripts/functions/utility
Expand Up @@ -174,15 +174,17 @@ __rvm_detect_xcode_version_at_least()

__rvm_version_sort()
{
\command \awk -F'[.-]' -v OFS=. '{ # split on "." and "-", merge back with "."
original=$0 # save original to preserve it before the line is changed
for (n=1; n<10; n++) { # iterate through max 9 components of version
$n=tolower($n) # ignore case for sorting
if ($n=="") $n="0" # treat non existing parts as 0
if ($n ~ /^p[0-9]/) $n=substr($n, 2) # old ruby -p notation
if ($n ~ /^[a-z]/) $n=" "$n # names go before numbers thanks to space
\command \awk -F'[.-]' -v OFS=. '{ # split on "." and "-", merge back with "."
original=$0 # save original to preserve it before the line is changed
for (n=1; n<10; n++) { # iterate through max 9 components of version
$n=tolower($n) # ignore case for sorting
if ($n == "") $n="0" # treat non existing parts as 0
if ($n ~ /^p[0-9]/) $n=substr($n, 2) # old ruby -p notation
if (n == 1 && $n ~ /^[0-9]/) $n="zzz."$n # first group must be a string
if (n > 1 && $n ~ /^[a-z]/) $n=" "$n # names go before numbers thanks to space
}
print $0"\t"original # print the transformed version and original separated by \t so we can extract original after sorting
print $0"\t"original # print the transformed version and original separated by \t
# so we can extract original after sorting
}' \
| LC_ALL=C \sort -t. -k 1,1d -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n \
| \awk -F'\t' '{print $2}'
Expand All @@ -191,8 +193,10 @@ __rvm_version_sort()
__rvm_version_compare()
{
\typeset first

# first is the lower version number
first="$( \command \printf "%b" "$1\n$3\n" | __rvm_version_sort | \command \head -n1 )"
# first is the lower

case "$2" in
(-eq|==|=)
[[ "$1" == "$3" ]] || return $?
Expand Down

0 comments on commit 7d4d9fd

Please sign in to comment.