Debian Codegraph @

list-devices-kfreebsd

raw symbols SCIP
1 #! /bin/shscip-shell filesystem . . `/bin/sh`.
2 set -e
3 TYPE="$1"
4
5 case $TYPE in
6 maybe-floppy)
7 loggerscip-shell system . . logger. -t list-devices "deprecated parameter maybe-floppy"
8 TYPE=floppy
9 ;;
10 maybe-usb-floppy)
11 # Linux specific option, ignore it
12 exit 0
13 ;;
14 cd|disk|partition|floppy)
15 ;;
16 usb-partition)
17 TYPE=usb_partition
18 ;;
19 *)
20 echoscip-shell system . . echo. "Usage: $0 cd|disk|partition|floppy|maybe-usb-floppy|usb-partition" >&2
21 exit 2
22 ;;
23 esac
24
25 #
26 # We are using the entries present in /dev to detect the different kind
27 # of devices. Some heuristics are then used to refine the result.
28 #
29
30 is_cdscip-shell shell debian-installer-utils 1.157 is_cd().() {
31 echoscip-shell system . . echo. "$1" | egrepscip-shell system . . egrep. -q '^/dev/cd[0-9]+$' || return 1
32
33 return 0
34 }
35
36 is_diskscip-shell shell debian-installer-utils 1.157 is_disk().() {
37 echoscip-shell system . . echo. "$1" | egrepscip-shell system . . egrep. -q '^/dev/(ad|da)[0-9]+$' || return 1
38
39 return 0
40 }
41
42 is_partitionscip-shell shell debian-installer-utils 1.157 is_partition().() {
43 echoscip-shell system . . echo. "$1" | egrepscip-shell system . . egrep. -q '^/dev/((ad|da)[0-9]+[ps][0-9]+[a-z]?$|md[0-9])+$' || return 1
44
45 return 0
46 }
47
48 is_floppyscip-shell shell debian-installer-utils 1.157 is_floppy().() {
49 echoscip-shell system . . echo. "$1" | egrepscip-shell system . . egrep. -q '^/dev/fd[0-9]+$' || return 1
50
51 return 0
52 }
53
54 is_usb_partitionscip-shell shell debian-installer-utils 1.157 is_usb_partition().() {
55 echoscip-shell system . . echo. "$1" | egrepscip-shell system . . egrep. -q '^/dev/(ad|da)[0-9]+[ps][0-9]+$' || return 1
56 drive="$(echoscip-shell system . . echo. "$1" | sedscip-shell system . . sed. -e 's,^/dev/,,' -e 's,[ps][0-9]\+,,')"
57 grepscip-shell system . . grep. -q "kernel: $drive at umass" /var/log/syslogscip-shell filesystem . . `/var/log/syslog`. || return 1
58
59 return 0
60 }
61
62 # Loop through all /dev/ entries and test all the character ones
63 for x in /dev/* ; do
64 [scip-shell system . . `[`. -c "$x" ] || continue
65
66 if is_$TYPE "$x" ; then
67 echoscip-shell system . . echo. $x
68 fi
69 done
70
71 exit 0