| 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 29 matching lines...) Expand all Loading... |
| 40 # Die on error | 40 # Die on error |
| 41 set -e | 41 set -e |
| 42 | 42 |
| 43 # Common unmounts for either a device or directory | 43 # Common unmounts for either a device or directory |
| 44 function unmount_image() { | 44 function unmount_image() { |
| 45 echo "Unmounting image from ${FLAGS_stateful_mountpt}" \ | 45 echo "Unmounting image from ${FLAGS_stateful_mountpt}" \ |
| 46 "and ${FLAGS_rootfs_mountpt}" | 46 "and ${FLAGS_rootfs_mountpt}" |
| 47 # Don't die on error to force cleanup | 47 # Don't die on error to force cleanup |
| 48 set +e | 48 set +e |
| 49 # Reset symlinks in /usr/local. | 49 # Reset symlinks in /usr/local. |
| 50 if mount | egrep ".* ${FLAGS_rootfs_mountpt} .*\(rw,"; then | 50 if mount | egrep ".* ${FLAGS_stateful_mountpt} .*\(rw,"; then |
| 51 setup_symlinks_on_root "/usr/local" "/var" \ | 51 setup_symlinks_on_root "/usr/local" "/var" \ |
| 52 "${FLAGS_stateful_mountpt}" | 52 "${FLAGS_stateful_mountpt}" |
| 53 fix_broken_symlinks "${FLAGS_rootfs_mountpt}" | 53 fix_broken_symlinks "${FLAGS_rootfs_mountpt}" |
| 54 fi | 54 fi |
| 55 sudo umount "${FLAGS_rootfs_mountpt}/usr/local" | 55 sudo umount "${FLAGS_rootfs_mountpt}/usr/local" |
| 56 sudo umount "${FLAGS_rootfs_mountpt}/var" | 56 sudo umount "${FLAGS_rootfs_mountpt}/var" |
| 57 if [[ -n "${FLAGS_esp_mountpt}" ]]; then | 57 if [[ -n "${FLAGS_esp_mountpt}" ]]; then |
| 58 sudo umount -d "${FLAGS_esp_mountpt}" | 58 sudo umount -d "${FLAGS_esp_mountpt}" |
| 59 fi | 59 fi |
| 60 sudo umount -d "${FLAGS_stateful_mountpt}" | 60 sudo umount -d "${FLAGS_stateful_mountpt}" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 # Turn path into an absolute path. | 142 # Turn path into an absolute path. |
| 143 FLAGS_from=`eval readlink -f ${FLAGS_from}` | 143 FLAGS_from=`eval readlink -f ${FLAGS_from}` |
| 144 | 144 |
| 145 # Perform desired operation. | 145 # Perform desired operation. |
| 146 if [ ${FLAGS_unmount} -eq ${FLAGS_TRUE} ] ; then | 146 if [ ${FLAGS_unmount} -eq ${FLAGS_TRUE} ] ; then |
| 147 unmount_image | 147 unmount_image |
| 148 else | 148 else |
| 149 mount_image | 149 mount_image |
| 150 fi | 150 fi |
| OLD | NEW |