svn commit: r218959 - head/usr.sbin/pc-sysinstall/backend-query

Bjoern A. Zeeb bzeeb-lists at lists.zabbadoz.net
Wed Feb 23 01:25:09 UTC 2011


On Tue, 22 Feb 2011, Josh Paetzel wrote:

> Author: jpaetzel
> Date: Tue Feb 22 19:18:56 2011
> New Revision: 218959
> URL: http://svn.freebsd.org/changeset/base/218959
>
> Log:
>  Better method for grabbing disk name, dmesg may produce mangled output.
>
>  Approved by:	kib (mentor, implicit)
>
> Modified:
>  head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
>
> Modified: head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh
> ==============================================================================
> --- head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh	Tue Feb 22 19:05:42 2011	(r218958)
> +++ head/usr.sbin/pc-sysinstall/backend-query/disk-list.sh	Tue Feb 22 19:18:56 2011	(r218959)
> @@ -74,7 +74,7 @@ do
>   fi
>
>   # Check the dmesg output for some more info about this device
> -  NEWLINE=$(dmesg | sed -n "s/^$DEV: .*<\(.*\)>.*$/ <\1>/p" | head -n 1)
> +  NEWLINE=$(camcontrol identify $DEV | grep "device model" | tr -s ' ' | sed 's |device model ||g')

Sure sed works if there is a blank between s and the delimiter?

May I suggest nothing shorter but two pipes less, though not exactly
the same with regard to whitespace stripping in and after the device
name but that could be fixed easily as well.

camcontrol identify $DEV | awk '/device model/ { gsub("device model[[:space:]]*", ""); print; }'

I am sure it can still be done way more clever but ...


>   if [ -z "$NEWLINE" ]; then
>     NEWLINE=" <Unknown Device>"
>   fi
>

-- 
Bjoern A. Zeeb                                 You have to have visions!
          Stop bit received. Insert coin for new address family.


More information about the svn-src-head mailing list