@@ -278,7 +278,6 @@ main() {
278
278
if [ " ${TRACE-} " ]; then
279
279
set -x
280
280
fi
281
-
282
281
unset \
283
282
DRY_RUN \
284
283
METHOD \
@@ -288,16 +287,13 @@ main() {
288
287
RSH \
289
288
WITH_TERRAFORM \
290
289
CAP_NET_ADMIN
291
-
292
290
ALL_FLAGS=" "
293
-
294
291
while [ " $# " -gt 0 ]; do
295
292
case " $1 " in
296
293
-* )
297
294
ALL_FLAGS=" ${ALL_FLAGS} $1 "
298
295
;;
299
296
esac
300
-
301
297
case " $1 " in
302
298
--dry-run)
303
299
DRY_RUN=1
@@ -364,7 +360,6 @@ main() {
364
360
;;
365
361
--)
366
362
shift
367
- # We remove the -- added above.
368
363
ALL_FLAGS=" ${ALL_FLAGS% --} "
369
364
RSH_ARGS=" $* "
370
365
break
@@ -379,46 +374,26 @@ main() {
379
374
break
380
375
;;
381
376
esac
382
-
383
377
shift
384
378
done
385
-
386
379
if [ " ${RSH_ARGS-} " ]; then
387
380
RSH=" ${RSH-ssh} "
388
381
echoh " Installing remotely with $RSH $RSH_ARGS "
389
382
curl -fsSL https://coder.com/install.sh | prefix " $RSH_ARGS " " $RSH " " $RSH_ARGS " sh -s -- " $ALL_FLAGS "
390
383
return
391
384
fi
392
-
393
- # These can be overridden for testing but shouldn't normally be used as it can
394
- # result in a broken coder.
395
385
OS=${OS:- $(os)}
396
386
ARCH=${ARCH:- $(arch)}
397
387
TERRAFORM_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.
402
388
if [ " ${STANDALONE_INSTALL_PREFIX-} " ] || [ " ${STANDALONE_BINARY_NAME-} " ]; then
403
389
METHOD=standalone
404
390
fi
405
-
406
391
METHOD=" ${METHOD-detect} "
407
392
if [ " $METHOD " != detect ] && [ " $METHOD " != standalone ]; then
408
393
echoerr " Unknown install method \" $METHOD \" "
409
394
echoerr " Run with --help to see usage."
410
395
exit 1
411
396
fi
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
-
422
397
# These are used by the various install_* functions that make use of GitHub
423
398
# releases in order to download and unpack the right release.
424
399
CACHE_DIR=$( echo_cache_dir)
@@ -563,38 +538,27 @@ fetch() {
563
538
}
564
539
565
540
with_terraform () {
566
- # Check if the unzip package is installed. If not error peacefully.
567
541
if ! (command_exists unzip); then
568
542
echoh
569
543
echoerr " This script needs the unzip package to run."
570
544
echoerr " Please install unzip to use this function"
571
545
exit 1
572
546
fi
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."
574
548
echoh
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"
580
551
sh_c mkdir -p " $TERRAFORM_INSTALL_PREFIX " 2> /dev/null || true
581
-
582
552
sh_c=" sh_c"
583
553
if [ ! -w " $TERRAFORM_INSTALL_PREFIX " ]; then
584
554
sh_c=" sudo_sh_c"
585
555
fi
586
- # Prepare /usr/local/bin/ and the binary for copying
587
556
" $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"
589
558
COPY_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
593
559
if [ -f " $COPY_LOCATION " ]; then
594
560
" $sh_c " rm " $COPY_LOCATION "
595
561
fi
596
-
597
- # Copy the binary to the correct location.
598
562
" $sh_c " cp " $CACHE_DIR /terraform" " $COPY_LOCATION "
599
563
}
600
564
@@ -657,7 +621,6 @@ install_standalone() {
657
621
darwin) STANDALONE_ARCHIVE_FORMAT=zip ;;
658
622
* ) STANDALONE_ARCHIVE_FORMAT=tar.gz ;;
659
623
esac
660
-
661
624
fetch " https://github.com/coder/coder/releases/download/v$VERSION /coder_${VERSION} _${OS} _${ARCH} .$STANDALONE_ARCHIVE_FORMAT " \
662
625
" $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .$STANDALONE_ARCHIVE_FORMAT "
663
626
0 commit comments