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.
The gist of this pull request:
Bash by default is very lenient about catching errors, so a script should be set to halt for reasons including unset variables or failed commands. While a little extra work is required in making a script more defensive, it could save some headaches later when trying to catch a bug that slips by in testing but comes up in production.
Dependency checking is also used, because a new user might want to use this utility but might not know which packages need to be installed aside from the ones that ship with their distribution.
Code formatting is also cleaned up a bit, for instance$VAR is changed to "$ {VAR}". In Bash, everything is a string, and certain statements might evaluate differently because there was a space in a variable that wasn't escaped
That said, I haven't been able to run the entirety of this script since I have neither the .img files nor the hardware to flash them on, so there's likely a regression introduced due to reliance on certain behaviour that would've been caught as a bug. Please let me know if there are any bugs you've found and I can try to fix them.