@@ -624,20 +624,21 @@ install_standalone() {
624
624
# fails we can ignore the error as the -w check will then swap us to sudo.
625
625
sh_c mkdir -p" $STANDALONE_INSTALL_PREFIX " 2> /dev/null|| true
626
626
627
+ sh_c mkdir -p" $CACHE_DIR /tmp"
628
+ if [" $STANDALONE_ARCHIVE_FORMAT " = tar.gz ]; then
629
+ sh_c tar -C" $CACHE_DIR /tmp" -xzf" $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .tar.gz"
630
+ else
631
+ sh_c unzip -d" $CACHE_DIR /tmp" -o" $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .zip"
632
+ fi
633
+
634
+ STANDALONE_BINARY_LOCATION=" $STANDALONE_INSTALL_PREFIX /bin/$STANDALONE_BINARY_NAME "
635
+
627
636
sh_c=" sh_c"
628
637
if [! -w " $STANDALONE_INSTALL_PREFIX " ]; then
629
638
sh_c=" sudo_sh_c"
630
639
fi
631
640
632
641
" $sh_c " mkdir -p" $STANDALONE_INSTALL_PREFIX /bin"
633
- " $sh_c " mkdir -p" $CACHE_DIR /tmp"
634
- if [" $STANDALONE_ARCHIVE_FORMAT " = tar.gz ]; then
635
- " $sh_c " tar -C" $CACHE_DIR /tmp" -xzf" $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .tar.gz"
636
- else
637
- " $sh_c " unzip -d" $CACHE_DIR /tmp" -o" $CACHE_DIR /coder_${VERSION} _${OS} _${ARCH} .zip"
638
- fi
639
-
640
- STANDALONE_BINARY_LOCATION=" $STANDALONE_INSTALL_PREFIX /bin/$STANDALONE_BINARY_NAME "
641
642
642
643
# Remove the file if it already exists to
643
644
# avoid https://github.com/coder/coder/issues/2086
@@ -647,7 +648,9 @@ install_standalone() {
647
648
648
649
# Copy the binary to the correct location.
649
650
" $sh_c " cp" $CACHE_DIR /tmp/coder" " $STANDALONE_BINARY_LOCATION "
650
- " $sh_c " rm -rv" $CACHE_DIR /tmp"
651
+
652
+ # Clean up the extracted files (note, not using sudo: $sh_c -> sh_c).
653
+ sh_c rm -rv" $CACHE_DIR /tmp"
651
654
652
655
echo_standalone_postinstall
653
656
}