@@ -639,20 +639,21 @@ install_standalone() {
639
639
# fails we can ignore the error as the -w check will then swap us to sudo.
640
640
sh_c mkdir -p" $STANDALONE_INSTALL_PREFIX " 2> /dev/null|| true
641
641
642
+ sh_c mkdir -p" $CACHE_DIR /tmp"
643
+ if [" $STANDALONE_ARCHIVE_FORMAT " = tar.gz ]; then
644
+ sh_c tar -C" $CACHE_DIR /tmp" -xzf" $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .tar.gz"
645
+ else
646
+ sh_c unzip -d" $CACHE_DIR /tmp" -o" $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .zip"
647
+ fi
648
+
649
+ STANDALONE_BINARY_LOCATION=" $STANDALONE_INSTALL_PREFIX /bin/$STANDALONE_BINARY_NAME "
650
+
642
651
sh_c=" sh_c"
643
652
if [! -w " $STANDALONE_INSTALL_PREFIX " ]; then
644
653
sh_c=" sudo_sh_c"
645
654
fi
646
655
647
656
" $sh_c " mkdir -p" $STANDALONE_INSTALL_PREFIX /bin"
648
- " $sh_c " mkdir -p" $CACHE_DIR /tmp"
649
- if [" $STANDALONE_ARCHIVE_FORMAT " = tar.gz ]; then
650
- " $sh_c " tar -C" $CACHE_DIR /tmp" -xzf" $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .tar.gz"
651
- else
652
- " $sh_c " unzip -d" $CACHE_DIR /tmp" -o" $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .zip"
653
- fi
654
-
655
- STANDALONE_BINARY_LOCATION=" $STANDALONE_INSTALL_PREFIX /bin/$STANDALONE_BINARY_NAME "
656
657
657
658
# Remove the file if it already exists to
658
659
# avoid https://github.com/coder/coder/issues/2086
@@ -662,7 +663,9 @@ install_standalone() {
662
663
663
664
# Copy the binary to the correct location.
664
665
" $sh_c " cp" $CACHE_DIR /tmp/coder" " $STANDALONE_BINARY_LOCATION "
665
- " $sh_c " rm -rv" $CACHE_DIR /tmp"
666
+
667
+ # Clean up the extracted files (note, not using sudo: $sh_c -> sh_c).
668
+ sh_c rm -rv" $CACHE_DIR /tmp"
666
669
667
670
echo_standalone_postinstall
668
671
}