mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-20 21:43:11 +00:00
mount-usb: replace fixed timeout with drive detection
Rather than wait a fixed 5s for the usb storage kernel modules to load, and the user to insert a drive, check for new USB drives inserted every 1s with a 5s timeout. Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
This commit is contained in:
parent
59b65d1069
commit
a2d50a10f7
@ -5,9 +5,16 @@
|
||||
enable_usb
|
||||
|
||||
if ! lsmod | grep -q usb_storage; then
|
||||
insmod /lib/modules/usb-storage.ko \
|
||||
count=$(ls /dev/sd* 2>/dev/null | wc -l)
|
||||
timeout=0
|
||||
echo "Scanning for USB storage devices..."
|
||||
insmod /lib/modules/usb-storage.ko >/dev/null 2>&1 \
|
||||
|| die "usb_storage: module load failed"
|
||||
sleep 5
|
||||
while [[ $count == $(ls /dev/sd* 2>/dev/null | wc -l) ]]; do
|
||||
[[ $timeout -ge 4 ]] && break
|
||||
sleep 1
|
||||
timeout=$(($timeout+1))
|
||||
done
|
||||
fi
|
||||
|
||||
if [ ! -d /media ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user