Improve error handling in install.sh (#404)

Prior to this change, running the example from the docs without root privs produces this misleading/confusing output that claims that the software was installed when it wasn't:

```console
$ wget -qO - https://raw.githubusercontent.com/cupcakearmy/autorestic/master/install.sh | bash
linux
amd64
/usr/local/bin/autorestic.bz2: Permission denied
bzip2: Can't open input file /usr/local/bin/autorestic.bz2: No such file or directory.
chmod: cannot access '/usr/local/bin/autorestic': No such file or directory
bash: line 49: autorestic: command not found
Successfully installed autorestic
```

With this change, the errors stop the script much earlier and produce this output instead:

```
linux
amd64
/usr/local/bin/autorestic.bz2: Permission denied
```
This commit is contained in:
Wez Furlong 2024-10-21 07:06:49 -07:00 committed by GitHub
parent 41e4e4a5f3
commit 8a773856de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
set -e -o pipefail
shopt -s nocaseglob shopt -s nocaseglob
OUT_FILE=/usr/local/bin/autorestic OUT_FILE=/usr/local/bin/autorestic