mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-06 20:47:00 +02:00
Added restart_in_chroot_if_needed to common.sh.
Add restart_in_chroot_if_needed to common.sh, and modify the build scripts which referred to assert_inside_chroot to use it instead. The effect is that you don't ever have to explicitly enter_chroot.sh to build (still can, it work's fine). Update mod_image_for_test.sh to use restart_in_chroot_if_needed Review URL: http://codereview.chromium.org/1736025
This commit is contained in:
parent
c1214dc327
commit
640a0585f5
@ -12,7 +12,7 @@
|
||||
. "$(dirname "$0")/chromeos-common.sh"
|
||||
|
||||
# Script must be run inside the chroot.
|
||||
assert_inside_chroot
|
||||
restart_in_chroot_if_needed $*
|
||||
|
||||
get_default_board
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
. "$(dirname "$0")/common.sh"
|
||||
|
||||
# Script must be run inside the chroot.
|
||||
assert_inside_chroot
|
||||
restart_in_chroot_if_needed $*
|
||||
|
||||
get_default_board
|
||||
|
||||
|
@ -8,8 +8,8 @@
|
||||
# The path to common.sh should be relative to your script's location.
|
||||
. "$(dirname "$0")/common.sh"
|
||||
|
||||
assert_inside_chroot
|
||||
assert_not_root_user
|
||||
restart_in_chroot_if_needed $*
|
||||
get_default_board
|
||||
|
||||
# Flags
|
||||
|
10
common.sh
10
common.sh
@ -207,6 +207,16 @@ function make_pkg_common {
|
||||
popd
|
||||
}
|
||||
|
||||
# Enter a chroot and restart the current script if needed
|
||||
function restart_in_chroot_if_needed {
|
||||
if [ $INSIDE_CHROOT -ne 1 ]
|
||||
then
|
||||
# Equivalent to enter_chroot.sh -- <current command>
|
||||
exec $SCRIPTS_DIR/enter_chroot.sh -- \
|
||||
$CHROOT_TRUNK_DIR/src/scripts/$(basename $0) $*
|
||||
fi
|
||||
}
|
||||
|
||||
# Fail unless we're inside the chroot. This guards against messing up your
|
||||
# workstation.
|
||||
function assert_inside_chroot {
|
||||
|
@ -9,7 +9,7 @@
|
||||
. "$(dirname "$0")/common.sh"
|
||||
|
||||
# Script must be run inside the chroot
|
||||
assert_inside_chroot
|
||||
restart_in_chroot_if_needed $*
|
||||
get_default_board
|
||||
|
||||
# Flags
|
||||
|
@ -12,7 +12,7 @@
|
||||
. "$(dirname "$0")/common.sh"
|
||||
|
||||
# Script must be run inside the chroot
|
||||
assert_inside_chroot
|
||||
restart_in_chroot_if_needed $*
|
||||
|
||||
FLAGS_HELP="USAGE: $0 [flags]"
|
||||
|
||||
|
@ -10,6 +10,9 @@ COMMON_SH="$(dirname "$0")/common.sh"
|
||||
. "$COMMON_SH"
|
||||
|
||||
# Script must be run inside the chroot if not in 'always serve' mode.
|
||||
[[ $1 != "-a" && assert_inside_chroot ]]
|
||||
if [[ "$1" != "-a" ]]
|
||||
then
|
||||
restart_in_chroot_if_needed $*
|
||||
fi
|
||||
|
||||
cd ${GCLIENT_ROOT}/src/platform/dev && python devserver.py $*
|
||||
|
Loading…
Reference in New Issue
Block a user