From 856799a47f1ddb8d087bd76200e997f17260c10d Mon Sep 17 00:00:00 2001 From: Anton Staaf Date: Wed, 26 Jan 2011 11:23:50 -0800 Subject: [PATCH] Fix common.sh to work in it's new location at /usr/lib/crosutils. If we are inside the chroot then we assume that the "gclient" root is ~/trunk. If we are outside the chroot we continue with the previous search mechanism to find the "gclient" root. Change-Id: Ia40de609ea596228fec2644ff3046e376b112b06 BUG=chromium-os:4230 TEST=run "src/scripts/cros_overlay_list --board tegra2 --variant seaboard" inside and outside the chroot. Review URL: http://codereview.chromium.org/6265028 --- common.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/common.sh b/common.sh index a4d9138433..4fe71e4c5b 100644 --- a/common.sh +++ b/common.sh @@ -17,11 +17,24 @@ NUM_JOBS=`grep -c "^processor" /proc/cpuinfo` # Store location of the calling script. TOP_SCRIPT_DIR="${TOP_SCRIPT_DIR:-$(dirname $0)}" +# Detect whether we're inside a chroot or not +if [ -e /etc/debian_chroot ] +then + INSIDE_CHROOT=1 +else + INSIDE_CHROOT=0 +fi + # Find root of source tree if [ "x$GCLIENT_ROOT" != "x" ] then # GCLIENT_ROOT already set, so we're done true +elif [ $INSIDE_CHROOT -eq 1 ] +then + # If we are inside the chroot and we haven't been told otherwise, we assume + # that the GCLIENT_ROOT is ~/trunk. + GCLIENT_ROOT="${HOME}/trunk" elif [ "x$COMMON_SH" != "x" ] then # COMMON_SH set, so assume that's us @@ -116,14 +129,6 @@ DEFAULT_BOARD=$(echo $ALL_BOARDS | awk '{print $NF}') # Enable --fast by default. DEFAULT_FAST="${FLAGS_TRUE}" -# Detect whether we're inside a chroot or not -if [ -e /etc/debian_chroot ] -then - INSIDE_CHROOT=1 -else - INSIDE_CHROOT=0 -fi - # Directory locations inside the dev chroot CHROOT_TRUNK_DIR="/home/$USER/trunk"