Package: live-boot Severity: wishlist Tags: patch If a preferred medium (device or medium type) is given with the live-media parameter then waiting for the timeout to expire before scaning for these devices is not necessary. Just pick the device as soon as it appears. If a criterium would match several devices the outcome is undefined anyway. So choosing the first one is good enough.
If no removable or removable-usb device is found after the timeout expires, just boot any live medium available instead of panicing. The second change makes it possible to have a non-wirteable (ISO) live-image with the default boot parameter set to live-media=removable-usb for machines that can't boot directly from USB devices. If a live medium on an USB device is present it'll be preferred, but the ISO will also boot without an USB device. The attached patch implements a solution to both of these issues. Gaudenz -- System Information: Debian Release: 7.0 APT prefers testing APT policy: (800, 'testing'), (700, 'unstable'), (50, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores) Locale: LANG=de_CH.UTF-8, LC_CTYPE=de_CH.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
>From 50de32e9d644b09225937c0968dd7fb0095ab1d1 Mon Sep 17 00:00:00 2001 From: Gaudenz Steinlin <gaud...@debian.org> Date: Thu, 17 Jan 2013 16:45:27 +0100 Subject: [PATCH] Immediately detect medium from live-media parameter If a preferred medium (device or medium type) is given with the live-media parameter then waiting for the timeout to expire before scaning for these devices is not necessary. Just pick the device as soon as it appears. If a criterium would match several devices the outcome is undefined anyway. So choosing the first one is good enough. If no removable or removable-usb device is found after the timeout expires, just boot any live medium available instead of panicing. --- scripts/boot/9990-misc-helpers.sh | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/scripts/boot/9990-misc-helpers.sh b/scripts/boot/9990-misc-helpers.sh index 888eeaf..1341972 100755 --- a/scripts/boot/9990-misc-helpers.sh +++ b/scripts/boot/9990-misc-helpers.sh @@ -259,16 +259,10 @@ find_livefs () { timeout="${1}" - # don't start autodetection before timeout has expired - if [ -n "${LIVE_MEDIA_TIMEOUT}" ] - then - if [ "${timeout}" -lt "${LIVE_MEDIA_TIMEOUT}" ] - then - return 1 - fi - fi - - # first look at the one specified in the command line + # first look at the one specified in the command line This is OK + # before the timeout has expired, if more than one device matches the + # criteria the outcome is undefined anyway, so we can pick the first + # one that appears. case "${LIVE_MEDIA}" in removable-usb) for sysblock in $(removable_usb_dev "sys") @@ -281,7 +275,6 @@ find_livefs () fi done done - return 1 ;; removable) @@ -295,7 +288,6 @@ find_livefs () fi done done - return 1 ;; *) @@ -309,7 +301,16 @@ find_livefs () ;; esac - # or do the scan of block devices + # don't start autodetection before timeout has expired + if [ -n "${LIVE_MEDIA_TIMEOUT}" ] + then + if [ "${timeout}" -lt "${LIVE_MEDIA_TIMEOUT}" ] + then + return 1 + fi + fi + + # autodetection of live media # prefer removable devices over non-removable devices, so scan them first devices_to_scan="$(removable_dev 'sys') $(non_removable_dev 'sys')" -- 1.7.10.4