Subject: Re: testing presence of a device (was sun-lamp CVS commits)
To: Jason Thorpe <thorpej@nas.nasa.gov>
From: Rolf Grossmann <grossman@informatik.tu-muenchen.de>
List: current-users
Date: 10/06/1995 02:12:23
Hi,
on Wed, 04 Oct 1995 18:42:15 -0700 Jason Thorpe wrote
concerning "Re: testing presence of a device (was sun-lamp CVS commits) "
something like this:
>>> 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...
Hmm ... it was not cc:'ed to you, but you should have received it on the
list, by now.
> 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:
I don't think so. From a list of possible devices, you can easily determine
which ones are present using a simple loop. (cgd already showed us how ;))
The huge advantage is, that the only arch-dependent part is the list of
possible devices, which is very easy to "port" ;)
[...]
You wouldn't get duplicate entries, either.
> 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?
I don't think that this is a problem, if you specify the raw partition of
a disk, at least it shouldn't, if there is no other problem with that disk.
Maybe we can keep that in mind for the release after 1.1, I don't think we
need to change things now.
Bye, Rolf