installer: do proper checks for MBR/GPT and OpenBSD area

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

installer: do proper checks for MBR/GPT and OpenBSD area

Paul Irofti-4
Hi,

While reinstalling OpenBSD on the x260 I saw a weird message when
selecting the disk (that had a valid MBR)

    'No valid MBR or GPT'

which lead to the following installer diff.

The idea is to do two checks (similar to i386): first see if there's an
MBR or GPT present on the disk, and if there is then check for the
OpenBSD area.

The current code is too strict and checks for an OpenBSD area inside an
MBR or GPT and if it fails to find one reports that there's no valid MBR
or GPT (which is misleading).

OK?


Index: install.md
===================================================================
RCS file: /cvs/src/distrib/amd64/common/install.md,v
retrieving revision 1.51
diff -u -p -u -p -r1.51 install.md
--- install.md 8 Feb 2016 17:28:08 -0000 1.51
+++ install.md 2 Sep 2016 10:51:42 -0000
@@ -59,10 +59,12 @@ md_prep_fdisk() {
 
  [[ $MDEFI == y ]] && _d=gpt
 
- if disk_has $_disk mbr openbsd || disk_has $_disk gpt openbsd; then
- _q="$_q, (O)penBSD area"
- _d=OpenBSD
+ if disk_has $_disk mbr || disk_has $_disk gpt; then
  fdisk $_disk
+ if disk_has $_disk mbr openbsd || disk_has $_disk gpt openbsd; then
+ _q="$_q, (O)penBSD area"
+ _d=OpenBSD
+ fi
  else
  echo "No valid MBR or GPT."
  fi

Reply | Threaded
Open this post in threaded view
|

Re: installer: do proper checks for MBR/GPT and OpenBSD area

Alexander Hall
On Fri, Sep 02, 2016 at 01:57:21PM +0300, Paul Irofti wrote:

> Hi,
>
> While reinstalling OpenBSD on the x260 I saw a weird message when
> selecting the disk (that had a valid MBR)
>
>     'No valid MBR or GPT'
>
> which lead to the following installer diff.
>
> The idea is to do two checks (similar to i386): first see if there's an
> MBR or GPT present on the disk, and if there is then check for the
> OpenBSD area.
>
> The current code is too strict and checks for an OpenBSD area inside an
> MBR or GPT and if it fails to find one reports that there's no valid MBR
> or GPT (which is misleading).
>
> OK?
>
>
> Index: install.md
> ===================================================================
> RCS file: /cvs/src/distrib/amd64/common/install.md,v
> retrieving revision 1.51
> diff -u -p -u -p -r1.51 install.md
> --- install.md 8 Feb 2016 17:28:08 -0000 1.51
> +++ install.md 2 Sep 2016 10:51:42 -0000
> @@ -59,10 +59,12 @@ md_prep_fdisk() {
>  
>   [[ $MDEFI == y ]] && _d=gpt
>  
> - if disk_has $_disk mbr openbsd || disk_has $_disk gpt openbsd; then
> - _q="$_q, (O)penBSD area"
> - _d=OpenBSD
> + if disk_has $_disk mbr || disk_has $_disk gpt; then
>   fdisk $_disk

> + if disk_has $_disk mbr openbsd || disk_has $_disk gpt openbsd; then

Can you wrap this please? It was already too long before. :)

                        if disk_has $_disk mbr openbsd ||
                                disk_has $_disk gpt openbsd; then

> + _q="$_q, (O)penBSD area"
> + _d=OpenBSD
> + fi
>   else
>   echo "No valid MBR or GPT."
>   fi

I've never touched a GPT, but it certainly looks right(er). ok halex@