mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-19 21:17:55 +00:00
Extract enable_usb_storage() from mount-usb
enable_usb_storage() inserts usb-storage.ko if not already loaded, then waits for USB storage devices to appear. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
This commit is contained in:
parent
b365f1324a
commit
606c29f0ec
@ -5,18 +5,7 @@
|
||||
TRACE "Under /bin/mount-usb"
|
||||
|
||||
enable_usb
|
||||
|
||||
if ! lsmod | grep -q usb_storage; then
|
||||
timeout=0
|
||||
echo "Scanning for USB storage devices..."
|
||||
insmod /lib/modules/usb-storage.ko >/dev/null 2>&1 \
|
||||
|| die "usb_storage: module load failed"
|
||||
while [[ $(list_usb_storage | wc -l) -eq 0 ]]; do
|
||||
[[ $timeout -ge 8 ]] && break
|
||||
sleep 1
|
||||
timeout=$(($timeout+1))
|
||||
done
|
||||
fi
|
||||
enable_usb_storage
|
||||
|
||||
if [ ! -d /media ]; then
|
||||
mkdir /media
|
||||
|
@ -81,6 +81,24 @@ confirm_totp()
|
||||
echo
|
||||
}
|
||||
|
||||
# Enable USB storage (if not already enabled), and wait for storage devices to
|
||||
# be detected. If USB storage was already enabled, no wait occurs, this would
|
||||
# have happened already when USB storage was enabled.
|
||||
enable_usb_storage()
|
||||
{
|
||||
if ! lsmod | grep -q usb_storage; then
|
||||
timeout=0
|
||||
echo "Scanning for USB storage devices..."
|
||||
insmod /lib/modules/usb-storage.ko >/dev/null 2>&1 \
|
||||
|| die "usb_storage: module load failed"
|
||||
while [[ $(list_usb_storage | wc -l) -eq 0 ]]; do
|
||||
[[ $timeout -ge 8 ]] && break
|
||||
sleep 1
|
||||
timeout=$(($timeout+1))
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
list_usb_storage()
|
||||
{
|
||||
TRACE "Under /etc/functions:list_usb_storage"
|
||||
|
Loading…
Reference in New Issue
Block a user