blob: 58e592ae7e8e8a3c57772d6a54823d132e97a9ba (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
diff --git a/common.sh b/common.sh
index cc7a335..820caea 100644
--- a/common.sh
+++ b/common.sh
@@ -326,3 +326,26 @@ umount() {
fi
}
+list_mounts() {
+ if [ -f /proc/self/mountinfo ]; then
+ local x dev mount devs found mountinfo_placeholders
+ found=:
+
+ # mountinfo may have 10 or 11 fields depending on mount namespaces
+ if [ $(head -n1 /proc/self/mountinfo | wc -w) -eq 10 ]; then
+ mountinfo_placeholders="x x"
+ else
+ mountinfo_placeholders="x x x"
+ fi
+
+ while read -r x x dev x mount ${mountinfo_placeholders} fs x; do
+ if [ -L "/sys/dev/block/$dev" ]; then
+ devs="/dev/`readlink \"/sys/dev/block/$dev\" | rev | cut -d/ -f1 | rev`"
+ printf '%s %s %s\n' "$(mapdevfs "$devs")" "$mount" "$fs"
+ found="return 0"
+ fi
+ done < /proc/self/mountinfo
+ $found
+ fi
+ grep "^/dev/" /proc/mounts | parse_proc_mounts
+}
diff --git a/linux-boot-prober b/linux-boot-prober
index bacf219..804d9fe 100755
--- a/linux-boot-prober
+++ b/linux-boot-prober
@@ -17,7 +17,7 @@ bootmnt=
bootsv=
bootuuid=
-grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
+list_mounts >"$OS_PROBER_TMP/mounted-map" || true
if [ -z "$1" ]; then
ERR=y
diff --git a/os-prober b/os-prober
index b76d85b..8b0c89b 100755
--- a/os-prober
+++ b/os-prober
@@ -128,7 +128,7 @@ done
# We need to properly canonicalize partitions with mount points and partitions
# used in RAID
-grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
+list_mounts >"$OS_PROBER_TMP/mounted-map" || true
: >"$OS_PROBER_TMP/swaps-map"
if [ -f /proc/swaps ]; then
grep "^/dev/" /proc/swaps | parse_proc_swaps >"$OS_PROBER_TMP/swaps-map" || true
|