@@ -278,7 +278,6 @@ main() {
278278if [" ${TRACE-} " ]; then
279279set -x
280280fi
281-
282281unset \
283282DRY_RUN \
284283METHOD \
@@ -288,16 +287,13 @@ main() {
288287RSH \
289288WITH_TERRAFORM \
290289CAP_NET_ADMIN
291-
292290ALL_FLAGS=" "
293-
294291while [" $# " -gt 0 ]; do
295292case " $1 " in
296293-* )
297294ALL_FLAGS=" ${ALL_FLAGS} $1 "
298295;;
299296esac
300-
301297case " $1 " in
302298--dry-run)
303299DRY_RUN=1
@@ -364,7 +360,6 @@ main() {
364360;;
365361--)
366362shift
367- # We remove the -- added above.
368363ALL_FLAGS=" ${ALL_FLAGS% --} "
369364RSH_ARGS=" $* "
370365break
@@ -379,46 +374,26 @@ main() {
379374break
380375;;
381376esac
382-
383377shift
384378done
385-
386379if [" ${RSH_ARGS-} " ]; then
387380RSH=" ${RSH-ssh} "
388381echoh" Installing remotely with$RSH $RSH_ARGS "
389382curl -fsSL https://coder.com/install.sh| prefix" $RSH_ARGS " " $RSH " " $RSH_ARGS " sh -s --" $ALL_FLAGS "
390383return
391384fi
392-
393- # These can be overridden for testing but shouldn't normally be used as it can
394- # result in a broken coder.
395385OS=${OS:- $(os)}
396386ARCH=${ARCH:- $(arch)}
397387TERRAFORM_ARCH=${TERRAFORM_ARCH:- $(terraform_arch)}
398-
399- # If we've been provided a flag which is specific to the standalone installation
400- # method, we should "detect" standalone to be the appropriate installation method.
401- # This check needs to occur before we set these variables with defaults.
402388if [" ${STANDALONE_INSTALL_PREFIX-} " ]|| [" ${STANDALONE_BINARY_NAME-} " ]; then
403389METHOD=standalone
404390fi
405-
406391METHOD=" ${METHOD-detect} "
407392if [" $METHOD " != detect ]&& [" $METHOD " != standalone ]; then
408393echoerr" Unknown install method\" $METHOD \" "
409394echoerr" Run with --help to see usage."
410395exit 1
411396fi
412-
413- # We can't reasonably support installing specific versions of Coder through
414- # Homebrew, so if we're on macOS and the `--version` flag or the `--stable`
415- # flag (our tap follows mainline) was set, we should "detect" standalone to
416- # be the appropriate installation method. This check needs to occur before we
417- # set `VERSION` to a default of the latest release.
418- if [" $OS " = " darwin" ]&& { [" ${VERSION-} " ]|| [" ${STABLE} " = 1 ]; }; then
419- METHOD=standalone
420- fi
421-
422397# These are used by the various install_* functions that make use of GitHub
423398# releases in order to download and unpack the right release.
424399CACHE_DIR=$( echo_cache_dir)
@@ -563,38 +538,27 @@ fetch() {
563538}
564539
565540with_terraform () {
566- # Check if the unzip package is installed. If not error peacefully.
567541if ! (command_exists unzip); then
568542echoh
569543echoerr" This script needs the unzip package to run."
570544echoerr" Please install unzip to use this function"
571545exit 1
572546fi
573- echoh" Installing Terraform version$TERRAFORM_VERSION $TERRAFORM_ARCH from the HashiCorp release repository."
547+ echoh" Installing Terraform version$TERRAFORM_VERSION $ARCH from the HashiCorp release repository."
574548echoh
575-
576- # Download from official source and save it to cache
577- fetch" https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION} /terraform_${TERRAFORM_VERSION} _${OS} _${TERRAFORM_ARCH} .zip" \
578- " $CACHE_DIR /terraform_${TERRAFORM_VERSION} _${OS} _${TERRAFORM_ARCH} .zip"
579-
549+ fetch" https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION} /terraform_${TERRAFORM_VERSION} _${OS} _${ARCH} .zip" \
550+ " $CACHE_DIR /terraform_${TERRAFORM_VERSION} _${OS} _${ARCH} .zip"
580551sh_c mkdir -p" $TERRAFORM_INSTALL_PREFIX " 2> /dev/null|| true
581-
582552sh_c=" sh_c"
583553if [! -w " $TERRAFORM_INSTALL_PREFIX " ]; then
584554sh_c=" sudo_sh_c"
585555fi
586- # Prepare /usr/local/bin/ and the binary for copying
587556" $sh_c " mkdir -p" $TERRAFORM_INSTALL_PREFIX /bin"
588- " $sh_c " unzip -d" $CACHE_DIR " -o" $CACHE_DIR /terraform_${TERRAFORM_VERSION} _${OS} _${TERRAFORM_ARCH } .zip"
557+ " $sh_c " unzip -d" $CACHE_DIR " -o" $CACHE_DIR /terraform_${TERRAFORM_VERSION} _${OS} _${ARCH } .zip"
589558COPY_LOCATION=" $TERRAFORM_INSTALL_PREFIX /bin/terraform"
590-
591- # Remove the file if it already exists to
592- # avoid https://github.com/coder/coder/issues/2086
593559if [-f " $COPY_LOCATION " ]; then
594560" $sh_c " rm" $COPY_LOCATION "
595561fi
596-
597- # Copy the binary to the correct location.
598562" $sh_c " cp" $CACHE_DIR /terraform" " $COPY_LOCATION "
599563}
600564
@@ -657,7 +621,6 @@ install_standalone() {
657621darwin) STANDALONE_ARCHIVE_FORMAT=zip ;;
658622* ) STANDALONE_ARCHIVE_FORMAT=tar.gz ;;
659623esac
660-
661624fetch" https://github.com/coder/coder/releases/download/v$VERSION /coder_${VERSION} _${OS} _${ARCH} .$STANDALONE_ARCHIVE_FORMAT " \
662625" $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .$STANDALONE_ARCHIVE_FORMAT "
663626