summaryrefslogtreecommitdiff
path: root/test/wait_for_sysfs_test.sh
blob: f299d23c944525b928893f36d5353a4dd5a3ec2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /bin/sh
#

# Check for missing binaries (stale symlinks should not happen)
UDEV_BIN=../wait_for_sysfs
test -x $UDEV_BIN || exit 5

# Directory where sysfs is mounted
SYSFS_DIR=/sys

run_udev () {
	# handle block devices and their partitions
	for i in ${SYSFS_DIR}/block/*; do
		# add each drive
		export DEVPATH=${i#${SYSFS_DIR}}
		$UDEV_BIN block &

		# add each partition, on each device
		for j in $i/*; do
			if [ -f $j/dev ]; then
				export DEVPATH=${j#${SYSFS_DIR}}
				$UDEV_BIN block
			fi
		done
	done
	# all other device classes
	for i in ${SYSFS_DIR}/class/*; do
		for j in $i/*; do
#			if [ -f $j/dev ]; then
				export DEVPATH=${j#${SYSFS_DIR}}
				CLASS=`echo ${i#${SYSFS_DIR}} | \
					cut --delimiter='/' --fields=3-`
				$UDEV_BIN $CLASS
#			fi
		done
	done
}

export ACTION=add
run_udev