From f9120c13d4157e2e37c5aefd948c14ff05c89abd Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo <massimiliano.adamo@geant.org> Date: Tue, 1 Jun 2021 23:28:23 +0200 Subject: [PATCH] fix exit status --- acme-downloader.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/acme-downloader.sh b/acme-downloader.sh index 5b394c3..f2ea20b 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() { -- GitLab