On Thu, May 17, 2018 at 06:42:15PM -0600, Aaron Bieber wrote:
> On Thu, May 17, 2018 at 06:37:56PM -0600, Aaron Bieber wrote:
> > On Fri, Mar 02, 2018 at 07:32:04AM -0700, Aaron Bieber wrote:
> > > Hi,
> > > 
> > > Currently disks can only be entered in the [sw]d[0-9][0-9] format at the
> > > "Which disk is the root disk?" prompt. This is great for humans, but
> > > things get tricky when doing an autoinstall upgrade on systems where
> > > connected disks change frequently.
> > > 
> > > This diff lets you put the DUID in the response file.
> > > 
> > > If anyone has a better way to determine the disk from the duid, I am all
> > > ears :D
> > > 
> > > Cheers,
> > > Aaron
> > > 
> > 
> > Thanks to tb@, kn@, Philipp Buehler and phy1729 on #metabug! I tested a
> > bsd.rd with an auto-upgrade response file. Once with a duid and once
> > with a disk name. Both worked.
> > 
> > I have an OK from tb@ unless anyone objects.
> > 
> > The diff has been distilled down to this:
> > 
> 
> Paste fail, here is the latest diff:

Sleeping over it once more, I must say I'm still not terribly fond of
this hack and would like to retract my ok for these two reasons:

* we clobber 'resp' which may then leave a confusing error message.
  It's only in the $AUTO case, but still.

* In the is_duid case we walk the hw.disknames output twice even though
  we know that we already have a good device. This is a bit stupid.

I do think this is going in the right direction, but I'd really like to
see these two points resolved before it goes in. It's probably not too
difficult, but I've got too many things on my hand, so I won't be able
to do it myself anytime soon.

> Index: distrib/miniroot/install.sub
> ===================================================================
> RCS file: /var/cvs/src/distrib/miniroot/install.sub,v
> retrieving revision 1.1067
> diff -u -p -r1.1067 install.sub
> --- distrib/miniroot/install.sub      7 May 2018 10:44:01 -0000       1.1067
> +++ distrib/miniroot/install.sub      18 May 2018 00:16:34 -0000
> @@ -336,6 +336,12 @@ get_ifs() {
>       done
>  }
>  
> +# checks whether $1 is a valid duid
> +is_duid() {
> +     ((${#1} == 16)) && [[ $1 == +([0-9a-f]) ]] && return 0
> +     return 1
> +}
> +
>  # Return the device name of the disk device $1, which may be a disklabel UID.
>  get_dkdev_name() {
>       local _dev=${1#/dev/} _d
> @@ -2231,7 +2237,8 @@ get_rootinfo() {
>               case $resp in
>               "?")    diskinfo $(get_dkdevs);;
>               '')     ;;
> -             *)      if isin "$resp" $(get_dkdevs); then
> +             *)      $AUTO && is_duid "$resp" && resp=$(get_dkdev_name $resp)
> +                     if isin "$resp" $(get_dkdevs); then
>                               [[ $MODE == install ]] && break
>                               is_rootdisk "$resp" && break
>                               echo "$resp is not a valid root disk."
> 
> -- 
> PGP: 0x1F81112D62A9ADCE / 3586 3350 BFEA C101 DB1A  4AF0 1F81 112D 62A9 ADCE
> 

Reply via email to