fix color function calls

This commit is contained in:
Jay Lee
2016-11-01 12:07:51 -04:00
parent b9ec06807b
commit e1ec8b8649

View File

@@ -64,22 +64,24 @@ case $gamos in
x86_64) gamfile="linux-x86_64.tar.xz";; x86_64) gamfile="linux-x86_64.tar.xz";;
i?86) gamfile="linux-i686.tar.xz";; i?86) gamfile="linux-i686.tar.xz";;
arm*) gamfile="linux-armv7l.tar.xz";; arm*) gamfile="linux-armv7l.tar.xz";;
*) echo_red("ERROR: this installer currently only supports i386, x86_64 and arm Linux. Looks like you're running on $gamarch. Exiting."); exit;; *)
echo_red "ERROR: this installer currently only supports i386, x86_64 and arm Linux. Looks like you're running on $gamarch. Exiting."
exit
esac esac
;; ;;
[Mm]ac[Oo][sS]|[Dd]arwin) [Mm]ac[Oo][sS]|[Dd]arwin)
osver=$(sw_vers -productVersion | awk -F'.' '{print $2}') osver=$(sw_vers -productVersion | awk -F'.' '{print $2}')
if (( $osver < 10 )); then if (( $osver < 10 )); then
echo_red("ERROR: GAM currently requires MacOS 10.10 or newer. You are running MacOS 10.$osver. Please upgrade.") echo_red "ERROR: GAM currently requires MacOS 10.10 or newer. You are running MacOS 10.$osver. Please upgrade."
exit exit
else else
echo_green("Good, you're running MacOS 10.$osver...") echo_green "Good, you're running MacOS 10.$osver..."
fi fi
gamos="macos" gamos="macos"
gamfile="macos.tar.xz" gamfile="macos.tar.xz"
;; ;;
*) *)
echo_red("Sorry, this installer currently only supports Linux and MacOS. Looks like you're runnning on $gamos. Exiting.") echo_red "Sorry, this installer currently only supports Linux and MacOS. Looks like you're runnning on $gamos. Exiting."
exit exit
;; ;;
esac esac
@@ -90,10 +92,10 @@ else
release_url="https://api.github.com/repos/jay0lee/GAM/releases/tags/v$gamversion" release_url="https://api.github.com/repos/jay0lee/GAM/releases/tags/v$gamversion"
fi fi
echo_yellow("Checking GitHub URL $release_url for $gamversion GAM release...") echo_yellow "Checking GitHub URL $release_url for $gamversion GAM release..."
release_json=$(curl -s $release_url 2>&1 /dev/null) release_json=$(curl -s $release_url 2>&1 /dev/null)
echo_yellow("Getting file and download URL...") echo_yellow "Getting file and download URL..."
# Python is sadly the nearest to universal way to safely handle JSON with Bash # Python is sadly the nearest to universal way to safely handle JSON with Bash
# At least this code should be compatible with just about any Python version ever # At least this code should be compatible with just about any Python version ever
# unlike GAM itself. If some users don't have Python we can try grep / sed / etc # unlike GAM itself. If some users don't have Python we can try grep / sed / etc
@@ -122,7 +124,7 @@ name=$(echo "$release_json" | python -c "$pycode" name $gamversion)
# Temp dir for archive # Temp dir for archive
temp_archive_dir=$(mktemp -d) temp_archive_dir=$(mktemp -d)
echo_yellow("Downloading file $name from $browser_download_url to $temp_archive_dir") echo_yellow "Downloading file $name from $browser_download_url to $temp_archive_dir"
# Save archive to temp w/o losing our path # Save archive to temp w/o losing our path
(cd $temp_archive_dir && curl -O -L $browser_download_url) (cd $temp_archive_dir && curl -O -L $browser_download_url)
@@ -131,10 +133,10 @@ mkdir -p $target_dir
tar xf $temp_archive_dir/$name -C $target_dir tar xf $temp_archive_dir/$name -C $target_dir
rc=$? rc=$?
if (( $rc != 0 )); then if (( $rc != 0 )); then
echo_red("ERROR: extracting the GAM archive with tar failed with error $rc. Exiting.") echo_red "ERROR: extracting the GAM archive with tar failed with error $rc. Exiting."
exit exit
else else
echo_green("Finished extracting GAM archive.") echo_green "Finished extracting GAM archive."
fi fi
# Update profile to add gam command # Update profile to add gam command
@@ -151,7 +153,7 @@ while true; do
case $yn in case $yn in
[Yy]*) break;; [Yy]*) break;;
[Nn]*) touch $target_dir/gam/nobrowser.txt; break;; [Nn]*) touch $target_dir/gam/nobrowser.txt; break;;
* ) echo_red("Please answer yes or no.");; * ) echo_red "Please answer yes or no.";;
esac esac
done done
@@ -162,15 +164,15 @@ while true; do
case $yn in case $yn in
[Yy]*) $target_dir/gam/gam create project; break;; [Yy]*) $target_dir/gam/gam create project; break;;
[Nn]*) echo -e "\nYou can create an API project later by running:\n\ngam create project\n"; break;; [Nn]*) echo -e "\nYou can create an API project later by running:\n\ngam create project\n"; break;;
* ) echo_red("Please answer yes or no.");; * ) echo_red "Please answer yes or no.";;
esac esac
done done
echo_red("Here's information about your new GAM installation:\n") echo_green "Here's information about your new GAM installation:\n"
$target_dir/gam/gam version $target_dir/gam/gam version
rc=$? rc=$?
if (( $rc != 0 )); then if (( $rc != 0 )); then
echo_red("ERROR: Failed running GAM for the first time with $rc. Please report this error to GAM mailing list. Exiting.") echo_red "ERROR: Failed running GAM for the first time with $rc. Please report this error to GAM mailing list. Exiting."
exit exit
fi fi