mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-20 21:21:32 +02:00
*: 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:
parent
60d6b80053
commit
935466b68d
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
10
common.sh
10
common.sh
@ -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() {
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user