2003-10-18 13:54:14 +07:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
|
|
|
# test.block - run udev(8) on each block device in /sys/block
|
2003-07-24 05:56:14 +07:00
|
|
|
|
2003-10-21 12:45:46 +07:00
|
|
|
if [ $# = "0" ] ; then
|
|
|
|
echo
|
|
|
|
echo "usage: $0 <action>"
|
|
|
|
echo "where <action> is \"add\" or \"remove\""
|
|
|
|
echo
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2003-10-18 13:54:14 +07:00
|
|
|
SYSFSDIR=/sys # change this for a nonstand sysfs mount point
|
2003-11-24 21:13:05 +07:00
|
|
|
BIN=../udev # location of your udev binary
|
2003-10-21 12:45:46 +07:00
|
|
|
export ACTION=$1 # 'add' or 'remove'
|
2003-07-17 10:17:20 +07:00
|
|
|
|
2003-10-18 13:54:14 +07:00
|
|
|
for i in ${SYSFSDIR}/block/*; do
|
2003-10-18 15:18:04 +07:00
|
|
|
# add each drive
|
2003-11-19 17:39:39 +07:00
|
|
|
export DEVPATH=${i#${SYSFSDIR}}
|
2003-10-18 13:54:14 +07:00
|
|
|
$BIN block
|
2003-10-18 15:18:04 +07:00
|
|
|
|
|
|
|
# add each partition, on each device
|
|
|
|
for j in $i/*; do
|
|
|
|
if [ -f $j/dev ]; then
|
2003-11-19 17:39:39 +07:00
|
|
|
export DEVPATH=${j#${SYSFSDIR}}
|
2003-10-18 15:18:04 +07:00
|
|
|
$BIN block
|
|
|
|
fi
|
|
|
|
done
|
2003-10-18 13:54:14 +07:00
|
|
|
done
|