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 # Helper script that mounts chromium os image from a device or directory | 7 # Helper script that mounts chromium os image from a device or directory |
8 # and creates mount points for /var and /usr/local (if in dev_mode). | 8 # and creates mount points for /var and /usr/local (if in dev_mode). |
9 | 9 |
10 . "$(dirname "$0")/common.sh" | 10 # --- BEGIN COMMON.SH BOILERPLATE --- |
| 11 # Load common CrOS utilities. Inside the chroot this file is installed in |
| 12 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 13 # location. |
| 14 find_common_sh() { |
| 15 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 16 local path |
11 | 17 |
12 # For functions related to gpt images. | 18 SCRIPT_ROOT= |
13 . "$(dirname "$0")/chromeos-common.sh" | 19 for path in "${common_paths[@]}"; do |
| 20 if [ -r "${path}/common.sh" ]; then |
| 21 SCRIPT_ROOT=${path} |
| 22 break |
| 23 fi |
| 24 done |
| 25 } |
| 26 |
| 27 find_common_sh |
| 28 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 29 # --- END COMMON.SH BOILERPLATE --- |
| 30 |
| 31 # Need to be inside the chroot to load chromeos-common.sh |
| 32 assert_inside_chroot |
| 33 |
| 34 # Load functions and constants for chromeos-install |
| 35 . "/usr/lib/installer/chromeos-common.sh" || \ |
| 36 die "Unable to load /usr/lib/installer/chromeos-common.sh" |
| 37 |
14 locate_gpt | 38 locate_gpt |
15 | 39 |
16 get_default_board | 40 get_default_board |
17 | 41 |
18 # Flags. | 42 # Flags. |
19 DEFINE_string board "$DEFAULT_BOARD" \ | 43 DEFINE_string board "$DEFAULT_BOARD" \ |
20 "The board for which the image was built." b | 44 "The board for which the image was built." b |
21 DEFINE_boolean read_only $FLAGS_FALSE \ | 45 DEFINE_boolean read_only $FLAGS_FALSE \ |
22 "Mount in read only mode -- skips stateful items." | 46 "Mount in read only mode -- skips stateful items." |
23 DEFINE_boolean safe $FLAGS_FALSE \ | 47 DEFINE_boolean safe $FLAGS_FALSE \ |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 FLAGS_from=`eval readlink -f ${FLAGS_from}` | 179 FLAGS_from=`eval readlink -f ${FLAGS_from}` |
156 FLAGS_rootfs_mountpt=`eval readlink -f ${FLAGS_rootfs_mountpt}` | 180 FLAGS_rootfs_mountpt=`eval readlink -f ${FLAGS_rootfs_mountpt}` |
157 FLAGS_stateful_mountpt=`eval readlink -f ${FLAGS_stateful_mountpt}` | 181 FLAGS_stateful_mountpt=`eval readlink -f ${FLAGS_stateful_mountpt}` |
158 | 182 |
159 # Perform desired operation. | 183 # Perform desired operation. |
160 if [ ${FLAGS_unmount} -eq ${FLAGS_TRUE} ] ; then | 184 if [ ${FLAGS_unmount} -eq ${FLAGS_TRUE} ] ; then |
161 unmount_image | 185 unmount_image |
162 else | 186 else |
163 mount_image | 187 mount_image |
164 fi | 188 fi |
OLD | NEW |