Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: mount_gpt_image.sh

Issue 3916002: cros_make_image_bootable, mount_gpt_image, common.sh: root filesystem changes: ext2, ro by default (Closed)
Patch Set: line len Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« common.sh ('K') | « common.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 sudo mount ${ro_flag} "${FLAGS_from}12" "${FLAGS_esp_mountpt}" 72 sudo mount ${ro_flag} "${FLAGS_from}12" "${FLAGS_esp_mountpt}"
73 fi 73 fi
74 } 74 }
75 75
76 function get_gpt_partitions() { 76 function get_gpt_partitions() {
77 local filename="${FLAGS_image}" 77 local filename="${FLAGS_image}"
78 78
79 # Mount the rootfs partition using a loopback device. 79 # Mount the rootfs partition using a loopback device.
80 local offset=$(partoffset "${FLAGS_from}/${filename}" 3) 80 local offset=$(partoffset "${FLAGS_from}/${filename}" 3)
81 local ro_flag="" 81 local ro_flag=""
82 [ ${FLAGS_read_only} -eq ${FLAGS_TRUE} ] && ro_flag="-o ro" 82 if [ ${FLAGS_read_only} -eq ${FLAGS_TRUE} ]; then
83 ro_flag="-o ro"
84 else
85 # Make sure any callers can actually mount and modify the fs
86 # if desired.
87 # cros_make_image_bootable should restore the bit if needed.
88 enable_rw_mount "${FLAGS_from}/${filename}" "$(( offset * 512 ))"
89 fi
83 90
84 sudo mount ${ro_flag} -o loop,offset=$(( offset * 512 )) \ 91 sudo mount ${ro_flag} -o loop,offset=$(( offset * 512 )) \
85 "${FLAGS_from}/${filename}" "${FLAGS_rootfs_mountpt}" 92 "${FLAGS_from}/${filename}" "${FLAGS_rootfs_mountpt}"
86 93
87 # Mount the stateful partition using a loopback device. 94 # Mount the stateful partition using a loopback device.
88 offset=$(partoffset "${FLAGS_from}/${filename}" 1) 95 offset=$(partoffset "${FLAGS_from}/${filename}" 1)
89 sudo mount ${ro_flag} -o loop,offset=$(( offset * 512 )) \ 96 sudo mount ${ro_flag} -o loop,offset=$(( offset * 512 )) \
90 "${FLAGS_from}/${filename}" "${FLAGS_stateful_mountpt}" 97 "${FLAGS_from}/${filename}" "${FLAGS_stateful_mountpt}"
91 98
92 # Mount the stateful partition using a loopback device. 99 # Mount the stateful partition using a loopback device.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 142
136 # Turn path into an absolute path. 143 # Turn path into an absolute path.
137 FLAGS_from=`eval readlink -f ${FLAGS_from}` 144 FLAGS_from=`eval readlink -f ${FLAGS_from}`
138 145
139 # Perform desired operation. 146 # Perform desired operation.
140 if [ ${FLAGS_unmount} -eq ${FLAGS_TRUE} ] ; then 147 if [ ${FLAGS_unmount} -eq ${FLAGS_TRUE} ] ; then
141 unmount_image 148 unmount_image
142 else 149 else
143 mount_image 150 mount_image
144 fi 151 fi
OLDNEW
« common.sh ('K') | « common.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698