Priorise trap above vars_setup()

vars_setup() has become more complex, therefore, trap should be set earlier.

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
Richard T Bonhomme 2022-04-20 22:06:25 +01:00
parent 59ff47420c
commit a0ed1203f2
No known key found for this signature in database
GPG Key ID: 2D767DB92FB6C246

View File

@ -2981,6 +2981,16 @@ subjectAltName = $val" ;;
shift
done
# Register cleanup on EXIT
trap "cleanup" EXIT
# When SIGHUP, SIGINT, SIGQUIT, SIGABRT and SIGTERM,
# explicitly exit to signal EXIT (non-bash shells)
trap "exit 1" 1
trap "exit 2" 2
trap "exit 3" 3
trap "exit 6" 6
trap "exit 14" 15
# Set cmd now because vars_setup needs to know if this is init-pki
cmd="$1"
[ -n "$1" ] && shift # scrape off command
@ -2997,16 +3007,6 @@ esac
# Intelligent env-var detection and auto-loading:
vars_setup
# Register cleanup on EXIT
trap "cleanup" EXIT
# When SIGHUP, SIGINT, SIGQUIT, SIGABRT and SIGTERM,
# explicitly exit to signal EXIT (non-bash shells)
trap "exit 1" 1
trap "exit 2" 2
trap "exit 3" 3
trap "exit 6" 6
trap "exit 14" 15
# determine how we were called, then hand off to the function responsible
case "$cmd" in
init-pki|clean-all)