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 . "$(dirname "$0")/common.sh" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 # Common unmounts for either a device or directory | 38 # Common unmounts for either a device or directory |
39 function unmount_image() { | 39 function unmount_image() { |
40 echo "Unmounting image from ${FLAGS_stateful_mountpt}" \ | 40 echo "Unmounting image from ${FLAGS_stateful_mountpt}" \ |
41 "and ${FLAGS_rootfs_mountpt}" | 41 "and ${FLAGS_rootfs_mountpt}" |
42 # Don't die on error to force cleanup | 42 # Don't die on error to force cleanup |
43 set +e | 43 set +e |
44 # Reset symlinks in /usr/local. | 44 # Reset symlinks in /usr/local. |
45 setup_symlinks_on_root "/usr/local" "/var" \ | 45 setup_symlinks_on_root "/usr/local" "/var" \ |
46 "${FLAGS_stateful_mountpt}" | 46 "${FLAGS_stateful_mountpt}" |
| 47 fix_broken_symlinks "${FLAGS_rootfs_mountpt}" |
47 sudo umount "${FLAGS_rootfs_mountpt}/usr/local" | 48 sudo umount "${FLAGS_rootfs_mountpt}/usr/local" |
48 sudo umount "${FLAGS_rootfs_mountpt}/var" | 49 sudo umount "${FLAGS_rootfs_mountpt}/var" |
49 sudo umount -d "${FLAGS_stateful_mountpt}" | 50 sudo umount -d "${FLAGS_stateful_mountpt}" |
50 sudo umount -d "${FLAGS_rootfs_mountpt}" | 51 sudo umount -d "${FLAGS_rootfs_mountpt}" |
51 set -e | 52 set -e |
52 } | 53 } |
53 | 54 |
54 function get_usb_partitions() { | 55 function get_usb_partitions() { |
55 sudo mount "${FLAGS_from}3" "${FLAGS_rootfs_mountpt}" | 56 sudo mount "${FLAGS_from}3" "${FLAGS_rootfs_mountpt}" |
56 sudo mount "${FLAGS_from}1" "${FLAGS_stateful_mountpt}" | 57 sudo mount "${FLAGS_from}1" "${FLAGS_stateful_mountpt}" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 103 |
103 # Turn path into an absolute path. | 104 # Turn path into an absolute path. |
104 FLAGS_from=`eval readlink -f ${FLAGS_from}` | 105 FLAGS_from=`eval readlink -f ${FLAGS_from}` |
105 | 106 |
106 # Perform desired operation. | 107 # Perform desired operation. |
107 if [ ${FLAGS_unmount} -eq ${FLAGS_TRUE} ] ; then | 108 if [ ${FLAGS_unmount} -eq ${FLAGS_TRUE} ] ; then |
108 unmount_image | 109 unmount_image |
109 else | 110 else |
110 mount_image | 111 mount_image |
111 fi | 112 fi |
OLD | NEW |