Remove code using device mapper.
authorIvo De Decker <ivodd@debian.org>
Sun, 30 Apr 2017 12:46:24 +0000 (14:46 +0200)
committerIvo De Decker <ivodd@debian.org>
Sun, 30 Apr 2017 13:24:11 +0000 (15:24 +0200)
(Closes: #860833, #853927, #853163)

This code doesn't work in d-i and it has some issues outside d-i. All
architectures can use the grub-mount codepath, which was already the
default anyway.

This also removes the dependency on dmsetup.

Signed-off-by: Ivo De Decker <ivodd@debian.org>
common.sh
debian/changelog
debian/control
linux-boot-probes/common/50mounted-tests
os-probes/common/50mounted-tests

index a57e2a4..e1646d4 100644 (file)
--- a/common.sh
+++ b/common.sh
@@ -204,37 +204,14 @@ find_uuid () {
        fi
 }
 
-do_dmsetup () {
-       local prefix partition dm_device partition_name size_p
-       prefix="$1"
-       partition="$2"
-       dm_device=
-
-       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 "creating device mapper device $dm_device"
-                       echo "0 $size_p linear $partition 0" | dmsetup create -r $partition_name
-               fi
-       fi
-       echo "$dm_device"
-}
-
-# Sets $mountboot and $dm_device as output variables.  This is very messy,
-# but POSIX shell isn't really up to the task of doing it more cleanly.
+# Sets $mountboot as output variables.  This is very messy, but POSIX shell
+# isn't really up to the task of doing it more cleanly.
 linux_mount_boot () {
        partition="$1"
        tmpmnt="$2"
 
        bootpart=""
        mounted=""
-       dm_device=""
        if [ -e "$tmpmnt/etc/fstab" ]; then
                # Try to mount any /boot partition.
                bootmnt=$(parsefstab < "$tmpmnt/etc/fstab" | grep " /boot ") || true
@@ -305,13 +282,6 @@ linux_mount_boot () {
                                        if type grub-mount >/dev/null 2>&1 && \
                                           grub-mount "$boottomnt" "$tmpmnt/boot" 2>/dev/null; then
                                                mounted=1
-                                       elif dm_device="$(do_dmsetup osprober-linux "$boottomnt")" && [ "$dm_device" ]; then
-                                               if mountinfo=`mount -o ro "$dm_device" "$tmpmnt/boot" -t "$3"`; then
-                                                       debug "mounted as $3 filesystem"
-                                                       mounted=1
-                                               else
-                                                       error "failed to mount $dm_device on $tmpmnt/boot: $mountinfo"
-                                               fi
                                        fi
                                fi
                        fi
index d05f5eb..8018559 100644 (file)
@@ -1,3 +1,13 @@
+os-prober (1.75) UNRELEASED; urgency=medium
+
+  * Remove code using device mapper (Closes: #860833, #853927, #853163).
+    This code doesn't work in d-i and it has some issues outside d-i. All
+    architectures can use the grub-mount codepath, which was already the
+    default anyway.
+    This also removes the dependency on dmsetup.
+
+ -- Ivo De Decker <ivodd@debian.org>  Sun, 30 Apr 2017 14:38:59 +0200
+
 os-prober (1.74) unstable; urgency=high
 
   [ Ivo De Decker ]
index 264c6ca..d3b228b 100644 (file)
@@ -11,7 +11,7 @@ Vcs-Git: https://anonscm.debian.org/git/d-i/os-prober.git
 Package: os-prober-udeb
 Package-Type: udeb
 Architecture: any
-Depends: ${misc:Depends}, ${shlibs:Depends}, di-utils-mapdevfs, anna (>= 1.16), grub-mount-udeb [linux-any kfreebsd-any], dmsetup-udeb [linux-any]
+Depends: ${misc:Depends}, ${shlibs:Depends}, di-utils-mapdevfs, anna (>= 1.16), grub-mount-udeb [linux-any kfreebsd-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
@@ -22,7 +22,7 @@ Package: os-prober
 Architecture: any
 Section: utils
 Priority: extra
-Depends: ${shlibs:Depends}, ${misc:Depends}, grub-common [linux-any kfreebsd-any], dmsetup [linux-any]
+Depends: ${shlibs:Depends}, ${misc:Depends}, grub-common [linux-any kfreebsd-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.
index 01bca81..ad68874 100755 (executable)
@@ -10,12 +10,6 @@ do_unmount() {
                        warn "failed to umount $tmpmnt"
                fi
        fi
-       for dm_device in $dm_devices; do
-               if [ -e "$dm_device" ]; then
-                       debug "remove device mapper device $dm_device"
-                       dmsetup remove $dm_device
-               fi
-       done
        rmdir "$tmpmnt" || true
 }
 
@@ -54,34 +48,18 @@ if [ ! -d "$tmpmnt" ]; then
 fi
 
 mounted=
-dm_devices=
 if type grub-mount >/dev/null 2>&1 && \
    type grub-probe >/dev/null 2>&1 && \
    grub-mount "$partition" "$tmpmnt" 2>/dev/null; then
        mounted=1
        type="$(grub-probe -d "$partition" -t fs)"
        [ "$type" ] || type=fuseblk
-elif dm_device="$(do_dmsetup osprober-linux "$partition")" && \
-     [ "$dm_device" ]; then
-       dm_devices="$dm_device"
-       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
 
 if [ "$mounted" ]; then
        linux_mount_boot "$partition" "$tmpmnt"
        bootpart="${mountboot%% *}"
        mounted="${mountboot#* }"
-       if [ "$dm_device" ]; then
-               dm_devices="$dm_device $dm_devices"
-       fi
 
        for test in /usr/lib/linux-boot-probes/mounted/*; do
                if [ -f "$test" ] && [ -x "$test" ]; then
index 2951ef9..fca15cb 100755 (executable)
@@ -11,11 +11,6 @@ do_unmount() {
                        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
 }
 
@@ -74,17 +69,6 @@ if type grub-mount >/dev/null 2>&1 && \
                debug "mounted using GRUB, but unknown filesystem?"
                type=fuseblk
        fi
-elif dm_device="$(do_dmsetup osprober "$partition")" && \
-     [ "$dm_device" ]; then
-       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
 
 if [ "$mounted" ]; then