fix: bad exitcode with --update-fwdb due to trap exit

This commit is contained in:
Stéphane Lesimple 2023-02-24 20:55:41 +01:00
parent 3c988cc73a
commit 48abeb5950

View File

@ -18,6 +18,7 @@ trap 'exit_cleanup' EXIT
trap '_warn "interrupted, cleaning up..."; exit_cleanup; exit 1' INT trap '_warn "interrupted, cleaning up..."; exit_cleanup; exit 1' INT
exit_cleanup() exit_cleanup()
{ {
saved_ret=$?
# cleanup the temp decompressed config & kernel image # cleanup the temp decompressed config & kernel image
[ -n "${dumped_config:-}" ] && [ -f "$dumped_config" ] && rm -f "$dumped_config" [ -n "${dumped_config:-}" ] && [ -f "$dumped_config" ] && rm -f "$dumped_config"
[ -n "${kerneltmp:-}" ] && [ -f "$kerneltmp" ] && rm -f "$kerneltmp" [ -n "${kerneltmp:-}" ] && [ -f "$kerneltmp" ] && rm -f "$kerneltmp"
@ -30,6 +31,7 @@ exit_cleanup()
[ "${insmod_msr:-}" = 1 ] && rmmod msr 2>/dev/null [ "${insmod_msr:-}" = 1 ] && rmmod msr 2>/dev/null
[ "${kldload_cpuctl:-}" = 1 ] && kldunload cpuctl 2>/dev/null [ "${kldload_cpuctl:-}" = 1 ] && kldunload cpuctl 2>/dev/null
[ "${kldload_vmm:-}" = 1 ] && kldunload vmm 2>/dev/null [ "${kldload_vmm:-}" = 1 ] && kldunload vmm 2>/dev/null
exit $saved_ret
} }
# if we were git clone'd, adjust VERSION # if we were git clone'd, adjust VERSION