Subject: Re: testing presence of a device (was sun-lamp CVS commits)
To: None <thorpej@nas.nasa.gov>
From: Patrick Arnoux <parnoux@orli.com>
List: current-users
Date: 10/09/1995 20:50:02
> From owner-current-users@NetBSD.ORG Thu Oct  5 04:16:32 1995
> X-Authentication-Warning: lestat.nas.nasa.gov: Host localhost didn't use HELO protocol
> To: Rolf Grossmann <grossman@informatik.tu-muenchen.de>
> Cc: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>, current-users@NetBSD.ORG
> Subject: Re: testing presence of a device (was sun-lamp CVS commits) 
> Reply-To: Jason Thorpe <thorpej@nas.nasa.gov>
> From: Jason Thorpe <thorpej@nas.nasa.gov>
> Date: Wed, 04 Oct 1995 18:42:15 -0700
> Sender: owner-current-users@NetBSD.ORG
> X-Loop: current-users@NetBSD.ORG
> Content-Length: 1627
> 
> On Thu, 5 Oct 1995 02:26:16 +0100 
>  Rolf Grossmann <grossman@informatik.tu-muenchen.de> wrote:
> 
>  > > On a NetBSD/sparc machine with a bwtw0 but only one disk (sd0),
>  > > [Callisto] 15> sh -c 'if ( < /dev/sd2a ) 2> /dev/null; then echo yes; else echo no; fi'
>  > > no
>  > > [Callisto] 16> sh -c 'if ( < /dev/bwtwo0 ) 2> /dev/null; then echo yes; else echo no; fi'
>  > > yes
>  > > [Callisto] 17>
> 
> I apparently missed this original mail...
> 
> The point is, doing this in shell to present a list like:
> 
> 	You can install on the following devices:
> 		sd0
> 		sd1
> 		sd3
> 
> ...is impractical.  My install.sh for the hp300 basically does:
> 
> 	dmesg | grep "^sd" | grep "slave"
> 	dmesg | grep "^rd" | grep "slave"
> 
> This works fine since I know that the hp300 can only have sd (SCSI disks) 
> and rd (HP-IB disks) hooked up to it.  Yes sometimes it can result in 
> something like:
> 
> 	You can install on the following devices:
> 		sd0
> 		rd0
> 		rd1
> 		sd0
> 		rd0
> 		rd1
> 
> ...but that seems like a nit that could be cleaned up with a little 
> clever shell coding (which I just don't have time to do :-).
> 
> Also, the technique of opening a device can be problematic in some 
> circumstances ... maybe the disk is there but the partition has the wrong 
> fstype, and thus the driver returns ENXIO?
> 
> --------------------------------------------------------------------------
> Jason R. Thorpe                                       thorpej@nas.nasa.gov
> NASA Ames Research Center                               Home: 408.866.1912
> NAS: M/S 258-6                                          Work: 415.604.0935
> Moffett Field, CA 94035                                Pager: 415.428.6939
>