Package: os-prober-udeb
Package-Type: udeb
Architecture: any
-Depends: ${misc:Depends}, ${shlibs:Depends}, di-utils-mapdevfs, anna (>= 1.16), grub-mount-udeb [i386 amd64 powerpc ppc64 ppc64el sparc mipsel kfreebsd-i386 kfreebsd-amd64]
+Depends: ${misc:Depends}, ${shlibs:Depends}, di-utils-mapdevfs, anna (>= 1.16), grub-mount-udeb [i386 amd64 powerpc ppc64 ppc64el sparc mipsel kfreebsd-i386 kfreebsd-amd64], dmsetup-udeb [linux-any]
Provides: os-prober
Description: utility to detect other OSes on a set of drives
This package is to be used by boot loader installers to detect other OSes
Architecture: any
Section: utils
Priority: extra
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}, dmsetup [linux-any]
Description: utility to detect other OSes on a set of drives
This package detects other OSes available on a system and outputs the
results in a generic machine-readable format.
warn "failed to umount $tmpmnt"
fi
fi
+ if [ -e "$dm_device" ]
+ then
+ debug "remove device mapper device $dm_device"
+ dmsetup remove $dm_device
+ fi
rmdir "$tmpmnt" || true
}
type="$(grub-probe -d "$partition" -t fs)"
[ "$type" ] || type=fuseblk
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
+ if type dmsetup >/dev/null 2>&1 && \
+ type blockdev >/dev/null 2>&1; then
+ partition_name="osprober-linux-${partition##*/}"
+ dm_device="/dev/mapper/$partition_name"
+ size_p=$(blockdev --getsize $partition )
+ if [ -e "$dm_device" ]; then
+ error "$dm_device already exists"
+ dm_device=
else
- debug "mounting $partition as $type failed: $mountinfo"
+ debug "creating device mapper device $dm_device"
+ echo "0 $size_p linear $partition 0" | dmsetup create -r $partition_name
+ for type in $types; do
+ if mountinfo=`mount -o ro -t "$type" "$dm_device" "$tmpmnt" 2>&1`; then
+ debug "mounted as $type filesystem"
+ mounted=1
+ break
+ else
+ debug "mounting $dm_device ($partition) as $type failed: $mountinfo"
+ fi
+ done
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
fi
if [ "$mounted" ]; then
warn "failed to umount $tmpmnt"
fi
fi
+ if [ -e "$dm_device" ]
+ then
+ debug "remove device mapper device $dm_device"
+ dmsetup remove $dm_device
+ fi
rmdir "$tmpmnt" || true
}
type=fuseblk
fi
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
+ if type dmsetup >/dev/null 2>&1 && \
+ type blockdev >/dev/null 2>&1; then
+ partition_name="osprober-${partition##*/}"
+ dm_device="/dev/mapper/$partition_name"
+ size_p=$(blockdev --getsize $partition )
+ if [ -e "$dm_device" ]; then
+ error "$dm_device already exists"
+ dm_device=
else
- debug "mounting $partition as $type failed: $mountinfo"
+ debug "creating device mapper device $dm_device"
+ echo "0 $size_p linear $partition 0" | dmsetup create -r $partition_name
+ for type in $types $delaytypes; do
+ if mountinfo=`mount -o ro -t "$type" "$dm_device" "$tmpmnt" 2>&1`; then
+ debug "mounted as $type filesystem"
+ mounted=1
+ break
+ else
+ debug "mounting $dm_device ($partition) as $type failed: $mountinfo"
+ fi
+ done
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
fi
if [ "$mounted" ]; then