2 . /usr/share/os-prober/common.sh
9 grep "^/dev/" /proc/mounts | parse_proc_mounts >"$OS_PROBER_TMP/mounted-map" || true
13 if [ -z "$partition" ]; then
14 echo "usage: linux-boot-prober partition" >&2
18 if ! mapped="$(mapdevfs "$partition")"; then
19 log "Device '$partition' does not exist; skipping"
23 if ! grep -q "^$mapped " "$OS_PROBER_TMP/mounted-map"; then
24 for test in /usr/lib/linux-boot-probes/*; do
26 if [ -x $test ] && [ -f $test ]; then
27 if $test "$partition"; then
28 debug "linux detected by $test"
34 mpoint=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 2)
35 mpoint="$(unescape_mount "$mpoint")"
36 if [ "$mpoint" != "/target/boot" ] && [ "$mpoint" != "/target" ] && [ "$mpoint" != "/" ]; then
37 type=$(grep "^$mapped " "$OS_PROBER_TMP/mounted-map" | head -n1 | cut -d " " -f 3)
38 if ! grep -q " $mpoint/boot " "$OS_PROBER_TMP/mounted-map"; then
39 linux_mount_boot "$partition" "$mpoint"
40 bootpart="${mountboot%% *}"
41 bootmounted="${mountboot#* }"
46 for test in /usr/lib/linux-boot-probes/mounted/*; do
47 if [ -f $test ] && [ -x $test ]; then
48 debug "running $test on mounted $partition"
49 if $test "$partition" "$bootpart" "$mpoint" "$type"; then
50 debug "$test succeeded"
55 if [ "$bootmounted" = 1 ]; then
56 if ! umount "$mpoint/boot"; then
57 warn "failed to umount $mpoint/boot"