From 8a773856dee5f614e3fc7ac02f3b12ac0a8d9191 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 21 Oct 2024 07:06:49 -0700 Subject: [PATCH] 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 ``` --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index f70a584..68d70f4 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,5 @@ #!/bin/bash - +set -e -o pipefail shopt -s nocaseglob OUT_FILE=/usr/local/bin/autorestic