Preserve exit value when leaving cleanup trap
If we entered the cleanup trap due to exit with an error code we should exit dib with an error code. Change-Id: Iee1a05668b3239113fb91a2da0d9a66d7de4db6b
This commit is contained in:
parent
8a8bbb5673
commit
f06493bcd6
@ -36,7 +36,7 @@ function mk_build_dir () {
|
|||||||
sudo mount -t tmpfs tmpfs $TMP_IMAGE_DIR
|
sudo mount -t tmpfs tmpfs $TMP_IMAGE_DIR
|
||||||
fi
|
fi
|
||||||
sudo chown $(id -u):$(id -g) $TMP_BUILD_DIR $TMP_IMAGE_DIR
|
sudo chown $(id -u):$(id -g) $TMP_BUILD_DIR $TMP_IMAGE_DIR
|
||||||
trap cleanup EXIT
|
trap trap_cleanup EXIT
|
||||||
echo Building in $TMP_BUILD_DIR
|
echo Building in $TMP_BUILD_DIR
|
||||||
export TMP_IMAGE_PATH=$TMP_IMAGE_DIR/image.raw
|
export TMP_IMAGE_PATH=$TMP_IMAGE_DIR/image.raw
|
||||||
export TMP_HOOKS_PATH=$TMP_BUILD_DIR/hooks
|
export TMP_HOOKS_PATH=$TMP_BUILD_DIR/hooks
|
||||||
|
@ -28,6 +28,12 @@ function unmount_image () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function trap_cleanup() {
|
||||||
|
exitval=$?
|
||||||
|
cleanup
|
||||||
|
exit $exitval
|
||||||
|
}
|
||||||
|
|
||||||
function cleanup () {
|
function cleanup () {
|
||||||
unmount_image
|
unmount_image
|
||||||
cleanup_dirs
|
cleanup_dirs
|
||||||
|
Loading…
Reference in New Issue
Block a user