-
-
Notifications
You must be signed in to change notification settings - Fork 133
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Protect against aborted connections #42
Conversation
WalkthroughWalkthroughThe Bash script for installing HACS has undergone a delightful makeover! By wrapping the entire logic in a shiny new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Script
participant HACS
User->>Script: Start Installation
Script->>Script: Check for `wget` and `unzip`
Script->>Script: Find Home Assistant Config Directory
Script->>HACS: Download HACS Zip
Script->>Script: Verify Version
Script->>User: Installation Complete
So, what do you call a script that keeps everything organized? A “bash”ful one! Get it? Because it’s a bash script! 😄 Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This is totally wrong. The main body of the script is literally the exact same - you can click the gear icon in the "Files changed" tab and select the option to eliminate whitespace to see for yourself. (GitHub kinda buries it so I was going to write this comment anyway lol) Ironically one of the "additional comments not posted" was actually on the money! 😬 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 👍
Best practice when doing
curl | bash
(orcurl | any_interpreter
really) is to wrap all your actual logic into a function which is executed only at the end of the script. The reason is because otherwise, if the connection is aborted partway, then the script will have half-run.I did not test this, but it looks like y'all have CI? And the change is trivial anyway (I did
sed -i 's/^/ /' get
to make the whitespace changes, wrapped the result in a function declaration, and then didsed -Ei 's/^[[:space:]]+$//' get
because I realized my firstsed
invocation messed with empty lines as well).