does anyone know how to make this work?
it's a more advanced version of /sbin/udevsynthesize which on debian will trigger SIX HUNDRED events, which takes forever.
i'm working on depinit, and so have split udevsynthesize down into separate scripts - one for "essential" devices, one for networking, one for block devices, and another for non-essential tty devices.
each time the word "add" is shoved into /sys/class/something/something/uevent, udevd picks it up and shoves a symlink into /dev/.udev/queue/<thedevice>.
when the scripts and modprobes for that device are finally run, the symlink is removed (by udevd).
so, in shellscript language, in my (four) udevsynth scripts named udevsynth-tty, udevsynth-essential, udevsynth-block and udevsynth-net, i'm trying to ONLY "watch" and "wait" for those files (symlinks) that i did an "add" on, and to ignore all other symlinks.
the first problem that i encountered was that i need to call readlink on each of the things in the queue directory.
it's all got quite hairy!
#!/bin/sh -efunction get_queue() { list="`/usr/bin/find /dev/.udev/queue -ignore_readdir_race -type l -print0`" if [ "y$list" == "y" ] ; then queue=1; return; fi echo "`/usr/bin/find /dev/.udev/queue -ignore_readdir_race -type l -print0|xargs -0 -n1 readlink`" queue="`/usr/bin/find /dev/.udev/queue -ignore_readdir_race -type l -print0|xargs -0 -n1 readlink`" } function check_links() { get_queue if [ "y$queue" == "y1" ] ; then return 1; fi echo "$file" | grep -qF "$queue" }
# this is a list of /sys/class/*/(*/)uevent # and has to be dirname-stripped to work with # the find/xargs/grep trick, above.
file_list2="$first $default $last"
for file in $file_list; do [ "$file" ] || continue echo 'add' > "$file" || true done
sleep 1
for f in $file_list2; do [ "$file" ] || continue file=`dirname $f` y="0" while [ "y$y" == "y0" ] ; do check_links sleep 1 done done