mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-04 19:56:32 +02:00
restart_in_chroot_if_needed can run scripts from bin/. cros_workon_now does this
BUG=chromium-os:9877 TEST=ran bin/cros_workon_now, cros_workon, set_shared_user_password Note---this introduces another bashism to common.sh. However, despite comments to the contrary, common.sh does not actually parse under dash without this change Change-Id: I1e6b9751afa8341c100f3b8e0b96284835a53d17 Review URL: http://codereview.chromium.org/5444002
This commit is contained in:
parent
a8ae0bc63b
commit
3b9107014b
@ -10,7 +10,7 @@
|
||||
. "$(dirname $0)/../common.sh"
|
||||
|
||||
# Script must be run inside the chroot.
|
||||
assert_inside_chroot
|
||||
restart_in_chroot_if_needed "$@"
|
||||
|
||||
get_default_board
|
||||
|
||||
|
||||
10
common.sh
10
common.sh
@ -106,7 +106,7 @@ DEFAULT_BUILD_ROOT=${CHROMEOS_BUILD_ROOT:-"$SRC_ROOT/build"}
|
||||
# Set up a global ALL_BOARDS value
|
||||
if [ -d $SRC_ROOT/overlays ]; then
|
||||
ALL_BOARDS=$(cd $SRC_ROOT/overlays;ls -1d overlay-* 2>&-|sed 's,overlay-,,g')
|
||||
fi
|
||||
fi
|
||||
# Strip CR
|
||||
ALL_BOARDS=$(echo $ALL_BOARDS)
|
||||
# Set a default BOARD
|
||||
@ -231,11 +231,15 @@ function make_pkg_common {
|
||||
|
||||
# Enter a chroot and restart the current script if needed
|
||||
function restart_in_chroot_if_needed {
|
||||
# NB: Pass in ARGV: restart_in_chroot_if_needed "$@"
|
||||
if [ $INSIDE_CHROOT -ne 1 ]
|
||||
then
|
||||
# Equivalent to enter_chroot.sh -- <current command>
|
||||
local abspath=$(readlink -f "$0")
|
||||
# strip everything up to (and including) /src/scripts/ from abspath
|
||||
local path_from_scripts="${abspath##*/src/scripts/}"
|
||||
exec $SCRIPTS_DIR/enter_chroot.sh -- \
|
||||
$CHROOT_TRUNK_DIR/src/scripts/$(basename $0) $*
|
||||
"$CHROOT_TRUNK_DIR/src/scripts/$path_from_scripts" "$@"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user