| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # This script generates the list of board overlays and variants. | 7 # This script generates the list of board overlays and variants. |
| 8 | 8 |
| 9 # --- BEGIN COMMON.SH BOILERPLATE --- |
| 9 # Load common CrOS utilities. Inside the chroot this file is installed in | 10 # Load common CrOS utilities. Inside the chroot this file is installed in |
| 10 # /usr/lib/crosutils. Outside the chroot we find it relative to the scripts | 11 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 11 # location. | 12 # location. |
| 12 common_paths="/usr/lib/crosutils $(dirname "$0")/.." | 13 find_common_sh() { |
| 14 local common_paths=(/usr/lib/crosutils "$(dirname "$(readlink -f "$0")")/..") |
| 15 local path |
| 13 | 16 |
| 14 for path in ${common_paths} ; do | 17 SCRIPT_ROOT= |
| 15 if [ -f "${path}/common.sh" ] ; then | 18 for path in "${common_paths[@]}"; do |
| 16 COMMON_SH="${path}/common.sh" | 19 if [ -r "${path}/common.sh" ]; then |
| 17 break | 20 SCRIPT_ROOT=${path} |
| 18 fi | 21 break |
| 19 done | 22 fi |
| 23 done |
| 24 } |
| 20 | 25 |
| 21 if [ -z "${COMMON_SH}" ] ; then | 26 find_common_sh |
| 22 error "common.sh not found in search path (${common_paths})" | 27 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 23 exit 1 | 28 # --- END COMMON.SH BOILERPLATE --- |
| 24 fi | |
| 25 | |
| 26 . "${COMMON_SH}" | |
| 27 | 29 |
| 28 get_default_board | 30 get_default_board |
| 29 | 31 |
| 30 # Flags | 32 # Flags |
| 31 DEFINE_string board "$DEFAULT_BOARD" "The name of the board to set up." | 33 DEFINE_string board "$DEFAULT_BOARD" "The name of the board to set up." |
| 32 DEFINE_string board_overlay "" "Location of the board overlay." | 34 DEFINE_string board_overlay "" "Location of the board overlay." |
| 33 DEFINE_boolean primary_only ${FLAGS_FALSE} \ | 35 DEFINE_boolean primary_only ${FLAGS_FALSE} \ |
| 34 "Only return the path to the board's primary overlay. (Default: false)" | 36 "Only return the path to the board's primary overlay. (Default: false)" |
| 35 DEFINE_string variant "" "Board variant." | 37 DEFINE_string variant "" "Board variant." |
| 36 | 38 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 fi | 151 fi |
| 150 fi | 152 fi |
| 151 fi | 153 fi |
| 152 | 154 |
| 153 # | 155 # |
| 154 # Finally, add in any user requested board overlays. | 156 # Finally, add in any user requested board overlays. |
| 155 # | 157 # |
| 156 if [ -d "${FLAGS_board_overlay}" ] ; then | 158 if [ -d "${FLAGS_board_overlay}" ] ; then |
| 157 echo "${FLAGS_board_overlay}" | 159 echo "${FLAGS_board_overlay}" |
| 158 fi | 160 fi |
| OLD | NEW |