@@ -639,19 +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
- if [ " $STANDALONE_ARCHIVE_FORMAT " = tar.gz ]; then
649
- " $sh_c " tar -C " $CACHE_DIR " -xzf " $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .tar.gz"
650
- else
651
- " $sh_c " unzip -d " $CACHE_DIR " -o " $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .zip"
652
- fi
653
-
654
- STANDALONE_BINARY_LOCATION=" $STANDALONE_INSTALL_PREFIX /bin/$STANDALONE_BINARY_NAME "
655
657
656
658
# Remove the file if it already exists to
657
659
# avoid https://github.com/coder/coder/issues/2086
@@ -660,7 +662,10 @@ install_standalone() {
660
662
fi
661
663
662
664
# Copy the binary to the correct location.
663
- " $sh_c " cp " $CACHE_DIR /coder" " $STANDALONE_BINARY_LOCATION "
665
+ " $sh_c " cp " $CACHE_DIR /tmp/coder" " $STANDALONE_BINARY_LOCATION "
666
+
667
+ # Clean up the extracted files (note, not using sudo: $sh_c -> sh_c).
668
+ sh_c rm -rv " $CACHE_DIR /tmp"
664
669
665
670
echo_standalone_postinstall
666
671
}
0 commit comments