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