Hi, These are some scripts I have written to auto-detect what network card and cd drive udev rules to use:
cat > detect-cd << "EOF" #!/bin/bash # Written by Reece H. Dunn <[EMAIL PROTECTED]> for block in `find /sys/block -maxdepth 1 -name [sh]d* | sed 's@/sys@@'`; do udevtest ${block} > tmp/udev-info if [[ `cat /tmp/udev-info | grep -F "ID_TYPE=cd"` ]]; then MODEL=`cat /tmp/udev-info | grep -F "ID_MODEL" | sed "[EMAIL PROTECTED](.*\)'@\1@"` REVISION=`cat /tmp/udev-info | grep -F "ID_REVISION" | sed "[EMAIL PROTECTED](.*\)'@\1@"` echo "SUBSYSTEM==\"block\", ENV{ID_MODEL}==\"${MODEL}\", ENV{ID_REVISION==\"${REVISION}\", SYMLINK+=\"cdrom dvd\"}" fi rm /tmp/udev-info done EOF cat > detect-net << "EOF" #!/bin/bash # Written by Reece H. Dunn <[EMAIL PROTECTED]> for net in `grep -H . /sys/class/net/*/address | sed -e '/:00:00:00:00:00:00/d'`; do address=`echo $net | sed -e '[EMAIL PROTECTED]:\(.*\)@\1@'` name=`echo $net | sed -e '[EMAIL PROTECTED]/\(.*\)/[EMAIL PROTECTED]@'` echo "ACTION==\"add\", SUBSYSTEM==\"net\", SYSFS{address}==\"${address}\", NAME=\"${name}\"" done EOF These can then be used like this: ./detect-cd > /etc/udev/rules.d/82-cdrom.rules ./detect-net > /etc/udev/rules.d/26-network.rules The detect-cd script will only work properly with machines that only have one CD, as it always uses the same symlink for the CD devices. Are these useful to include in the LFS book? - Reece -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page