diff --git a/build_image b/build_image index a9f54ecf99..5ea08da4b2 100755 --- a/build_image +++ b/build_image @@ -12,6 +12,11 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0")) . "${SCRIPT_ROOT}/common.sh" || exit 1 +# Script must run inside the chroot +restart_in_chroot_if_needed "$@" + +assert_not_root_user + # Developer-visible flags. DEFINE_string board "${DEFAULT_BOARD}" \ "The board to build an image for." diff --git a/image_to_vm.sh b/image_to_vm.sh index 37d25de020..585f02abe4 100755 --- a/image_to_vm.sh +++ b/image_to_vm.sh @@ -8,10 +8,15 @@ # disk image, supporting a variety of different targets. - # Helper scripts should be run from the same location as this script. SCRIPT_ROOT=$(dirname "$(readlink -f "$0")") . "${SCRIPT_ROOT}/common.sh" || exit 1 + +# Script must run inside the chroot +restart_in_chroot_if_needed "$@" + +assert_not_root_user + . "${BUILD_LIBRARY_DIR}/toolchain_util.sh" || exit 1 . "${BUILD_LIBRARY_DIR}/build_image_util.sh" || exit 1 . "${BUILD_LIBRARY_DIR}/vm_image_util.sh" || exit 1