]> git.ipfire.org Git - thirdparty/systemd.git/blob - test/test.block
622a66037f3d4494c3bba07e6d410e9dfdc4d04e
[thirdparty/systemd.git] / test / test.block
1 #! /bin/sh
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 SYSFSDIR=/sys # change this for a nonstand sysfs mount point
14 BIN=./udev # location of your udev binary
15 export ACTION=$1 # 'add' or 'remove'
16
17 for i in ${SYSFSDIR}/block/*; do
18 # add each drive
19 export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-`
20 $BIN block
21
22 # add each partition, on each device
23 for j in $i/*; do
24 if [ -f $j/dev ]; then
25 export DEVPATH="/"`echo $j | \
26 cut --delimiter='/' --fields=3-`
27 $BIN block
28 fi
29 done
30 done