diff --git a/build_docker_aci b/build_docker_aci index 22207690f4..b62648608a 100755 --- a/build_docker_aci +++ b/build_docker_aci @@ -11,7 +11,7 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0")) . "${SCRIPT_ROOT}/common.sh" || exit 1 # Script must run inside the chroot -restart_in_chroot_if_needed "$@" +assert_inside_chroot assert_not_root_user diff --git a/build_image b/build_image index 285d113e3e..640a92f2b5 100755 --- a/build_image +++ b/build_image @@ -13,7 +13,7 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0")) . "${SCRIPT_ROOT}/common.sh" || exit 1 # Script must run inside the chroot -restart_in_chroot_if_needed "$@" +assert_inside_chroot assert_not_root_user diff --git a/build_oem_aci b/build_oem_aci index dd6325d48f..d2fbe19a46 100755 --- a/build_oem_aci +++ b/build_oem_aci @@ -11,7 +11,7 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0")) . "${SCRIPT_ROOT}/common.sh" || exit 1 # Script must run inside the chroot -restart_in_chroot_if_needed "$@" +assert_inside_chroot assert_not_root_user diff --git a/build_packages b/build_packages index f869bd45ad..412e4dfc1f 100755 --- a/build_packages +++ b/build_packages @@ -7,7 +7,7 @@ . "$(dirname "$0")/common.sh" || exit 1 # Script must run inside the chroot -restart_in_chroot_if_needed "$@" +assert_inside_chroot assert_not_root_user diff --git a/build_torcx_store b/build_torcx_store index ede3c43067..73532ae40c 100755 --- a/build_torcx_store +++ b/build_torcx_store @@ -7,7 +7,7 @@ . "$(dirname "$0")/common.sh" || exit 1 # Script must run inside the chroot -restart_in_chroot_if_needed "$@" +assert_inside_chroot assert_not_root_user diff --git a/common.sh b/common.sh index f9d294af94..58274d6007 100644 --- a/common.sh +++ b/common.sh @@ -417,16 +417,6 @@ warn_if_nfs() { fi } -# Enter a chroot and restart the current script if needed -restart_in_chroot_if_needed() { - # NB: Pass in ARGV: restart_in_chroot_if_needed "$@" - if [[ ${INSIDE_CHROOT} -ne 1 ]]; then - # Get inside_chroot path for script. - local chroot_path="$(reinterpret_path_for_chroot "$0")" - exec ${GCLIENT_ROOT}/chromite/bin/cros_sdk -- "${chroot_path}" "$@" - fi -} - # Fail unless we're inside the chroot. This guards against messing up your # workstation. assert_inside_chroot() { diff --git a/image_inject_bootchain b/image_inject_bootchain index ddd2de7c5e..a537242ba6 100755 --- a/image_inject_bootchain +++ b/image_inject_bootchain @@ -8,7 +8,7 @@ SCRIPT_ROOT=$(dirname "$(readlink -f "$0")") . "${SCRIPT_ROOT}/common.sh" || exit 1 # Script must run inside the chroot -restart_in_chroot_if_needed "$@" +assert_inside_chroot assert_not_root_user diff --git a/image_set_group b/image_set_group index 1db49e8341..d0e6701297 100755 --- a/image_set_group +++ b/image_set_group @@ -8,7 +8,7 @@ SCRIPT_ROOT=$(dirname "$(readlink -f "$0")") . "${SCRIPT_ROOT}/common.sh" || exit 1 # Script must run inside the chroot -restart_in_chroot_if_needed "$@" +assert_inside_chroot assert_not_root_user diff --git a/image_to_vm.sh b/image_to_vm.sh index b9ea8b5f87..d363897d7d 100755 --- a/image_to_vm.sh +++ b/image_to_vm.sh @@ -13,7 +13,7 @@ SCRIPT_ROOT=$(dirname "$(readlink -f "$0")") . "${SCRIPT_ROOT}/common.sh" || exit 1 # Script must run inside the chroot -restart_in_chroot_if_needed "$@" +assert_inside_chroot assert_not_root_user diff --git a/kernel_menuconfig b/kernel_menuconfig index dfee89ef45..39da3e2127 100755 --- a/kernel_menuconfig +++ b/kernel_menuconfig @@ -8,7 +8,7 @@ SCRIPT_ROOT=$(dirname "$(readlink -f "$0")") . "${SCRIPT_ROOT}/common.sh" || exit 1 # Script must run inside the chroot -restart_in_chroot_if_needed "$@" +assert_inside_chroot assert_not_root_user diff --git a/rebuild_packages b/rebuild_packages index 39ea0349f5..e95040f6cc 100755 --- a/rebuild_packages +++ b/rebuild_packages @@ -8,7 +8,7 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0")) . "${SCRIPT_ROOT}/common.sh" || exit 1 # Script must run inside the chroot -restart_in_chroot_if_needed "$@" +assert_inside_chroot assert_not_root_user diff --git a/set_official b/set_official index e7695f5e22..b8f3f7f52d 100755 --- a/set_official +++ b/set_official @@ -8,7 +8,7 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0")) . "${SCRIPT_ROOT}/common.sh" || exit 1 # Script must run inside the chroot -restart_in_chroot_if_needed "$@" +assert_inside_chroot assert_not_root_user diff --git a/setup_board b/setup_board index 73861d2feb..ec6129a8fe 100755 --- a/setup_board +++ b/setup_board @@ -8,7 +8,7 @@ . "${BUILD_LIBRARY_DIR}/toolchain_util.sh" || exit 1 # Script must run inside the chroot -restart_in_chroot_if_needed "$@" +assert_inside_chroot assert_not_root_user diff --git a/start_devserver b/start_devserver index 0ab19bb757..7ab2f32793 100755 --- a/start_devserver +++ b/start_devserver @@ -10,7 +10,7 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0")) # Script must be run inside the chroot if not in 'always serve' mode. if [[ "$1" != "--archive_dir" ]]; then - restart_in_chroot_if_needed "$@" + assert_inside_chroot fi # This is the location of the script now.