From owner-svn-src-all@FreeBSD.ORG Wed Feb 23 07:32:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1937D1065670; Wed, 23 Feb 2011 07:32:44 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 4CC078FC14; Wed, 23 Feb 2011 07:32:42 +0000 (UTC) Received: by fxm19 with SMTP id 19so4521640fxm.13 for ; Tue, 22 Feb 2011 23:32:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:organization:references:date :in-reply-to:message-id:user-agent:mime-version:content-type; bh=S5df5Ym3pnY3a4eCzkxQrqQ/dwQTLH9XSSS/oqj+oaw=; b=vuEqX3sBp74zRwdHe6UV3tB4/TmZFkUL9qXwTrkvaryItZZl3eo8uxYdiVySPjmBHM guAQdIbXxhxmg0u2v94KlQ2O1GBkGALquX3HvhqjOho5IUs5ckZ+4SubWXtWvxjTKlKf 1gISUARyMvzH/e4nP9zssrrTg/WHM7xUVJ1Lo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:organization:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; b=fpqOcapoQ5aOt+mNoE71T4MYwUziECCtWwrKzPDEk9AlaCJHW6mLGSeAt+qxOYhwjC L9qsa7uKUIERX/UzCVef7iqA5Rtf/31/g7HdxVTf8uqZxNkpSPzSnKAIB8tiNc7IpmdU Vi7ywC/gi5MoN2n4pdkEOeFbYEt43r6G7ggC8= Received: by 10.223.101.131 with SMTP id c3mr4615472fao.5.1298446362239; Tue, 22 Feb 2011 23:32:42 -0800 (PST) Received: from localhost ([94.27.39.186]) by mx.google.com with ESMTPS id r24sm2462102fax.27.2011.02.22.23.32.40 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 22 Feb 2011 23:32:41 -0800 (PST) From: Mikolaj Golub To: "Bjoern A. Zeeb" Organization: TOA Ukraine References: <201102221918.p1MJIukV018893@svn.freebsd.org> <20110223011759.W13400@maildrop.int.zabbadoz.net> Date: Wed, 23 Feb 2011 09:32:37 +0200 In-Reply-To: <20110223011759.W13400@maildrop.int.zabbadoz.net> (Bjoern A. Zeeb's message of "Wed, 23 Feb 2011 01:23:50 +0000 (UTC)") Message-ID: <854o7vkxyi.fsf@in138.ua3> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Josh Paetzel , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r218959 - head/usr.sbin/pc-sysinstall/backend-query X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Feb 2011 07:32:44 -0000 On Wed, 23 Feb 2011 01:23:50 +0000 (UTC) Bjoern A. Zeeb wrote: BAZ> 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') BAZ> Sure sed works if there is a blank between s and the delimiter? BAZ> May I suggest nothing shorter but two pipes less, though not exactly BAZ> the same with regard to whitespace stripping in and after the device BAZ> name but that could be fixed easily as well. BAZ> camcontrol identify $DEV | awk '/device model/ { gsub("device model[[:space:]]*", ""); print; }' BAZ> I am sure it can still be done way more clever but ... what about this? :-) camcontrol identify $DEV | sed -ne 's/^device model *//p' -- Mikolaj Golub