mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
Install script handling of MacOS versions
This commit is contained in:
@@ -97,6 +97,13 @@ else
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reverse() {
|
||||||
|
for (( i = ${#*}; i > 0; i-- ))
|
||||||
|
{
|
||||||
|
echo ${!i}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$gamversion" == "latest" ]; then
|
if [ "$gamversion" == "latest" ]; then
|
||||||
release_url="https://api.github.com/repos/GAM-team/GAM/releases/latest"
|
release_url="https://api.github.com/repos/GAM-team/GAM/releases/latest"
|
||||||
elif [ "$gamversion" == "prerelease" -o "$gamversion" == "draft" ]; then
|
elif [ "$gamversion" == "prerelease" -o "$gamversion" == "draft" ]; then
|
||||||
@@ -171,7 +178,10 @@ if (( $rc != 0 )); then
|
|||||||
echo_red "ERROR: No version of python installed."
|
echo_red "ERROR: No version of python installed."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
download_urls=$(echo "$release_json" | $pycmd -c "$pycode" browser_download_url "$gamversion")
|
# also sort the URLs once so we're evaluating newest OS version first
|
||||||
|
download_urls=$(echo "$release_json" | \
|
||||||
|
$pycmd -c "$pycode" browser_download_url "$gamversion" | \
|
||||||
|
sort --version-sort --reverse)
|
||||||
if [[ ${download_urls:0:5} = "ERROR" ]]; then
|
if [[ ${download_urls:0:5} = "ERROR" ]]; then
|
||||||
echo_red "${download_urls}"
|
echo_red "${download_urls}"
|
||||||
exit
|
exit
|
||||||
@@ -206,8 +216,8 @@ case $gamos in
|
|||||||
arm|arm64|aarch64)
|
arm|arm64|aarch64)
|
||||||
download_urls=$(echo -e "$download_urls" | grep "\-aarch64-")
|
download_urls=$(echo -e "$download_urls" | grep "\-aarch64-")
|
||||||
gam_arm64_glibc_vers=$(echo -e "$download_urls" | \
|
gam_arm64_glibc_vers=$(echo -e "$download_urls" | \
|
||||||
grep --only-matching 'glibc[0-9\.]*\.tar\.xz$' \
|
grep --only-matching 'glibc[0-9\.]*\.tar\.xz$' | \
|
||||||
| cut -c 6-9 )
|
cut -c 6-9)
|
||||||
useglibc="legacy"
|
useglibc="legacy"
|
||||||
for gam_glibc_ver in $gam_arm64_glibc_vers; do
|
for gam_glibc_ver in $gam_arm64_glibc_vers; do
|
||||||
if version_gt $this_glibc_ver $gam_glibc_ver; then
|
if version_gt $this_glibc_ver $gam_glibc_ver; then
|
||||||
@@ -225,35 +235,71 @@ case $gamos in
|
|||||||
;;
|
;;
|
||||||
[Mm]ac[Oo][sS]|[Dd]arwin)
|
[Mm]ac[Oo][sS]|[Dd]arwin)
|
||||||
gamos="macos"
|
gamos="macos"
|
||||||
fullversion=$(sw_vers -productVersion)
|
currentversion=$(sw_vers -productVersion | awk -F '.' '{print $1 "." $2}')
|
||||||
# override osversion only if it wasn't set by cli arguments
|
# override osversion only if it wasn't set by cli arguments
|
||||||
osversion=${osversion:-${fullversion:0:2}}
|
osversion=${osversion:-${currentversion}}
|
||||||
download_urls=$(echo -e "$download_urls" | grep "\-macos-")
|
# override osversion only if it wasn't set by cli arguments
|
||||||
|
download_urls=$(echo -e "$download_urls" | grep "\-macos")
|
||||||
case $gamarch in
|
case $gamarch in
|
||||||
x86_64)
|
x86_64)
|
||||||
download_url=$(echo -e "$download_urls" | grep "\-x86_64")
|
archgrep="\-x86_64"
|
||||||
minimum_version=13
|
|
||||||
;;
|
;;
|
||||||
arm|arm64|aarch64)
|
arm|arm64|aarch64)
|
||||||
download_url=$(echo -e "$download_urls" | grep "\-aarch64")
|
archgrep="\-aarch64"
|
||||||
minimum_version=14
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo_red "ERROR: this installer currently only supports x86_64 and arm64 MacOS. Looks like you're running on ${gamarch}. Exiting."
|
echo_red "ERROR: this installer currently only supports x86_64 and arm64 MacOS. Looks like you're running on ${gamarch}. Exiting."
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
if [[ "$osversion" -ge "$minimum_version" ]]; then
|
gam_macos_urls=$(echo -e "$download_urls" | \
|
||||||
echo_green "You are running MacOS ${fullversion}, good. Using GAM with ${download_url}."
|
grep "$archgrep")
|
||||||
|
versionless_urls=$(echo -e "$gam_macos_urls" | \
|
||||||
|
grep "\-macos-")
|
||||||
|
if [ "$versionless_urls" == "" ]; then
|
||||||
|
# versions after 7.00.38 include MacOS version info
|
||||||
|
gam_macos_vers=$(echo -e "$gam_macos_urls" | \
|
||||||
|
grep --only-matching '\-macos[0-9\.]*' | \
|
||||||
|
cut -c 6-9)
|
||||||
|
for gam_mac_ver in $gam_macos_vers; do
|
||||||
|
echo -e "$gam_mac_ver\n"
|
||||||
|
if version_gt $currentversion $gam_mac_ver; then
|
||||||
|
usemac="$gam_mac_ver"
|
||||||
|
echo_green "Using GAM compiled against $usemac"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
download_url=$(echo -e "$gam_macos_urls" | grep "$usemac")
|
||||||
else
|
else
|
||||||
echo_red "Sorry, you are running MacOS ${fullversion} but GAM on ${gamarch} requires MacOS ${minimum_version}. Exiting."
|
# versions 7.00.38 and older don't include version info
|
||||||
|
case $gamarch in
|
||||||
|
x86_64)
|
||||||
|
minimum_version=13
|
||||||
|
download_url=$(echo -e "$download_urls" | grep "\-x86_64")
|
||||||
|
;;
|
||||||
|
arm|arm64|aarch64)
|
||||||
|
download_url=$(echo -e "$download_urls" | grep "\-aarch64")
|
||||||
|
minimum_version=14
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if version_gt "$osversion" "$minimum_version"; then
|
||||||
|
echo_green "You are running MacOS ${osversion}, good. Downloading GAM from ${download_url}."
|
||||||
|
else
|
||||||
|
echo_red "Sorry, you are running MacOS ${osversion} but GAM on ${gamarch} requires MacOS ${minimum_version}. Exiting."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
if [ -z ${download_url+x} ]; then
|
||||||
|
echo_red "Sorry, you are running MacOS ${currentversion} but GAM on ${gamarch} requires MacOS ${minimum_version}. Exiting."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
MINGW64_NT*)
|
MINGW64_NT*)
|
||||||
gamos="windows"
|
gamos="windows"
|
||||||
echo "You are running Windows"
|
echo "You are running Windows"
|
||||||
download_url=$(echo -e "$download_urls" | grep "\-windows-" | grep ".zip")
|
download_url=$(echo -e "$download_urls" | \
|
||||||
|
grep "\-windows-" | \
|
||||||
|
grep ".zip")
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo_red "Sorry, this installer currently only supports Linux and MacOS. Looks like you're running on ${gamos}. Exiting."
|
echo_red "Sorry, this installer currently only supports Linux and MacOS. Looks like you're running on ${gamos}. Exiting."
|
||||||
@@ -439,3 +485,4 @@ echo_green "GAM installation and setup complete!"
|
|||||||
if [ "$update_profile" = true ]; then
|
if [ "$update_profile" = true ]; then
|
||||||
echo_green "Please restart your terminal shell or to get started right away run:\n\n$alias_line"
|
echo_green "Please restart your terminal shell or to get started right away run:\n\n$alias_line"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user