summaryrefslogtreecommitdiffstats
path: root/source/a/os-prober/os-prober.lvm2.diff
blob: 91f52725652e64e3e75bc18a115b975ec6700de7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
diff -ru os-prober-1.77/common.sh os-prober-1.77.new/common.sh
--- os-prober-1.77/common.sh	2018-08-10 21:23:18.000000000 +0200
+++ os-prober-1.77.new/common.sh	2019-08-03 23:37:48.466380378 +0200
@@ -176,6 +176,15 @@
 		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
+		cleanup_ro_partitions="${cleanup_ro_partitions:+$cleanup_ro_partitions }$1"
+		trap cleanup EXIT HUP INT QUIT TERM
+	fi
+}
+
 find_label () {
 	local output
 	if type blkid >/dev/null 2>&1; then
diff -ru os-prober-1.77/os-probes/common/50mounted-tests os-prober-1.77.new/os-probes/common/50mounted-tests
--- os-prober-1.77/os-probes/common/50mounted-tests	2018-08-10 21:23:18.000000000 +0200
+++ os-prober-1.77.new/os-probes/common/50mounted-tests	2019-08-03 23:37:48.465380372 +0200
@@ -69,6 +69,15 @@
 		debug "mounted using GRUB, but unknown filesystem?"
 		type=fuseblk
 	fi
+else
+	ro_partition "$partition"
+	for type in $types $delaytypes; do
+		if mount -o ro -t "$type" "$partition" "$tmpmnt" 2>/dev/null; then
+			debug "mounted as $type filesystem"
+			mounted=1
+			break
+		fi
+	done
 fi
 
 if [ "$mounted" ]; then