}
cleanup_tmpdir=false
-cleanup_ro_partitions=
cleanup () {
- local partition
- for partition in $cleanup_ro_partitions; do
- blockdev --setrw "$partition"
- debug "partition $partition set to read-write"
- done
if $cleanup_tmpdir; then
rm -rf "$OS_PROBER_TMP"
fi
sed 's/\\011/ /g; s/\\012/\n/g; s/\\040/ /g; s/\\134/\\/g'
}
-ro_partition () {
- if type blockdev >/dev/null 2>&1 && \
- [ "$(blockdev --getro "$1")" = 0 ] && \
- blockdev --setro "$1"; then
- debug "partition $1 set to read-only"
- cleanup_ro_partitions="${cleanup_ro_partitions:+$cleanup_ro_partitions }$1"
- trap cleanup EXIT HUP INT QUIT TERM
- else
- warn "setting partition $1 to read-only failed"
- fi
-}
-
find_label () {
local output
if type blkid >/dev/null 2>&1; then
else
error "failed to mount $dm_device on $tmpmnt/boot: $mountinfo"
fi
- else
- ro_partition "$boottomnt"
- if mount -o ro "$boottomnt" "$tmpmnt/boot" -t "$3"; then
- mounted=1
- else
- error "failed to mount $boottomnt on $tmpmnt/boot"
- fi
fi
fi
fi
underlying device to read-only (thanks, Ivo De Decker; closes: #701814).
Note that this introduces a dependency on dmsetup on Linux
architectures.
+ * Remove the "blockdev --setro" code path entirely, since the read-only
+ device-mapper arrangement supersedes it and should be safer (closes:
+ #648208).
-- Colin Watson <cjwatson@debian.org> Sat, 31 Dec 2016 17:11:49 +0000
debug "mounting $dm_device ($partition) as $type failed: $mountinfo"
fi
done
-else
- ro_partition "$partition"
- for type in $types; do
- if mountinfo=`mount -o ro -t "$type" "$partition" "$tmpmnt" 2>&1`; then
- debug "mounted as $type filesystem"
- mounted=1
- break
- else
- debug "mounting $partition as $type failed: $mountinfo"
- fi
- done
fi
if [ "$mounted" ]; then
debug "mounting $dm_device ($partition) as $type failed: $mountinfo"
fi
done
-else
- ro_partition "$partition"
- for type in $types $delaytypes; do
- if mountinfo=`mount -o ro -t "$type" "$partition" "$tmpmnt" 2>&1`; then
- debug "mounted as $type filesystem"
- mounted=1
- break
- else
- debug "mounting $partition as $type failed: $mountinfo"
- fi
- done
fi
if [ "$mounted" ]; then