disk-list.sh (211730) | disk-list.sh (212337) |
---|---|
1#!/bin/sh 2#- 3# Copyright (c) 2010 iXsystems, Inc. All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24# SUCH DAMAGE. 25# | 1#!/bin/sh 2#- 3# Copyright (c) 2010 iXsystems, Inc. All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24# SUCH DAMAGE. 25# |
26# $FreeBSD: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh 211730 2010-08-24 06:11:46Z imp $ | 26# $FreeBSD: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh 212337 2010-09-08 20:10:24Z imp $ |
27 28ARGS=$1 29FLAGS_MD="" | 27 28ARGS=$1 29FLAGS_MD="" |
30FLAGS_CD="" |
|
30FLAGS_VERBOSE="" 31 32shift 33while [ -n "$1" ] 34do 35 case "$1" in 36 -m) 37 FLAGS_MD=1 38 ;; 39 -v) 40 FLAGS_VERBOSE=1 41 ;; | 31FLAGS_VERBOSE="" 32 33shift 34while [ -n "$1" ] 35do 36 case "$1" in 37 -m) 38 FLAGS_MD=1 39 ;; 40 -v) 41 FLAGS_VERBOSE=1 42 ;; |
43 -c) 44 FLAGS_CD=1 45 ;; |
|
42 esac 43 shift 44done 45 46# Create our device listing 47SYSDISK=$(sysctl -n kern.disks) 48if [ -n "${FLAGS_MD}" ] 49then --- 7 unchanged lines hidden (view full) --- 57# Now loop through these devices, and list the disk drives 58for i in ${SYSDISK} 59do 60 61 # Get the current device 62 DEV="${i}" 63 64 # Make sure we don't find any cd devices | 46 esac 47 shift 48done 49 50# Create our device listing 51SYSDISK=$(sysctl -n kern.disks) 52if [ -n "${FLAGS_MD}" ] 53then --- 7 unchanged lines hidden (view full) --- 61# Now loop through these devices, and list the disk drives 62for i in ${SYSDISK} 63do 64 65 # Get the current device 66 DEV="${i}" 67 68 # Make sure we don't find any cd devices |
65 case "${DEV}" in 66 acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;; 67 esac | 69 if [ -z "${FLAGS_CD}" ] 70 then 71 case "${DEV}" in 72 acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;; 73 esac 74 fi |
68 69 # Check the dmesg output for some more info about this device 70 NEWLINE=$(dmesg | sed -n "s/^$DEV: .*<\(.*\)>.*$/ <\1>/p" | head -n 1) 71 if [ -z "$NEWLINE" ]; then 72 NEWLINE=" <Unknown Device>" 73 fi 74 75 if [ -n "${FLAGS_MD}" ] && echo "${DEV}" | grep -E '^md[0-9]+' >/dev/null 2>/dev/null --- 21 unchanged lines hidden --- | 75 76 # Check the dmesg output for some more info about this device 77 NEWLINE=$(dmesg | sed -n "s/^$DEV: .*<\(.*\)>.*$/ <\1>/p" | head -n 1) 78 if [ -z "$NEWLINE" ]; then 79 NEWLINE=" <Unknown Device>" 80 fi 81 82 if [ -n "${FLAGS_MD}" ] && echo "${DEV}" | grep -E '^md[0-9]+' >/dev/null 2>/dev/null --- 21 unchanged lines hidden --- |