#!/bin/sh -e

PREREQS=""

prereqs() { echo "$PREREQS"; }

case "$1" in
    prereqs)
    prereqs
    exit 0
    ;;
esac

echo > /sys/kernel/uevent_helper

UDEV_ROOT=/dev \
udevd --daemon --resolve-names=never

udevadm trigger --action=add
udevadm settle || true

if [ -d /sys/bus/scsi ]; then
	modprobe -q scsi_wait_scan && modprobe -r scsi_wait_scan || true
	udevadm settle || true
fi

# If the rootdelay parameter has been set, we wait a bit for devices
# like usb/firewire disks to settle.
if [ "$ROOTDELAY" ]; then
	if [ -x /sbin/usplash_write ]; then
		/sbin/usplash_write "TIMEOUT $(($ROOTDELAY + 5))"
	fi
	sleep $ROOTDELAY
	if [ -x /sbin/usplash_write ]; then
		/sbin/usplash_write "TIMEOUT 15"
	fi
fi

# Leave udev running to process events that come in out-of-band (like USB
# connections)
