aboutsummaryrefslogtreecommitdiff
path: root/makedevs
blob: 809f57baee78565924e98043ff571814f098a9fe (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
#!/bin/sh

# a cheeky way of dynamically creating a /dev tree
devdir="/dev"
[ "$1" ] && devdir=$1

cd $devdir

for i in `find /sys/block -name dev`; do
	# get the second-to-last field
	name=`echo $i | rev | cut -d/ -f2 | rev`
	maj=`cat $i | cut -d: -f1`
	min=`cat $i | cut -d: -f2`
	[ ! -e $name ] && mknod $name b $maj $min
done

for i in `find /sys/class -name dev`; do
	# get the second-to-last field
	name=`echo $i | rev | cut -d/ -f2 | rev`
	# skip all the tty?? nodes
	#[ "${name%%??}" = "tty" ] && continue
	#[ "${name%%??}" = "pty" ] && continue
	maj=`cat $i | cut -d: -f1`
	min=`cat $i | cut -d: -f2`
	[ ! -e $name ] && mknod $name c $maj $min
done