mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 22:51:03 +02:00
build_image: handle diff mount output
Newer versions of util-linux's mount utility will not show: /dev/loop0 on /some/path type ext3 (mount,opts) Instead, it finds out the file backing /dev/loop0 and outputs: /some/file on /some/path type ext3 (mount,opts) This breaks the make_image_bootable helper that attempts to look up the loop device that mount_gpt_image.sh happened to pick. Let's scuttle the idea of parsing `mount` and move directly to what the kernel has to say via /proc/mounts. Hopefully the ABI there should be quite a bit more stable. BUG=None TEST=build_image works with mount from util-linux-2.16 TEST=build_image (before change) fails with mount from util-linux-2.19 TEST=build_image works with mount from util-linux-2.19 Change-Id: I66908800e82ff2e106face9d57773721e400dc2a Reviewed-on: https://gerrit.chromium.org/gerrit/11869 Commit-Ready: Mike Frysinger <vapier@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
parent
7af7cb595b
commit
a19cf6e2db
@ -175,8 +175,10 @@ make_image_bootable() {
|
||||
# The rootfs should never be mounted rw again after this point without
|
||||
# re-calling make_image_bootable.
|
||||
sudo mount -o remount,ro "${FLAGS_rootfs_mountpoint}"
|
||||
root_dev=$(mount | grep -- "on ${FLAGS_rootfs_mountpoint} type" |
|
||||
cut -f1 -d' ' | tail -1)
|
||||
# Newer `mount` will decode the filename backing the loop device,
|
||||
# so we need to dig deeper and find the answer ourselves.
|
||||
root_dev=$(awk -v mnt="${FLAGS_rootfs_mountpoint}" \
|
||||
'$2 == mnt { print $1 }' /proc/mounts)
|
||||
|
||||
# Make the filesystem un-mountable as read-write.
|
||||
# mount_gpt_image.sh will undo this as needed.
|
||||
|
Loading…
x
Reference in New Issue
Block a user