mirror of https://github.com/coder/coder.git
fix(install.sh): remove extracted files after installation (#12879)
This commit is contained in:
parent
7c0fac9906
commit
b06452ee88
21
install.sh
21
install.sh
|
@ -639,19 +639,21 @@ install_standalone() {
|
||||||
# fails we can ignore the error as the -w check will then swap us to sudo.
|
# fails we can ignore the error as the -w check will then swap us to sudo.
|
||||||
sh_c mkdir -p "$STANDALONE_INSTALL_PREFIX" 2>/dev/null || true
|
sh_c mkdir -p "$STANDALONE_INSTALL_PREFIX" 2>/dev/null || true
|
||||||
|
|
||||||
|
sh_c mkdir -p "$CACHE_DIR/tmp"
|
||||||
|
if [ "$STANDALONE_ARCHIVE_FORMAT" = tar.gz ]; then
|
||||||
|
sh_c tar -C "$CACHE_DIR/tmp" -xzf "$CACHE_DIR/coder_${VERSION}_${OS}_${ARCH}.tar.gz"
|
||||||
|
else
|
||||||
|
sh_c unzip -d "$CACHE_DIR/tmp" -o "$CACHE_DIR/coder_${VERSION}_${OS}_${ARCH}.zip"
|
||||||
|
fi
|
||||||
|
|
||||||
|
STANDALONE_BINARY_LOCATION="$STANDALONE_INSTALL_PREFIX/bin/$STANDALONE_BINARY_NAME"
|
||||||
|
|
||||||
sh_c="sh_c"
|
sh_c="sh_c"
|
||||||
if [ ! -w "$STANDALONE_INSTALL_PREFIX" ]; then
|
if [ ! -w "$STANDALONE_INSTALL_PREFIX" ]; then
|
||||||
sh_c="sudo_sh_c"
|
sh_c="sudo_sh_c"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
"$sh_c" mkdir -p "$STANDALONE_INSTALL_PREFIX/bin"
|
"$sh_c" mkdir -p "$STANDALONE_INSTALL_PREFIX/bin"
|
||||||
if [ "$STANDALONE_ARCHIVE_FORMAT" = tar.gz ]; then
|
|
||||||
"$sh_c" tar -C "$CACHE_DIR" -xzf "$CACHE_DIR/coder_${VERSION}_${OS}_${ARCH}.tar.gz"
|
|
||||||
else
|
|
||||||
"$sh_c" unzip -d "$CACHE_DIR" -o "$CACHE_DIR/coder_${VERSION}_${OS}_${ARCH}.zip"
|
|
||||||
fi
|
|
||||||
|
|
||||||
STANDALONE_BINARY_LOCATION="$STANDALONE_INSTALL_PREFIX/bin/$STANDALONE_BINARY_NAME"
|
|
||||||
|
|
||||||
# Remove the file if it already exists to
|
# Remove the file if it already exists to
|
||||||
# avoid https://github.com/coder/coder/issues/2086
|
# avoid https://github.com/coder/coder/issues/2086
|
||||||
|
@ -660,7 +662,10 @@ install_standalone() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy the binary to the correct location.
|
# Copy the binary to the correct location.
|
||||||
"$sh_c" cp "$CACHE_DIR/coder" "$STANDALONE_BINARY_LOCATION"
|
"$sh_c" cp "$CACHE_DIR/tmp/coder" "$STANDALONE_BINARY_LOCATION"
|
||||||
|
|
||||||
|
# Clean up the extracted files (note, not using sudo: $sh_c -> sh_c).
|
||||||
|
sh_c rm -rv "$CACHE_DIR/tmp"
|
||||||
|
|
||||||
echo_standalone_postinstall
|
echo_standalone_postinstall
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue