| 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 # Utility methods used to resize a stateful partition and update the GPT table | 7 # Utility methods used to resize a stateful partition and update the GPT table |
| 8 | 8 |
| 9 # Source constants and utility functions | 9 # --- BEGIN COMMON.SH BOILERPLATE --- |
| 10 . "$(dirname "$0")/common.sh" | 10 # Load common CrOS utilities. Inside the chroot this file is installed in |
| 11 . "$(dirname "$0")/chromeos-common.sh" | 11 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 12 # location. |
| 13 find_common_sh() { |
| 14 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 15 local path |
| 16 |
| 17 SCRIPT_ROOT= |
| 18 for path in "${common_paths[@]}"; do |
| 19 if [ -r "${path}/common.sh" ]; then |
| 20 SCRIPT_ROOT=${path} |
| 21 break |
| 22 fi |
| 23 done |
| 24 } |
| 25 |
| 26 find_common_sh |
| 27 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 28 # --- END COMMON.SH BOILERPLATE --- |
| 29 |
| 30 # Need to be inside the chroot to load chromeos-common.sh |
| 31 assert_inside_chroot |
| 32 |
| 33 # Load functions and constants for chromeos-install |
| 34 . "/usr/lib/installer/chromeos-common.sh" || \ |
| 35 die "Unable to load /usr/lib/installer/chromeos-common.sh" |
| 12 | 36 |
| 13 locate_gpt | 37 locate_gpt |
| 14 | 38 |
| 15 umount_from_loop_dev() { | 39 umount_from_loop_dev() { |
| 16 local mnt_pt=$1 | 40 local mnt_pt=$1 |
| 17 mount | grep -q " on ${mnt_pt}" && sudo umount -d ${mnt_pt} | 41 mount | grep -q " on ${mnt_pt}" && sudo umount -d ${mnt_pt} |
| 18 rmdir ${mnt_pt} | 42 rmdir ${mnt_pt} |
| 19 } | 43 } |
| 20 | 44 |
| 21 cleanup_loop_dev() { | 45 cleanup_loop_dev() { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 # Copy the full kernel (i.e. with vboot sections) | 116 # Copy the full kernel (i.e. with vboot sections) |
| 93 dd if="${src_img}" of="${temp_img}" conv=notrunc bs=512 \ | 117 dd if="${src_img}" of="${temp_img}" conv=notrunc bs=512 \ |
| 94 seek="${START_KERN_A}" skip=${kern_a_offset} count=${kern_a_count} | 118 seek="${START_KERN_A}" skip=${kern_a_offset} count=${kern_a_count} |
| 95 dd if="${src_img}" of="${temp_img}" conv=notrunc bs=512 \ | 119 dd if="${src_img}" of="${temp_img}" conv=notrunc bs=512 \ |
| 96 seek="${START_KERN_B}" skip=${kern_b_offset} count=${kern_b_count} | 120 seek="${START_KERN_B}" skip=${kern_b_offset} count=${kern_b_count} |
| 97 dd if="${src_img}" of="${temp_img}" conv=notrunc bs=512 \ | 121 dd if="${src_img}" of="${temp_img}" conv=notrunc bs=512 \ |
| 98 seek="${START_OEM}" skip=${oem_offset} count=${oem_count} | 122 seek="${START_OEM}" skip=${oem_offset} count=${oem_count} |
| 99 dd if="${src_img}" of="${temp_img}" conv=notrunc bs=512 \ | 123 dd if="${src_img}" of="${temp_img}" conv=notrunc bs=512 \ |
| 100 seek="${START_ESP}" skip=${esp_offset} count=${esp_count} | 124 seek="${START_ESP}" skip=${esp_offset} count=${esp_count} |
| 101 } | 125 } |
| OLD | NEW |