From 5cfd2af2c4393c4d8f30202d3a7693a28c55bff4 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 11 Mar 2010 10:19:05 +0100 Subject: [PATCH] Prefer removable devices over non-removable devices, so check them first. --- debian/changelog | 7 +++++ debian/patches/00list | 1 + debian/patches/14_prefer_removable_devices.dpatch | 31 +++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100755 debian/patches/14_prefer_removable_devices.dpatch diff --git a/debian/changelog b/debian/changelog index 07e38af..af9199c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 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. diff --git a/debian/patches/00list b/debian/patches/00list index ebd9143..f754b0f 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -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 index 0000000..568221c --- /dev/null +++ b/debian/patches/14_prefer_removable_devices.dpatch @@ -0,0 +1,31 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 14_prefer_removable_devices.dpatch by Michael Prokop +## +## 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}") + -- 2.1.4