summaryrefslogtreecommitdiffstats
path: root/PCBSD/pc-sysinstall/backend-query/.svn/text-base/disk-list.sh.svn-base
blob: 4a17133eb3331396395b83d1a03aff54ba83e6e9 (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
#!/bin/sh

# Create our device listing
SYSDISK=$(sysctl -n kern.disks)

# Now loop through these devices, and list the disk drives
for i in ${SYSDISK}
do

  # Get the current device
  DEV="${i}"

  # Make sure we don't find any cd devices
  case "${DEV}" in
     acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;;
  esac

  # Check the dmesg output for some more info about this device
  NEWLINE=$(dmesg | sed -n "s/^$DEV: .*<\(.*\)>.*$/ <\1>/p" | head -n 1)
  if [ -z "$NEWLINE" ]; then
    NEWLINE=" <Unknown Device>"
  fi

  # Save the disk list
  if [ ! -z "$DLIST" ]
  then
    DLIST="\n${DLIST}"
  fi

  DLIST="${DEV}:${NEWLINE}${DLIST}"

done

# Echo out the found line
echo -e "$DLIST" | sort
OpenPOWER on IntegriCloud