#!/bin/bash SEQNUM=0 call_udev() { export SEQNUM=$((SEQNUM + 1)) #echo "DEVPATH=$DEVPATH, CLASS=$1, SEQNUM=$SEQNUM" /sbin/udevsend $1 } populate_udev() { local x= local y= local CLASS= # Propogate /dev from /sys - we only need this while we do not # have initramfs and an early user-space with which to do early # device bring up export ACTION=add # Add block devices and their partitions for x in /sys/block/* do # Add each drive export DEVPATH="${x#/sys}" call_udev block # Add each partition, on each device for y in ${x}/* do if [ -f "${y}/dev" ] then export DEVPATH="${y#/sys}" call_udev block fi done done # All other device classes for x in /sys/class/* do for y in ${x}/* do if [ -f "${y}/dev" ] then CLASS="$(echo "${x#/sys}" | cut --delimiter='/' --fields=3-)" export DEVPATH="${y#/sys}" call_udev ${CLASS} fi done done unset ACTION DEVPATH return 0 } populate_udev