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

Installer should check for an xml file by comparing the first few bytes instead of depending on file. #2785

Merged
merged 1 commit into from
Oct 3, 2023
Merged
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
5 changes: 2 additions & 3 deletions installers/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,9 @@ ARCHIVE="$OS-amd64$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.
# If curl was used, make sure the file downloaded is of type 'data', according to the UNIX `file`
# command. (The XML error will be reported as a 'text' type.)
# If curl was used, make sure the file downloaded is not an XML file (i.e. it does not start with "<?xml").
# If wget returned an error or curl fetched a "forbidden" response, raise an error and exit.
if [ $? -ne 0 -o \( "`echo $FETCH | grep -o 'curl'`" = "curl" -a -z "`file -b $INSTALLERTMPDIR/$ARCHIVE | grep -o 'data'`" \) ]; then
if [ $? -ne 0 -o \( "`echo $FETCH | grep -o 'curl'`" = "curl" -a ! -z "`grep -o '^<?xml' $INSTALLERTMPDIR/$ARCHIVE`" \) ]; then
rm -f $INSTALLERTMPDIR/$ARCHIVE
progress_fail
error "Could not download the State Tool installer at $STATEURL. Please try again."
Expand Down