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
# 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() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment