Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "arch" param to install script's state-update URLs. #3633

Draft
wants to merge 1 commit into
base: version/0-48-0-RC1
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions installers/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ error () {
case `uname -s` in
Linux)
OS="linux"
ARCH="amd64"
arch="`uname -m`"
if [ $arch = "arm64" -o $arch = "aarch64" ]; then ARCH="arm64"; fi
DOWNLOADEXT=".tar.gz"
;;
*BSD)
Expand All @@ -78,11 +81,13 @@ Linux)
;;
Darwin)
OS="darwin"
ARCH="amd64"
DOWNLOADEXT=".tar.gz"
SHA256SUM="shasum -a 256"
;;
MINGW*|MSYS*)
OS="windows"
ARCH="amd64"
DOWNLOADEXT=".zip"
BINARYEXT=".exe"
;;
Expand Down Expand Up @@ -113,18 +118,18 @@ mkdir -p "$INSTALLERTMPDIR"
if [ -z "$VERSION" ]; then
# If the user did not specify a version, formulate a query to fetch the JSON info of the latest
# version, including where it is.
JSONURL="$BASE_INFO_URL?channel=$CHANNEL&source=install&platform=$OS"
JSONURL="$BASE_INFO_URL?channel=$CHANNEL&source=install&platform=$OS&arch=$ARCH"
elif [ -z "`echo $VERSION | grep -o '\-SHA'`" ]; then
# If the user specified a partial version (i.e. no SHA), formulate a query to fetch the JSON info
# of that version's latest SHA, including where it is.
VERSIONNOSHA="$VERSION"
VERSION=""
JSONURL="$BASE_INFO_URL?channel=$CHANNEL&source=install&platform=$OS&target-version=$VERSIONNOSHA"
JSONURL="$BASE_INFO_URL?channel=$CHANNEL&source=install&platform=$OS&arch=$ARCH&target-version=$VERSIONNOSHA"
else
# If the user specified a full version with SHA, formulate a query to fetch the JSON info of that
# version.
VERSIONNOSHA="`echo $VERSION | sed 's/-SHA.*$//'`"
JSONURL="$BASE_INFO_URL?channel=$CHANNEL&source=install&platform=$OS&target-version=$VERSIONNOSHA"
JSONURL="$BASE_INFO_URL?channel=$CHANNEL&source=install&platform=$OS&arch=$ARCH&target-version=$VERSIONNOSHA"
fi

# Fetch version info.
Expand Down Expand Up @@ -157,13 +162,13 @@ else
error "Unknown version: $VERSION"
exit 1
fi
RELURL="$CHANNEL/$VERSIONNOSHA/$OS-amd64/state-$OS-amd64-$VERSION$DOWNLOADEXT"
RELURL="$CHANNEL/$VERSIONNOSHA/$OS-$ARCH/state-$OS-$ARCH-$VERSION$DOWNLOADEXT"
fi

# Fetch the requested or latest version.
progress "Preparing Installer for State Tool Package Manager version $VERSION"
STATEURL="$BASE_FILE_URL/$RELURL"
ARCHIVE="$OS-amd64$DOWNLOADEXT"
ARCHIVE="$OS-$ARCH$DOWNLOADEXT"
$FETCH $INSTALLERTMPDIR/$ARCHIVE $STATEURL
# wget and curl differ on how to handle AWS' "Forbidden" result for unknown versions.
# wget will exit with nonzero status. curl simply creates an XML file with the forbidden error.
Expand Down
Loading