Bug #5836: Insufficient space in 1GB NanoBSD image to upgrade 2.3 snapshots cleanly.
pfSense-upgrade: Make sure it aborts update when pkg calls fail
When free space on PKG_CACHEDIR is not enough to download updates, throw an error and exit
Save pkg call return code to use on return. The way it is now is always returning 0. It should fix #5837
Since the introduction of pkg_with_pb(), direct calls to this function
were added using the following format:
if ! pkg_with_pb ... | tee -a $logfile; then
What happened in this case is if was always getting a successfull
return code from tee call, and pkg_with_pb return was always being
ignored leading pfSense-upgrade to keep running when a fatal error
Since we need to print pkg output and also send it to log, _exec() call
is the best option here.
Added necessary flags to make sure necessary actions (unlock additional
packages or cleaning up kernel package annotation) are executed on
_exit call in fatal cases and replaced all direct calls by _exec()