Merge branch 'TinCanTech-build-full-cleanup'

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
Richard T Bonhomme 2022-09-23 14:23:10 +01:00
commit 027a3e432f
No known key found for this signature in database
GPG Key ID: 2D767DB92FB6C246

View File

@ -667,6 +667,7 @@ easyrsa_mktemp() {
# remove temp files and do terminal cleanups
cleanup() {
verbose "* Cleanup!"
if [ "${EASYRSA_TEMP_DIR_session%/*}" ] && \
[ -d "$EASYRSA_TEMP_DIR_session" ]
then
@ -688,6 +689,9 @@ cleanup() {
rm -rf "$EASYRSA_EC_DIR"
fi
# Remove files when build_full()->sign_req() is interrupted
[ "$on_error_build_full_cleanup" ] && rm -f "$crt_out" "$req_out" "$key_out"
# Restore files when renew is interrupted
[ "$on_error_undo_renew_move" ] && renew_restore_move; :
# Restore files when rebuild is interrupted
@ -1851,10 +1855,12 @@ Option conflict: '$cmd' does not support setting an external commonName"
gen_req "$name" batch ${nopass+ nopass}
# Sign it
( sign_req "$crt_type" "$name" ) || {
rm -f "$crt_out" "$req_out" "$key_out"
on_error_build_full_cleanup=1
if sign_req "$crt_type" "$name"; then
unset -v on_error_build_full_cleanup
else
die "Failed to sign '$name' - See error messages above for details."
}
fi
# inline it
if [ "$EASYRSA_INLINE" ]; then