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 # Load common constants. This should be the first executable line. | 7 # --- BEGIN COMMON.SH BOILERPLATE --- |
8 # The path to common.sh should be relative to your script's location. | 8 # Load common CrOS utilities. Inside the chroot this file is installed in |
9 . "$(dirname "$0")/common.sh" | 9 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 10 # location. |
| 11 find_common_sh() { |
| 12 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 13 local path |
| 14 |
| 15 SCRIPT_ROOT= |
| 16 for path in "${common_paths[@]}"; do |
| 17 if [ -r "${path}/common.sh" ]; then |
| 18 SCRIPT_ROOT=${path} |
| 19 break |
| 20 fi |
| 21 done |
| 22 } |
| 23 |
| 24 find_common_sh |
| 25 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 26 # --- END COMMON.SH BOILERPLATE --- |
10 | 27 |
11 # Load functions and constants for chromeos-install | 28 # Load functions and constants for chromeos-install |
12 . "$(dirname "$0")/chromeos-common.sh" | 29 [ -f /usr/lib/installer/chromeos-common.sh ] && \ |
| 30 INSTALLER_ROOT=/usr/lib/installer || \ |
| 31 INSTALLER_ROOT=$(dirname "$(readlink -f "$0")") |
| 32 |
| 33 . "${INSTALLER_ROOT}/chromeos-common.sh" || \ |
| 34 die "Unable to load chromeos-common.sh" |
13 | 35 |
14 # Script must be run inside the chroot. | 36 # Script must be run inside the chroot. |
15 restart_in_chroot_if_needed $* | 37 restart_in_chroot_if_needed "$@" |
16 | 38 |
17 get_default_board | 39 get_default_board |
18 | 40 |
19 # Flags. | 41 # Flags. |
20 DEFINE_string arch "" \ | 42 DEFINE_string arch "" \ |
21 "The target architecture (\"arm\" or \"x86\")." | 43 "The target architecture (\"arm\" or \"x86\")." |
22 DEFINE_string board "$DEFAULT_BOARD" \ | 44 DEFINE_string board "$DEFAULT_BOARD" \ |
23 "The board to build an image for." | 45 "The board to build an image for." |
24 DEFINE_integer rootfs_partition_size 1024 \ | 46 DEFINE_integer rootfs_partition_size 1024 \ |
25 "rootfs parition size in MBs." | 47 "rootfs parition size in MBs." |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 $sudo dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 \ | 165 $sudo dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 \ |
144 seek=${START_ROOTFS_A} | 166 seek=${START_ROOTFS_A} |
145 | 167 |
146 echo "Copying EFI system partition..." | 168 echo "Copying EFI system partition..." |
147 $sudo dd if=${ESP_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ESP} | 169 $sudo dd if=${ESP_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ESP} |
148 | 170 |
149 # Clean up temporary files. | 171 # Clean up temporary files. |
150 if [[ -n "${MBR_IMG:-}" ]]; then | 172 if [[ -n "${MBR_IMG:-}" ]]; then |
151 rm "${MBR_IMG}" | 173 rm "${MBR_IMG}" |
152 fi | 174 fi |
OLD | NEW |