summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2009-04-30 00:03:09 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2009-04-30 00:03:09 +0000
commit0102b044b84b25f5038d355c6342fd54803bd645 (patch)
tree22d691644fa68aa093aa7a5986063e7dd051ab76
parentb8ace5142f6f2623be105ea7b03e07bd85b6ae89 (diff)
Redo the fdisk handling for MBR-only architectures (macppc has to get
caught up one day, but that is not my battle). Hope people like this tested by oga, ok krw
-rw-r--r--distrib/amd64/common/install.md53
-rw-r--r--distrib/armish/ramdisk/install.md53
-rw-r--r--distrib/i386/common/install.md53
-rw-r--r--distrib/landisk/ramdisk/install.md53
-rw-r--r--distrib/socppc/ramdisk/install.md53
5 files changed, 150 insertions, 115 deletions
diff --git a/distrib/amd64/common/install.md b/distrib/amd64/common/install.md
index 5c2ee195c57..1fcbe3845e3 100644
--- a/distrib/amd64/common/install.md
+++ b/distrib/amd64/common/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.16 2009/04/25 03:21:50 deraadt Exp $
+# $OpenBSD: install.md,v 1.17 2009/04/30 00:03:06 deraadt Exp $
#
#
# Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -54,39 +54,46 @@ md_installboot() {
}
md_prep_fdisk() {
- local _disk=$1
-
- ask_yn "Do you want to use *all* of $_disk for OpenBSD?"
- if [[ $resp == y ]]; then
- echo -n "Putting all of $_disk into an active OpenBSD MBR partition (type 'A6')..."
- fdisk -e ${_disk} <<__EOT >/dev/null
+ local _disk=$1 _q _d
+
+ while :; do
+ fdisk $_disk
+ if [[ -n $(fdisk $_disk | grep ' A6 ') ]]; then
+ _q=" use the (O)penBSD area,"
+ _d=OpenBSD
+ else
+ _q=
+ _d=whole
+ fi
+ ask "Use (W)hole disk,$_q or (E)dit the MBR?" "$_d"
+ case $resp in
+ w*|W*)
+ echo -n "Setting OpenBSD MBR partition to whole $_disk..."
+ fdisk -e ${_disk} <<__EOT >/dev/null
reinit
update
write
quit
__EOT
- echo "done."
- return
- fi
-
- # Manually configure the MBR.
- cat <<__EOT
+ echo "done."
+ return ;;
+ e*|E*)
+ # Manually configure the MBR.
+ cat <<__EOT
You will now create a single MBR partition to contain your OpenBSD data. This
partition must have an id of 'A6'; must *NOT* overlap other partitions; and
-must be marked as the only active partition.
-
-The 'manual' command describes all the fdisk commands in detail.
-
-$(fdisk ${_disk})
-__EOT
- fdisk -e ${_disk}
-
- cat <<__EOT
-Here is the partition information you chose:
+must be marked as the only active partition. Inside the fdisk command, the
+'manual' command describes all the fdisk commands in detail.
$(fdisk ${_disk})
__EOT
+ fdisk -e ${_disk}
+ [[ -n $(fdisk $_disk | grep ' A6 ') ]] && return
+ echo No OpenBSD partition in MBR, try again. ;;
+ o*|O*) return ;;
+ esac
+ done
}
md_prep_disklabel() {
diff --git a/distrib/armish/ramdisk/install.md b/distrib/armish/ramdisk/install.md
index 9cfa52a734f..40119213061 100644
--- a/distrib/armish/ramdisk/install.md
+++ b/distrib/armish/ramdisk/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.8 2009/04/12 12:56:01 krw Exp $
+# $OpenBSD: install.md,v 1.9 2009/04/30 00:03:08 deraadt Exp $
#
#
# Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -38,39 +38,46 @@ md_installboot() {
}
md_prep_fdisk() {
- local _disk=$1
-
- ask_yn "Do you want to use *all* of $_disk for OpenBSD?"
- if [[ $resp == y ]]; then
- echo -n "Putting all of $_disk into an active OpenBSD MBR partition (type 'A6')..."
- fdisk -e ${_disk} <<__EOT >/dev/null
+ local _disk=$1 _q _d
+
+ while :; do
+ fdisk $_disk
+ if [[ -n $(fdisk $_disk | grep ' A6 ') ]]; then
+ _q=" use the (O)penBSD area,"
+ _d=OpenBSD
+ else
+ _q=
+ _d=whole
+ fi
+ ask "Use (W)hole disk,$_q or (E)dit the MBR?" "$_d"
+ case $resp in
+ w*|W*)
+ echo -n "Setting OpenBSD MBR partition to whole $_disk..."
+ fdisk -e ${_disk} <<__EOT >/dev/null
reinit
update
write
quit
__EOT
- echo "done."
- return
- fi
-
- # Manually configure the MBR.
- cat <<__EOT
+ echo "done."
+ return ;;
+ e*|E*)
+ # Manually configure the MBR.
+ cat <<__EOT
You will now create a single MBR partition to contain your OpenBSD data. This
partition must have an id of 'A6'; must *NOT* overlap other partitions; and
-must be marked as the only active partition.
-
-The 'manual' command describes all the fdisk commands in detail.
-
-$(fdisk ${_disk})
-__EOT
- fdisk -e ${_disk}
-
- cat <<__EOT
-Here is the partition information you chose:
+must be marked as the only active partition. Inside the fdisk command, the
+'manual' command describes all the fdisk commands in detail.
$(fdisk ${_disk})
__EOT
+ fdisk -e ${_disk}
+ [[ -n $(fdisk $_disk | grep ' A6 ') ]] && return
+ echo No OpenBSD partition in MBR, try again. ;;
+ o*|O*) return ;;
+ esac
+ done
}
md_prep_disklabel() {
diff --git a/distrib/i386/common/install.md b/distrib/i386/common/install.md
index 2b2598290b8..cfe9f4ff82e 100644
--- a/distrib/i386/common/install.md
+++ b/distrib/i386/common/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.39 2009/04/25 03:21:51 deraadt Exp $
+# $OpenBSD: install.md,v 1.40 2009/04/30 00:03:08 deraadt Exp $
#
#
# Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -56,39 +56,46 @@ md_installboot() {
}
md_prep_fdisk() {
- local _disk=$1
-
- ask_yn "Do you want to use *all* of $_disk for OpenBSD?"
- if [[ $resp == y ]]; then
- echo -n "Putting all of $_disk into an active OpenBSD MBR partition (type 'A6')..."
- fdisk -e ${_disk} <<__EOT >/dev/null
+ local _disk=$1 _q _d
+
+ while :; do
+ fdisk $_disk
+ if [[ -n $(fdisk $_disk | grep ' A6 ') ]]; then
+ _q=" use the (O)penBSD area,"
+ _d=OpenBSD
+ else
+ _q=
+ _d=whole
+ fi
+ ask "Use (W)hole disk,$_q or (E)dit the MBR?" "$_d"
+ case $resp in
+ w*|W*)
+ echo -n "Setting OpenBSD MBR partition to whole $_disk..."
+ fdisk -e ${_disk} <<__EOT >/dev/null
reinit
update
write
quit
__EOT
- echo "done."
- return
- fi
-
- # Manually configure the MBR.
- cat <<__EOT
+ echo "done."
+ return ;;
+ e*|E*)
+ # Manually configure the MBR.
+ cat <<__EOT
You will now create a single MBR partition to contain your OpenBSD data. This
partition must have an id of 'A6'; must *NOT* overlap other partitions; and
-must be marked as the only active partition.
-
-The 'manual' command describes all the fdisk commands in detail.
-
-$(fdisk ${_disk})
-__EOT
- fdisk -e ${_disk}
-
- cat <<__EOT
-Here is the partition information you chose:
+must be marked as the only active partition. Inside the fdisk command, the
+'manual' command describes all the fdisk commands in detail.
$(fdisk ${_disk})
__EOT
+ fdisk -e ${_disk}
+ [[ -n $(fdisk $_disk | grep ' A6 ') ]] && return
+ echo No OpenBSD partition in MBR, try again. ;;
+ o*|O*) return ;;
+ esac
+ done
}
md_prep_disklabel() {
diff --git a/distrib/landisk/ramdisk/install.md b/distrib/landisk/ramdisk/install.md
index 66541c9e7a1..1baba0e73d2 100644
--- a/distrib/landisk/ramdisk/install.md
+++ b/distrib/landisk/ramdisk/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.18 2009/04/12 12:56:02 krw Exp $
+# $OpenBSD: install.md,v 1.19 2009/04/30 00:03:08 deraadt Exp $
#
#
# Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -51,39 +51,46 @@ md_installboot() {
}
md_prep_fdisk() {
- local _disk=$1
-
- ask_yn "Do you want to use *all* of $_disk for OpenBSD?"
- if [[ $resp == y ]]; then
- echo -n "Putting all of $_disk into an active OpenBSD MBR partition (type 'A6')..."
- fdisk -e ${_disk} <<__EOT >/dev/null
+ local _disk=$1 _q _d
+
+ while :; do
+ fdisk $_disk
+ if [[ -n $(fdisk $_disk | grep ' A6 ') ]]; then
+ _q=" use the (O)penBSD area,"
+ _d=OpenBSD
+ else
+ _q=
+ _d=whole
+ fi
+ ask "Use (W)hole disk,$_q or (E)dit the MBR?" "$_d"
+ case $resp in
+ w*|W*)
+ echo -n "Setting OpenBSD MBR partition to whole $_disk..."
+ fdisk -e ${_disk} <<__EOT >/dev/null
reinit
update
write
quit
__EOT
- echo "done."
- return
- fi
-
- # Manually configure the MBR.
- cat <<__EOT
+ echo "done."
+ return ;;
+ e*|E*)
+ # Manually configure the MBR.
+ cat <<__EOT
You will now create a single MBR partition to contain your OpenBSD data. This
partition must have an id of 'A6'; must *NOT* overlap other partitions; and
-must be marked as the only active partition.
-
-The 'manual' command describes all the fdisk commands in detail.
-
-$(fdisk ${_disk})
-__EOT
- fdisk -e ${_disk}
-
- cat <<__EOT
-Here is the partition information you chose:
+must be marked as the only active partition. Inside the fdisk command, the
+'manual' command describes all the fdisk commands in detail.
$(fdisk ${_disk})
__EOT
+ fdisk -e ${_disk}
+ [[ -n $(fdisk $_disk | grep ' A6 ') ]] && return
+ echo No OpenBSD partition in MBR, try again. ;;
+ o*|O*) return ;;
+ esac
+ done
}
md_prep_disklabel() {
diff --git a/distrib/socppc/ramdisk/install.md b/distrib/socppc/ramdisk/install.md
index e2337b8fec6..70adf158098 100644
--- a/distrib/socppc/ramdisk/install.md
+++ b/distrib/socppc/ramdisk/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.6 2009/04/12 12:56:02 krw Exp $
+# $OpenBSD: install.md,v 1.7 2009/04/30 00:03:08 deraadt Exp $
#
#
# Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -38,39 +38,46 @@ md_installboot() {
}
md_prep_fdisk() {
- local _disk=$1
-
- ask_yn "Do you want to use *all* of $_disk for OpenBSD?"
- if [[ $resp == y ]]; then
- echo -n "Putting all of $_disk into an active OpenBSD MBR partition (type 'A6')..."
- fdisk -e ${_disk} <<__EOT >/dev/null
+ local _disk=$1 _q _d
+
+ while :; do
+ fdisk $_disk
+ if [[ -n $(fdisk $_disk | grep ' A6 ') ]]; then
+ _q=" use the (O)penBSD area,"
+ _d=OpenBSD
+ else
+ _q=
+ _d=whole
+ fi
+ ask "Use (W)hole disk,$_q or (E)dit the MBR?" "$_d"
+ case $resp in
+ w*|W*)
+ echo -n "Setting OpenBSD MBR partition to whole $_disk..."
+ fdisk -e ${_disk} <<__EOT >/dev/null
reinit
update
write
quit
__EOT
- echo "done."
- return
- fi
-
- # Manually configure the MBR.
- cat <<__EOT
+ echo "done."
+ return ;;
+ e*|E*)
+ # Manually configure the MBR.
+ cat <<__EOT
You will now create a single MBR partition to contain your OpenBSD data. This
partition must have an id of 'A6'; must *NOT* overlap other partitions; and
-must be marked as the only active partition.
-
-The 'manual' command describes all the fdisk commands in detail.
-
-$(fdisk ${_disk})
-__EOT
- fdisk -e ${_disk}
-
- cat <<__EOT
-Here is the partition information you chose:
+must be marked as the only active partition. Inside the fdisk command, the
+'manual' command describes all the fdisk commands in detail.
$(fdisk ${_disk})
__EOT
+ fdisk -e ${_disk}
+ [[ -n $(fdisk $_disk | grep ' A6 ') ]] && return
+ echo No OpenBSD partition in MBR, try again. ;;
+ o*|O*) return ;;
+ esac
+ done
}
md_prep_disklabel() {