From 95e56d1ca224e2b5fcd9d1aff8088568df4ce889 Mon Sep 17 00:00:00 2001 From: Anton Staaf Date: Thu, 27 Jan 2011 09:38:46 -0800 Subject: [PATCH] Update cros_overlay_list to work from either src/scripts or /usr/bin. Change-Id: If4c2852568454c2dccf09b0fc1e180ed228a1bb7 BUG=chromium-os:4230 TEST=run cros_overlay_list from both locations in the chroot and src/scripts outside the chroot. Review URL: http://codereview.chromium.org/6293021 --- bin/cros_overlay_list | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/bin/cros_overlay_list b/bin/cros_overlay_list index 2cf911a858..7031068261 100755 --- a/bin/cros_overlay_list +++ b/bin/cros_overlay_list @@ -6,9 +6,24 @@ # This script generates the list of board overlays and variants. -# Load common constants. This should be the first executable line. -# The path to common.sh should be relative to your script's location. -. "$(dirname "$0")/../common.sh" +# Load common CrOS utilities. Inside the chroot this file is installed in +# /usr/lib/crosutils. Outside the chroot we find it relative to the scripts +# location. +common_paths="/usr/lib/crosutils $(dirname "$0")/.." + +for path in ${common_paths} ; do + if [ -f "${path}/common.sh" ] ; then + COMMON_SH="${path}/common.sh" + break + fi +done + +if [ -z "${COMMON_SH}" ] ; then + error "common.sh not found in search path (${common_paths})" + exit 1 +fi + +. "${COMMON_SH}" get_default_board