*: remove restart_in_chroot_if_needed

Replace calls to restart_in_chroot_if_needed with assert_inside_chroot.
This removes a dependency on chromite.
This commit is contained in:
Andrew Jeddeloh 2018-05-24 14:27:36 -07:00
parent 60d6b80053
commit 935466b68d
14 changed files with 13 additions and 23 deletions

View File

@ -11,7 +11,7 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || exit 1 . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must run inside the chroot # Script must run inside the chroot
restart_in_chroot_if_needed "$@" assert_inside_chroot
assert_not_root_user assert_not_root_user

View File

@ -13,7 +13,7 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || exit 1 . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must run inside the chroot # Script must run inside the chroot
restart_in_chroot_if_needed "$@" assert_inside_chroot
assert_not_root_user assert_not_root_user

View File

@ -11,7 +11,7 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || exit 1 . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must run inside the chroot # Script must run inside the chroot
restart_in_chroot_if_needed "$@" assert_inside_chroot
assert_not_root_user assert_not_root_user

View File

@ -7,7 +7,7 @@
. "$(dirname "$0")/common.sh" || exit 1 . "$(dirname "$0")/common.sh" || exit 1
# Script must run inside the chroot # Script must run inside the chroot
restart_in_chroot_if_needed "$@" assert_inside_chroot
assert_not_root_user assert_not_root_user

View File

@ -7,7 +7,7 @@
. "$(dirname "$0")/common.sh" || exit 1 . "$(dirname "$0")/common.sh" || exit 1
# Script must run inside the chroot # Script must run inside the chroot
restart_in_chroot_if_needed "$@" assert_inside_chroot
assert_not_root_user assert_not_root_user

View File

@ -417,16 +417,6 @@ warn_if_nfs() {
fi 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 # Fail unless we're inside the chroot. This guards against messing up your
# workstation. # workstation.
assert_inside_chroot() { assert_inside_chroot() {

View File

@ -8,7 +8,7 @@ SCRIPT_ROOT=$(dirname "$(readlink -f "$0")")
. "${SCRIPT_ROOT}/common.sh" || exit 1 . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must run inside the chroot # Script must run inside the chroot
restart_in_chroot_if_needed "$@" assert_inside_chroot
assert_not_root_user assert_not_root_user

View File

@ -8,7 +8,7 @@ SCRIPT_ROOT=$(dirname "$(readlink -f "$0")")
. "${SCRIPT_ROOT}/common.sh" || exit 1 . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must run inside the chroot # Script must run inside the chroot
restart_in_chroot_if_needed "$@" assert_inside_chroot
assert_not_root_user assert_not_root_user

View File

@ -13,7 +13,7 @@ SCRIPT_ROOT=$(dirname "$(readlink -f "$0")")
. "${SCRIPT_ROOT}/common.sh" || exit 1 . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must run inside the chroot # Script must run inside the chroot
restart_in_chroot_if_needed "$@" assert_inside_chroot
assert_not_root_user assert_not_root_user

View File

@ -8,7 +8,7 @@ SCRIPT_ROOT=$(dirname "$(readlink -f "$0")")
. "${SCRIPT_ROOT}/common.sh" || exit 1 . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must run inside the chroot # Script must run inside the chroot
restart_in_chroot_if_needed "$@" assert_inside_chroot
assert_not_root_user assert_not_root_user

View File

@ -8,7 +8,7 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || exit 1 . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must run inside the chroot # Script must run inside the chroot
restart_in_chroot_if_needed "$@" assert_inside_chroot
assert_not_root_user assert_not_root_user

View File

@ -8,7 +8,7 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
. "${SCRIPT_ROOT}/common.sh" || exit 1 . "${SCRIPT_ROOT}/common.sh" || exit 1
# Script must run inside the chroot # Script must run inside the chroot
restart_in_chroot_if_needed "$@" assert_inside_chroot
assert_not_root_user assert_not_root_user

View File

@ -8,7 +8,7 @@
. "${BUILD_LIBRARY_DIR}/toolchain_util.sh" || exit 1 . "${BUILD_LIBRARY_DIR}/toolchain_util.sh" || exit 1
# Script must run inside the chroot # Script must run inside the chroot
restart_in_chroot_if_needed "$@" assert_inside_chroot
assert_not_root_user assert_not_root_user

View File

@ -10,7 +10,7 @@ SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
# Script must be run inside the chroot if not in 'always serve' mode. # Script must be run inside the chroot if not in 'always serve' mode.
if [[ "$1" != "--archive_dir" ]]; then if [[ "$1" != "--archive_dir" ]]; then
restart_in_chroot_if_needed "$@" assert_inside_chroot
fi fi
# This is the location of the script now. # This is the location of the script now.