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 # Script which ensures that a given image has an up-to-date | 7 # Script which ensures that a given image has an up-to-date |
8 # kernel partition, rootfs integrity hashes, and legacy bootloader configs. | 8 # kernel partition, rootfs integrity hashes, and legacy bootloader configs. |
9 | 9 |
10 # Load common constants. This should be the first executable line. | 10 # Load common constants. This should be the first executable line. |
11 # The path to common.sh should be relative to your script's location. | 11 # The path to common.sh should be relative to your script's location. |
12 COMMON_PATH="$(dirname "$0")/../common.sh" | 12 COMMON_PATH="$(dirname "$0")/../common.sh" |
13 if [ ! -r "${COMMON_PATH}" ]; then | 13 if [ ! -r "${COMMON_PATH}" ]; then |
14 echo "ERROR! Cannot find common.sh: ${COMMON_PATH}" 1>&2 | 14 echo "ERROR! Cannot find common.sh: ${COMMON_PATH}" 1>&2 |
15 exit 1 | 15 exit 1 |
16 fi | 16 fi |
| 17 |
17 . "$(dirname "$0")/../common.sh" | 18 . "$(dirname "$0")/../common.sh" |
18 | 19 |
| 20 # Script must be run inside the chroot. |
| 21 assert_inside_chroot |
| 22 |
19 set -e | 23 set -e |
20 . "$(dirname "$0")/../chromeos-common.sh" # for partoffset and partsize | 24 . "$(dirname "$0")/../chromeos-common.sh" # for partoffset and partsize |
21 | 25 |
22 if [ $# -lt 2 ]; then | 26 if [ $# -lt 2 ]; then |
23 echo "Usage: ${0} /PATH/TO/IMAGE IMAGE.BIN [shflags overrides]" | 27 echo "Usage: ${0} /PATH/TO/IMAGE IMAGE.BIN [shflags overrides]" |
24 exit 1 | 28 exit 1 |
25 fi | 29 fi |
26 | 30 |
27 BOOT_DESC_FILE="${1}/boot.desc" | 31 BOOT_DESC_FILE="${1}/boot.desc" |
28 IMAGE="${1}/${2}" | 32 IMAGE="${1}/${2}" |
(...skipping 10 matching lines...) Expand all Loading... |
39 info "Boot-time configuration for $(dirname ${IMAGE}): " | 43 info "Boot-time configuration for $(dirname ${IMAGE}): " |
40 cat ${BOOT_DESC_FILE} | while read line; do | 44 cat ${BOOT_DESC_FILE} | while read line; do |
41 info " ${line}" | 45 info " ${line}" |
42 done | 46 done |
43 fi | 47 fi |
44 | 48 |
45 if [ ! -r "${IMAGE}" ]; then | 49 if [ ! -r "${IMAGE}" ]; then |
46 die "${IMAGE} cannot be read!" | 50 die "${IMAGE} cannot be read!" |
47 fi | 51 fi |
48 | 52 |
49 # Script must be run inside the chroot. | |
50 restart_in_chroot_if_needed $* | |
51 | 53 |
52 locate_gpt | 54 locate_gpt |
53 set +e | 55 set +e |
54 | 56 |
55 # Now parse the build settings from ${OUTPUT_DIR}/boot.desc | 57 # Now parse the build settings from ${OUTPUT_DIR}/boot.desc |
56 | 58 |
57 DEFINE_string output_dir "/tmp" \ | 59 DEFINE_string output_dir "/tmp" \ |
58 "Directory to place output in." | 60 "Directory to place output in." |
59 DEFINE_string image "chromiumos_base.img" \ | 61 DEFINE_string image "chromiumos_base.img" \ |
60 "Full path to the chromiumos image to make bootable." | 62 "Full path to the chromiumos image to make bootable." |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 mkdir -p ${FLAGS_statefulfs_mountpoint} | 253 mkdir -p ${FLAGS_statefulfs_mountpoint} |
252 mkdir -p ${FLAGS_espfs_mountpoint} | 254 mkdir -p ${FLAGS_espfs_mountpoint} |
253 | 255 |
254 make_image_bootable ${IMAGE} | 256 make_image_bootable ${IMAGE} |
255 | 257 |
256 if [ ${FLAGS_cleanup_dirs} -eq ${FLAGS_TRUE} ]; then | 258 if [ ${FLAGS_cleanup_dirs} -eq ${FLAGS_TRUE} ]; then |
257 rmdir ${FLAGS_rootfs_mountpoint} | 259 rmdir ${FLAGS_rootfs_mountpoint} |
258 rmdir ${FLAGS_statefulfs_mountpoint} | 260 rmdir ${FLAGS_statefulfs_mountpoint} |
259 rmdir ${FLAGS_espfs_mountpoint} | 261 rmdir ${FLAGS_espfs_mountpoint} |
260 fi | 262 fi |
OLD | NEW |