OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 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 # Script to build a bootable keyfob-based chromeos system image from within | 7 # Script to build a bootable keyfob-based chromeos system image from within |
8 # a chromiumos setup. This assumes that all needed packages have been built into | 8 # a chromiumos setup. This assumes that all needed packages have been built into |
9 # the given target's root with binary packages turned on. This script will | 9 # the given target's root with binary packages turned on. This script will |
10 # build the Chrome OS image using only pre-built binary packages. | 10 # build the Chrome OS image using only pre-built binary packages. |
11 | 11 |
12 # --- BEGIN COMMON.SH BOILERPLATE --- | |
13 # Load common CrOS utilities. Inside the chroot this file is installed in | 12 # Load common CrOS utilities. Inside the chroot this file is installed in |
14 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's | 13 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
15 # location. | 14 # location. |
16 find_common_sh() { | 15 find_common_sh() { |
17 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) | 16 local common_paths=(/usr/lib/crosutils $(dirname "$0")) |
18 local path | 17 local path |
19 | 18 |
20 SCRIPT_ROOT= | 19 SCRIPT_ROOT= |
21 for path in "${common_paths[@]}"; do | 20 for path in "${common_paths[@]}"; do |
22 if [ -r "${path}/common.sh" ]; then | 21 local common="${path}/common.sh" |
| 22 if ([ -r "${common}" ] && . "${common}" && [ -d "${SCRIPTS_DIR}" ]); then |
23 SCRIPT_ROOT=${path} | 23 SCRIPT_ROOT=${path} |
24 break | 24 break |
25 fi | 25 fi |
26 done | 26 done |
27 } | 27 } |
28 | 28 |
29 find_common_sh | 29 find_common_sh |
30 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) | 30 . "${SCRIPT_ROOT}/common.sh" || ! echo "Unable to load common.sh" || exit 1 |
31 # --- END COMMON.SH BOILERPLATE --- | |
32 | 31 |
33 # Load functions and constants for chromeos-install | 32 # Load functions and constants for chromeos-install |
34 [ -f /usr/lib/installer/chromeos-common.sh ] && \ | 33 [ -f /usr/lib/installer/chromeos-common.sh ] && \ |
35 INSTALLER_ROOT=/usr/lib/installer || \ | 34 INSTALLER_ROOT=/usr/lib/installer || \ |
36 INSTALLER_ROOT=$(dirname "$(readlink -f "$0")") | 35 INSTALLER_ROOT=$(dirname "$(readlink -f "$0")") |
37 | 36 |
38 . "${INSTALLER_ROOT}/chromeos-common.sh" || \ | 37 . "${INSTALLER_ROOT}/chromeos-common.sh" || \ |
39 die "Unable to load chromeos-common.sh" | 38 die "Unable to load chromeos-common.sh" |
40 | 39 |
41 locate_gpt | 40 locate_gpt |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" | 838 echo "Developer image created as ${DEVELOPER_IMAGE_NAME}" |
840 fi | 839 fi |
841 | 840 |
842 print_time_elapsed | 841 print_time_elapsed |
843 | 842 |
844 echo "To copy to USB keyfob, do something like:" | 843 echo "To copy to USB keyfob, do something like:" |
845 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" | 844 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdX" |
846 echo "To convert to VMWare image, INSIDE the chroot, do something like:" | 845 echo "To convert to VMWare image, INSIDE the chroot, do something like:" |
847 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" | 846 echo " ./image_to_vm.sh --from=${OUTSIDE_OUTPUT_DIR} --board=${BOARD}" |
848 echo "from the scripts directory where you entered the chroot." | 847 echo "from the scripts directory where you entered the chroot." |
OLD | NEW |