- Notifications
You must be signed in to change notification settings - Fork927
fix(install.sh): remove extracted files after installation#12879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -639,19 +639,21 @@ install_standalone() { | ||
# 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 "$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" | ||
if [ ! -w "$STANDALONE_INSTALL_PREFIX" ]; then | ||
sh_c="sudo_sh_c" | ||
fi | ||
"$sh_c" mkdir -p "$STANDALONE_INSTALL_PREFIX/bin" | ||
# Remove the file if it already exists to | ||
# avoid https://github.com/coder/coder/issues/2086 | ||
@@ -660,7 +662,10 @@ install_standalone() { | ||
fi | ||
# Copy the binary to the correct 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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. nit it's possible to perform cleanup using traps too. Would implementing this practice here be helpful, or would it add unnecessary complexity? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. It's a good suggestion and definitely an option (unless shell compatibility is weak for some reason, haven't checked). Another option would be to split it up into two functions, where we:
For now though, I only want to make small changes to the script in stages/as needed, so we don't suddenly break it as there aren't really any tests I believe. 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Alright, thanks for the guidance! | ||
echo_standalone_postinstall | ||
} | ||