Install script: Error handling, shellcheck, shellfmt, various minor fixes, prefer rsync over cp. #35
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.
Main motivation for PR: My profile in firefox was something like $HOME/$FIREFOXFOLDER//le545tters.default-654654. Therefore, the detection of *.default in the install script was not working for me.
I fixed this by searching for all profiles containing ".default" and we use the first match we find. I also added more error handling, error messages, and some minor stuff like typo fixes. If someone feeds illegal/non-existing directories to -f or -p, no work is done and we exit early while informing the user. I forced the symlink at the end of the script, so we don't throw errors if symlink already exists. I also ran ShellCheck against the script and fixed everything I caught. Finally, I ran shellfmt on the script.
I also added rsync detection and usage instead of cp if it's on the host. This is to avoid copying in entire git repos into firefox folders where possible.