Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit53f0742

Browse files
sreyablink-so[bot]
authored andcommitted
install.sh: use ARCH for terraform zip/logging per review\n\nCo-authored-by: sreya <4856196+sreya@users.noreply.github.com>
1 parent308bc62 commit53f0742

File tree

1 file changed

+4
-41
lines changed

1 file changed

+4
-41
lines changed

‎install.sh‎

Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ main() {
278278
if ["${TRACE-}" ];then
279279
set -x
280280
fi
281-
282281
unset \
283282
DRY_RUN \
284283
METHOD \
@@ -288,16 +287,13 @@ main() {
288287
RSH \
289288
WITH_TERRAFORM \
290289
CAP_NET_ADMIN
291-
292290
ALL_FLAGS=""
293-
294291
while ["$#"-gt 0 ];do
295292
case"$1"in
296293
-*)
297294
ALL_FLAGS="${ALL_FLAGS}$1"
298295
;;
299296
esac
300-
301297
case"$1"in
302298
--dry-run)
303299
DRY_RUN=1
@@ -364,7 +360,6 @@ main() {
364360
;;
365361
--)
366362
shift
367-
# We remove the -- added above.
368363
ALL_FLAGS="${ALL_FLAGS% --}"
369364
RSH_ARGS="$*"
370365
break
@@ -379,46 +374,26 @@ main() {
379374
break
380375
;;
381376
esac
382-
383377
shift
384378
done
385-
386379
if ["${RSH_ARGS-}" ];then
387380
RSH="${RSH-ssh}"
388381
echoh"Installing remotely with$RSH$RSH_ARGS"
389382
curl -fsSL https://coder.com/install.sh| prefix"$RSH_ARGS""$RSH""$RSH_ARGS" sh -s --"$ALL_FLAGS"
390383
return
391384
fi
392-
393-
# These can be overridden for testing but shouldn't normally be used as it can
394-
# result in a broken coder.
395385
OS=${OS:-$(os)}
396386
ARCH=${ARCH:-$(arch)}
397387
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.
402388
if ["${STANDALONE_INSTALL_PREFIX-}" ]|| ["${STANDALONE_BINARY_NAME-}" ];then
403389
METHOD=standalone
404390
fi
405-
406391
METHOD="${METHOD-detect}"
407392
if ["$METHOD"!= detect ]&& ["$METHOD"!= standalone ];then
408393
echoerr"Unknown install method\"$METHOD\""
409394
echoerr"Run with --help to see usage."
410395
exit 1
411396
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-
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.
424399
CACHE_DIR=$(echo_cache_dir)
@@ -563,38 +538,27 @@ fetch() {
563538
}
564539

565540
with_terraform() {
566-
# Check if the unzip package is installed. If not error peacefully.
567541
if! (command_exists unzip);then
568542
echoh
569543
echoerr"This script needs the unzip package to run."
570544
echoerr"Please install unzip to use this function"
571545
exit 1
572546
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."
574548
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"
580551
sh_c mkdir -p"$TERRAFORM_INSTALL_PREFIX"2>/dev/null||true
581-
582552
sh_c="sh_c"
583553
if [!-w"$TERRAFORM_INSTALL_PREFIX" ];then
584554
sh_c="sudo_sh_c"
585555
fi
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"
589558
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
593559
if [-f"$COPY_LOCATION" ];then
594560
"$sh_c" rm"$COPY_LOCATION"
595561
fi
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() {
657621
darwin) STANDALONE_ARCHIVE_FORMAT=zip ;;
658622
*) STANDALONE_ARCHIVE_FORMAT=tar.gz ;;
659623
esac
660-
661624
fetch"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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp