diff --git a/initrd/bin/gui-init b/initrd/bin/gui-init index 38953ca..1740da6 100755 --- a/initrd/bin/gui-init +++ b/initrd/bin/gui-init @@ -13,6 +13,11 @@ mount_boot() # Mount local disk if it is not already mounted while ! grep -q /boot /proc/mounts ; do + + if [ "$CONFIG_BOOT_USB" = "y" ]; then + enable_usb + fi + # try to mount if CONFIG_BOOT_DEV exists if [ -e "$CONFIG_BOOT_DEV" ]; then mount -o ro $CONFIG_BOOT_DEV /boot diff --git a/initrd/bin/mount-usb b/initrd/bin/mount-usb index 501171a..2196bbd 100755 --- a/initrd/bin/mount-usb +++ b/initrd/bin/mount-usb @@ -4,19 +4,6 @@ enable_usb -if ! lsmod | grep -q usb_storage; then - 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" - 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 mkdir /media fi diff --git a/initrd/bin/usb-scan b/initrd/bin/usb-scan index d9f26b0..330d672 100755 --- a/initrd/bin/usb-scan +++ b/initrd/bin/usb-scan @@ -5,12 +5,6 @@ set -e -o pipefail . /etc/gui_functions . /tmp/config -# Unmount any previous boot device -if grep -q /boot /proc/mounts ; then - umount /boot \ - || die "Unable to unmount /boot" -fi - # Mount the USB boot device mount_usb || die "Unable to mount /media" diff --git a/initrd/etc/functions b/initrd/etc/functions index dc0fbed..00afcdb 100755 --- a/initrd/etc/functions +++ b/initrd/etc/functions @@ -122,6 +122,18 @@ enable_usb() || die "xhci_pci: module load failed" sleep 2 fi + if ! lsmod | grep -q usb_storage; then + 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" + while [[ $count == $(ls /dev/sd* 2>/dev/null | wc -l) ]]; do + [[ $timeout -ge 4 ]] && break + sleep 1 + timeout=$(($timeout+1)) + done + fi } confirm_gpg_card()