Skip to content
Snippets Groups Projects
Unverified Commit f9120c13 authored by Massimiliano Adamo's avatar Massimiliano Adamo
Browse files

fix exit status

parent 2851507e
No related branches found
No related tags found
No related merge requests found
Pipeline #29563 passed
...@@ -28,23 +28,26 @@ stty -echoctl # hide ^C ...@@ -28,23 +28,26 @@ stty -echoctl # hide ^C
# function called by trap # function called by trap
clean_up() { clean_up() {
rm -f $TMP_CERT $TMP_FULLCHAIN $TMP_CA $TMP_KEY rm -f $TMP_CERT $TMP_FULLCHAIN $TMP_CA $TMP_KEY
exit $1 if [ "$#" -eq 1 ]; then
exit $1
fi
exit
} }
trap 'clean_up' SIGINT trap 'clean_up' SIGINT
if [ $(id -u) -ne 0 ]; then if [ $(id -u) -ne 0 ]; then
echo -e "plase run this script as root\ngiving up..." echo -e "plase run this script as root\ngiving up..."
clean_up clean_up 2
elif ! which curl jq &>/dev/null; then elif ! which curl jq &>/dev/null; then
echo -e "please install curl and jq\ngiving up..." echo -e "please install curl and jq\ngiving up..."
clean_up clean_up 2
fi fi
# lsb_release is not always installed # lsb_release is not always installed
if ! source /etc/os-release &>/dev/null; then 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 "no idea what to do with this OS: I was not able to access /etc/os-release"
echo "" echo ""
clean_up clean_up 2
elif [[ "$ID" == "ubuntu" ]] || [[ "$ID" == "debian" ]] || [[ "$ID" == "arch"* ]]; then elif [[ "$ID" == "ubuntu" ]] || [[ "$ID" == "debian" ]] || [[ "$ID" == "arch"* ]]; then
CERT_BASE="/etc/ssl/certs" CERT_BASE="/etc/ssl/certs"
KEY_BASE="/etc/ssl/private" KEY_BASE="/etc/ssl/private"
...@@ -57,7 +60,7 @@ else ...@@ -57,7 +60,7 @@ else
echo "no idea what to do with OS: $ID" echo "no idea what to do with OS: $ID"
echo "please amend the script accordingly" echo "please amend the script accordingly"
echo "" echo ""
clean_up clean_up 2
fi fi
usage() { usage() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment