Improve Installation Script Robustness and Compliance #30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This pull request introduces significant improvements to the installation script for bum. The modifications focus on increasing robustness, security, and maintainability while ensuring the script adheres to ShellCheck recommendations and providing a more user-friendly experience.
Key Changes
Helper Functions:
error()
,info()
, andinfo_bold()
functions to standardize error handling and logging.Dependency Checks:
bun
,curl
,tar
,uname
,mkdir
,mv
,rm
) to ensure all dependencies are met before execution.Bun Installation:
Architecture Detection:
uname -ms
with a robust case statement to correctly set the target platform.Download and Extraction Enhancements:
curl
with progress feedback.mktemp
and sets atrap
to guarantee cleanup in case of errors.ShellCheck Compliance:
rm -rf
command using${var:?}
to prevent dangerous expansions.tildify
function to correctly handle tilde expansion by quoting variable expansions appropriately.Environment Configuration:
add_commands_to_file
to append environment variable configuration to the user's shell configuration file (supports Fish, Zsh, and Bash).Impact
These changes make the installation script:
Feel free to review the changes and provide feedback.