Gentoo Archives: gentoo-desktop

From: Lindsay Haisley <fmouse-gentoo@×××.com>
To: Greg KH <greg@×××××.com>, gentoo-desktop@l.g.o, linux-hotplug-devel@×××××××××××××××××.net
Subject: [gentoo-desktop] Re: udevstart.c -> kscan.c
Date: Mon, 25 Oct 2004 07:46:25
Message-Id: 20041025074622.GD23239@fmp.com
In Reply to: [gentoo-desktop] Re: udevstart.c -> kscan.c by Lindsay Haisley
1 Thus spake Lindsay Haisley on Mon, Oct 25, 2004 at 02:22:28AM CDT
2 >
3 > > Also, what you are looking for (a list of all kernel class devices) can
4 > > be done with the following short bit of shell code. Feel free to add
5 > > the 'KERNEL=' portion to the beginning of every line if you think it's
6 > > necessary.
7
8 For what it's worth, this prettys it up a bit and adds copy 'n paste
9 convenience.
10
11 -------------------------------------
12
13 #! /bin/bash
14 #
15 # Directory where sysfs is mounted
16 SYSFS_DIR=/sys
17
18 # handle block devices and their partitions
19 echo "Block Devices:"
20 for i in ${SYSFS_DIR}/block/*; do
21 # each drive
22 echo -n " KERNEL=\""
23 echo -n ${i#${SYSFS_DIR}/block/}
24 echo \"
25
26 # each partition, on each device
27 for j in $i/*; do
28 if [ -f $j/dev ]; then
29 echo -n ${j#${SYSFS_DIR}} | awk -F/ '{printf(" KERNEL=\"%s\"\n", $4)}'
30 fi
31 done
32 done
33 echo; echo "Other Devices:"
34 # all other device classes
35 for i in ${SYSFS_DIR}/class/*; do
36 for j in $i/*; do
37 if [ -f $j/dev ]; then
38 echo -n ${j#${SYSFS_DIR}} | awk -F/ '{printf(" KERNEL=\"%s\"\n", $4)}'
39
40 fi
41 done
42 done
43
44
45 --
46 Lindsay Haisley | "Fighting against human | PGP public key
47 FMP Computer Services | creativity is like | available at
48 512-259-1190 | trying to eradicate | <http://pubkeys.fmp.com>
49 http://www.fmp.com | dandelions" |
50 | (Pamela Jones) |
51
52 --
53 gentoo-desktop@g.o mailing list