> > > diff -u -p -r1.988 install.sub
> > > --- distrib/miniroot/install.sub  13 Mar 2017 17:08:31 -0000      1.988
> > > +++ distrib/miniroot/install.sub  30 Mar 2017 10:44:01 -0000
> > > @@ -264,13 +264,7 @@ diskinfo() {
> > >   local _d
> > >  
> > >   for _d; do
> > > -         make_dev $_d
> > > -         echo -n "$_d: "
> > > -         disklabel -dpg $_d 2>/dev/null |
> > > -         sed     -e '/^label: /{s,,,;s/ *$//;s/^$/<no label>/;h;d;}' \
> > > -                 -e '/.*# total bytes: \(.*\)/{s//(\1)/;H;}' \
> > > -                 -e '$!d;x;s/\n/ /'
> > > -         rm -f /dev/{r,}$_d?
> > > +         sed -n "/^$_d/p" /var/run/dmesg.boot
> > >   done
> > >  }
> > > 
> > 
> > Your proposition is good for the installer? I doubt it.
> > 
> > j.
> 
> AFAICT the function diskinfo() is only called once in the installer: if
> you press ? a the prompt for the root disk. So my diff just changes the
> output in this case, no other functionality is affected.
> 
> What causes your doubt?

Robert,

could we use something like this? From dmesg we can get current
vendor, model, size plus serial if it does exist, 'sd0' could be grepped
before sed or we could put variable inside sed itself:

sed -e '/^sd0 at.*: <[A-Z]*, \([^,]*\).*fixed *\(.*\)/{s//\1 <\2>/;s/< *>$/<no 
serial>/;h;d;}' -e '/sd0: \([^,]*\).*/{s//(\1)/;H;}' -e '$!d;x;s/\n/ /' 
/var/run/dmesg.boot
SAMSUNG MZ7TE256 <naa.5002538844584d30> (244198MB)

If there's no serial it maybe could print this?

cat /var/run/dmesg.boot | sed 's/fixed.*/fixed/;' | sed -e '/^sd0 at.*: 
<[A-Z]*, \([^,]*\).*fixed *\(.*\)/{s//\1 <\2>/;s/< *>$/<no serial>/;h;d;}' -e 
'/sd0: \([^,]*\).*/{s//(\1)/;H;}' -e '$!d;x;s/\n/ /'
SAMSUNG MZ7TE256 <no serial> (244198MB)

What do you think?

PS: sed is really hardcore :)

j.

Reply via email to