Merge "Preserve exit value when leaving cleanup trap"
This commit is contained in:
commit
16b0e5e856
@ -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