From d7b4313b0835d6e14cf934ec81c0e3d8f0940552 Mon Sep 17 00:00:00 2001 From: "Hellekin O. Wolf =8)" Date: Fri, 11 Feb 2011 03:56:09 +0100 Subject: [PATCH] Fix opening when device identification is^Hwas too slow --- src/tomb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/tomb b/src/tomb index c591ef0..60e6018 100755 --- a/src/tomb +++ b/src/tomb @@ -104,7 +104,19 @@ ask_usbkey() { echo -n " . usb attached, opening " # get the first partition - usbpart=`dmesg |tail -n 12 | grep ' sd.:' |cut -d: -f2 |tr -d ' '` +# usbpart=`dmesg |tail -n 12 | grep ' sd.:' |cut -d: -f2 |tr -d ' '` + for i in $(seq 1 10); do + usbpart=$(dmesg | tail -n 12 | sed '/ sd.:/!d;s/^.*: \(sd.[0-9]*\)/\1/') + if [ -n "$usbpart" ]; then + break + elif [ $i -eq 10 ]; then + error "timeout." + return 1 + else + echo -n . + sleep 1 + fi + done # # wait that is mounted (it automount is on) # c=0