Prefer removable devices over non-removable devices, so check them first.
authorMichael Prokop <mika@grml.org>
Thu, 11 Mar 2010 09:19:05 +0000 (10:19 +0100)
committerMichael Prokop <mika@grml.org>
Thu, 11 Mar 2010 09:19:05 +0000 (10:19 +0100)
debian/changelog
debian/patches/00list
debian/patches/14_prefer_removable_devices.dpatch [new file with mode: 0755]

index 07e38af..af9199c 100644 (file)
@@ -1,3 +1,10 @@
+live-initramfs (1.173.3-1grml.02) unstable; urgency=low
+
+  * New patch to prefer removable devices over non-removable devices,
+    so scan them first.
+
+ -- Michael Prokop <mika@grml.org>  Thu, 11 Mar 2010 10:18:05 +0100
+
 live-initramfs (1.173.3-1grml.01) unstable; urgency=low
 
   * Synchronise with Debian's version 1.173.3-1.
index ebd9143..f754b0f 100644 (file)
@@ -6,3 +6,4 @@
 11_dhcphostname.patch
 12_uuid_support.dpatch
 13_always_display_warnings_and_failures.dpatch
+14_prefer_removable_devices.dpatch
diff --git a/debian/patches/14_prefer_removable_devices.dpatch b/debian/patches/14_prefer_removable_devices.dpatch
new file mode 100755 (executable)
index 0000000..568221c
--- /dev/null
@@ -0,0 +1,31 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 14_prefer_removable_devices.dpatch by Michael Prokop <mika@grml.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: prefer removable devices over non-removable devices, so scan them first
+
+@DPATCH@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' live-initramfs-grml~/scripts/live live-initramfs-grml/scripts/live
+--- live-initramfs-grml~/scripts/live  2010-03-11 09:21:56.059389954 +0100
++++ live-initramfs-grml/scripts/live   2010-03-11 10:17:05.482395328 +0100
+@@ -1669,8 +1669,20 @@
+       esac
+       # or do the scan of block devices
++      # prefer removable devices over non-removable devices, so scan them first
+       for sysblock in $(echo /sys/block/* | tr ' ' '\n' | grep -vE "/(loop|ram|dm-|fd)")
+       do
++              if [ "$(cat ${sysblock}/removable)" = "1" ]
++              then
++                      removable_devices_to_scan="$removable_devices_to_scan $sysblock"
++              else
++                      nonremovable_devices_to_scan="$nonremovable_devices_to_scan $sysblock"
++              fi
++      done
++      devices_to_scan="$removable_devices_to_scan $nonremovable_devices_to_scan"
++
++      for sysblock in $devices_to_scan
++      do
+               devname=$(sys2dev "${sysblock}")
+               fstype=$(get_fstype "${devname}")