mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-26 04:51:34 +01:00
fix(mount_gpt_image): fixup mount options
mount was getting upset about the additional -o flag. Fix it up so that ro gets appended to the other mount options.
This commit is contained in:
parent
a6df1edaea
commit
75fff35514
@ -120,12 +120,12 @@ get_gpt_partitions() {
|
|||||||
local safe_flag=""
|
local safe_flag=""
|
||||||
|
|
||||||
if [ ${FLAGS_read_only} -eq ${FLAGS_TRUE} ]; then
|
if [ ${FLAGS_read_only} -eq ${FLAGS_TRUE} ]; then
|
||||||
ro_flag="-o ro"
|
ro_flag=",ro"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${FLAGS_read_only} -eq ${FLAGS_TRUE} -o \
|
if [ ${FLAGS_read_only} -eq ${FLAGS_TRUE} -o \
|
||||||
${FLAGS_safe} -eq ${FLAGS_TRUE} ]; then
|
${FLAGS_safe} -eq ${FLAGS_TRUE} ]; then
|
||||||
safe_flag="-o ro -t ext2"
|
safe_flag=",ro"
|
||||||
else
|
else
|
||||||
# Make sure any callers can actually mount and modify the fs
|
# Make sure any callers can actually mount and modify the fs
|
||||||
# if desired.
|
# if desired.
|
||||||
@ -133,7 +133,7 @@ get_gpt_partitions() {
|
|||||||
enable_rw_mount "${FLAGS_from}/${filename}" "$(( offset * 512 ))"
|
enable_rw_mount "${FLAGS_from}/${filename}" "$(( offset * 512 ))"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! sudo mount ${safe_flag} -o loop,offset=$(( offset * 512 )) \
|
if ! sudo mount -o loop,offset=$(( offset * 512 ))${safe_flag} \
|
||||||
"${FLAGS_from}/${filename}" "${FLAGS_rootfs_mountpt}" ; then
|
"${FLAGS_from}/${filename}" "${FLAGS_rootfs_mountpt}" ; then
|
||||||
error "mount failed: options=${safe_flag} offset=$(( offset * 512 ))" \
|
error "mount failed: options=${safe_flag} offset=$(( offset * 512 ))" \
|
||||||
"target=${FLAGS_rootfs_mountpt}"
|
"target=${FLAGS_rootfs_mountpt}"
|
||||||
@ -142,7 +142,7 @@ get_gpt_partitions() {
|
|||||||
|
|
||||||
# Mount the stateful partition using a loopback device.
|
# Mount the stateful partition using a loopback device.
|
||||||
offset=$(partoffset "${FLAGS_from}/${filename}" ${NUM_STATEFUL})
|
offset=$(partoffset "${FLAGS_from}/${filename}" ${NUM_STATEFUL})
|
||||||
if ! sudo mount ${ro_flag} -o loop,offset=$(( offset * 512 )) \
|
if ! sudo mount -o loop,offset=$(( offset * 512 ))${ro_flag} \
|
||||||
"${FLAGS_from}/${filename}" "${FLAGS_stateful_mountpt}" ; then
|
"${FLAGS_from}/${filename}" "${FLAGS_stateful_mountpt}" ; then
|
||||||
error "mount failed: options=${ro_flag} offset=$(( offset * 512 ))" \
|
error "mount failed: options=${ro_flag} offset=$(( offset * 512 ))" \
|
||||||
"target=${FLAGS_stateful_mountpt}"
|
"target=${FLAGS_stateful_mountpt}"
|
||||||
@ -152,7 +152,7 @@ get_gpt_partitions() {
|
|||||||
# Mount the esp partition using a loopback device.
|
# Mount the esp partition using a loopback device.
|
||||||
if [[ -n "${FLAGS_esp_mountpt}" ]]; then
|
if [[ -n "${FLAGS_esp_mountpt}" ]]; then
|
||||||
offset=$(partoffset "${FLAGS_from}/${filename}" ${NUM_ESP})
|
offset=$(partoffset "${FLAGS_from}/${filename}" ${NUM_ESP})
|
||||||
if ! sudo mount ${ro_flag} -o loop,offset=$(( offset * 512 )) \
|
if ! sudo mount -o loop,offset=$(( offset * 512 ))${ro_flag} \
|
||||||
"${FLAGS_from}/${filename}" "${FLAGS_esp_mountpt}" ; then
|
"${FLAGS_from}/${filename}" "${FLAGS_esp_mountpt}" ; then
|
||||||
error "mount failed: options=${ro_flag} offset=$(( offset * 512 ))" \
|
error "mount failed: options=${ro_flag} offset=$(( offset * 512 ))" \
|
||||||
"target=${FLAGS_esp_mountpt}"
|
"target=${FLAGS_esp_mountpt}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user