diff --git a/acme-downloader.sh b/acme-downloader.sh index 5b394c314ba0bd9226da60bbec2cb064ddf63860..f2ea20b2f43cc0ebc7c8e24ddff8752f442820c9 100755 --- a/acme-downloader.sh +++ b/acme-downloader.sh @@ -28,23 +28,26 @@ stty -echoctl # hide ^C # function called by trap clean_up() { rm -f $TMP_CERT $TMP_FULLCHAIN $TMP_CA $TMP_KEY - exit $1 + if [ "$#" -eq 1 ]; then + exit $1 + fi + exit } trap 'clean_up' SIGINT if [ $(id -u) -ne 0 ]; then echo -e "plase run this script as root\ngiving up..." - clean_up + clean_up 2 elif ! which curl jq &>/dev/null; then echo -e "please install curl and jq\ngiving up..." - clean_up + clean_up 2 fi # lsb_release is not always installed if ! source /etc/os-release &>/dev/null; then echo "no idea what to do with this OS: I was not able to access /etc/os-release" echo "" - clean_up + clean_up 2 elif [[ "$ID" == "ubuntu" ]] || [[ "$ID" == "debian" ]] || [[ "$ID" == "arch"* ]]; then CERT_BASE="/etc/ssl/certs" KEY_BASE="/etc/ssl/private" @@ -57,7 +60,7 @@ else echo "no idea what to do with OS: $ID" echo "please amend the script accordingly" echo "" - clean_up + clean_up 2 fi usage() {