chiark / gitweb /
[PATCH] allow unlimitied count of symlinks
[elogind.git] / test / testd.block
1 #!/bin/bash
2 #
3 # test.block - run udev(8) on each block device in /sys/block
4
5 if [ $# = "0" ] ; then
6         echo
7         echo "usage: $0 <action>"
8         echo "where <action> is \"add\" or \"remove\""
9         echo
10         exit 1
11 fi
12
13 killall udevd
14
15 SYSFSDIR=/sys           # change this for a nonstand sysfs mount point
16 BIN=./udevsend          # location of your udev binary
17 export ACTION=$1        # 'add' or 'remove'
18 seq=1
19
20 for i in ${SYSFSDIR}/block/*; do
21         # add each drive
22         export DEVPATH=${i#${SYSFSDIR}}
23         export SEQNUM=$seq
24         $BIN block
25         x=$((seq++))
26
27         # add each partition, on each device
28         for j in $i/*; do
29                 if [ -f $j/dev ]; then
30                         export DEVPATH=${j#${SYSFSDIR}}
31                         export SEQNUM=$seq
32                         $BIN block
33                         x=$((seq++))
34                 fi
35         done
36 done