summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2002-05-18 17:56:04 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2002-05-18 17:56:04 +0000
commit8f7044cbf127a7ac249e1b339722f078b855d609 (patch)
tree12963ebb8b8f66d825f29e7606084cdde69e11fd
parent21bbb8cdc8d79bafd5fd05ad8c9f0e91d021929b (diff)
Eliminate md_get_diskdevs() and md_get_cddevs() by
1) Saving one boot's worth of dmesg in /tmp/dmesg.boot 2) Using sed to scan for devices and pull out names in new get_diskdevs() and get_cddevs() in install.sub 3) Saving any md disk/cd sed patterns in MDDISKDEVS and MDCDDEVS variables.
-rw-r--r--distrib/alpha/common/install.md23
-rw-r--r--distrib/amiga/install.md13
-rw-r--r--distrib/hp300/ramdisk/install.md15
-rw-r--r--distrib/i386/common/install.md12
-rw-r--r--distrib/mac68k/ramdisk/install.md12
-rw-r--r--distrib/macppc/ramdisk/install.md12
-rw-r--r--distrib/miniroot/install.sub29
-rw-r--r--distrib/mvme68k/ramdisk/install.md12
-rw-r--r--distrib/mvme88k/ramdisk/install.md10
-rw-r--r--distrib/mvmeppc/ramdisk/install.md12
-rw-r--r--distrib/sparc/install.md27
-rw-r--r--distrib/sparc64/common/install.md25
-rw-r--r--distrib/sun3/install.md27
-rw-r--r--distrib/vax/install.md29
14 files changed, 40 insertions, 218 deletions
diff --git a/distrib/alpha/common/install.md b/distrib/alpha/common/install.md
index bc71a69b73a..269fc8474ff 100644
--- a/distrib/alpha/common/install.md
+++ b/distrib/alpha/common/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.8 2002/05/14 01:49:25 krw Exp $
+# $OpenBSD: install.md,v 1.9 2002/05/18 17:56:03 krw Exp $
#
# Copyright (c) 1996 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -46,27 +46,6 @@ ARCH=ARCH
md_set_term() {
}
-md_get_msgbuf() {
- # Only want to see one boot's worth of info
- dmesg > /tmp/msgbuf
- sed -n -f /dev/stdin /tmp/msgbuf <<- OOF
- /^OpenBSD /h
- /^OpenBSD /!H
- \${
- g
- p
- }
- OOF
-}
-
-md_get_diskdevs() {
- md_get_msgbuf | egrep -a "^[sw]d[0-9]+ " | cutword 1
-}
-
-md_get_cddevs() {
- md_get_msgbuf | egrep -a "^cd[0-9]+ " | cutword 1
-}
-
md_questions() {
:
}
diff --git a/distrib/amiga/install.md b/distrib/amiga/install.md
index daf431f914f..0b4320012ff 100644
--- a/distrib/amiga/install.md
+++ b/distrib/amiga/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.17 2002/05/14 01:49:25 krw Exp $
+# $OpenBSD: install.md,v 1.18 2002/05/18 17:56:03 krw Exp $
# $NetBSD: install.md,v 1.3.2.5 1996/08/26 15:45:28 gwr Exp $
#
#
@@ -43,21 +43,12 @@
# Machine-dependent install sets
MDSETS=kernel
MDFSTYPE=ados
+MDCDDEVS="'/^a\{0,1\}cd[0-9][0-9]* /s/ .*//p'"
ARCH=ARCH
md_set_term() {
}
-md_get_diskdevs() {
- # return available disk devices
- dmesg | sed -n -e '/^[sw]d[0-9] /{s/ .*//;p;}'
-}
-
-md_get_cddevs() {
- # return available CDROM devices
- dmesg | sed -n -e '/^a\{0,1\}cd[0-9] /{s/ .*//;p;}'
-}
-
md_questions() {
:
}
diff --git a/distrib/hp300/ramdisk/install.md b/distrib/hp300/ramdisk/install.md
index e9325ef7627..8b141f43d37 100644
--- a/distrib/hp300/ramdisk/install.md
+++ b/distrib/hp300/ramdisk/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.30 2002/05/14 01:49:25 krw Exp $
+# $OpenBSD: install.md,v 1.31 2002/05/18 17:56:03 krw Exp $
# $NetBSD: install.md,v 1.1.2.4 1996/08/26 15:45:14 gwr Exp $
#
# Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -42,22 +42,13 @@
# Machine-dependent install sets
MDSETS=kernel
MDTERM=hp300h
+MDDISKDEVS="'/^hd[0-9][0-9]*:./s/:.*//p;/^sd[0-9][0-9]*:.*cylinders/s/:.*//p'"
+MDCDDEVS="'/^sd[0-9][0-9]*:.*CD-ROM/s/:.*//p'"
ARCH=ARCH
md_set_term() {
}
-md_get_diskdevs() {
- # return available disk devices
- dmesg | egrep -a "^hd[0-9]*:." | cutword -t: 1 | sort -u
- dmesg | egrep -a "^sd[0-9]*:.*cylinders" | cutword -t: 1 | sort -u
-}
-
-md_get_cddevs() {
- # return available CD-ROM devices
- dmesg | egrep -a "sd[0-9]*:.*CD-ROM" | cutword -t: 1 | sort -u
-}
-
md_questions() {
:
}
diff --git a/distrib/i386/common/install.md b/distrib/i386/common/install.md
index 8c71235a867..0087c3ef495 100644
--- a/distrib/i386/common/install.md
+++ b/distrib/i386/common/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.5 2002/05/14 01:49:25 krw Exp $
+# $OpenBSD: install.md,v 1.6 2002/05/18 17:56:03 krw Exp $
#
#
# Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -97,16 +97,6 @@ __EOT
done
}
-md_get_diskdevs() {
- # return available disk devices
- bsort `dmesg | egrep -a "^[sw]d[0-9]+ " | cutword 1`
-}
-
-md_get_cddevs() {
- # return available CDROM devices
- bsort `dmesg | egrep -a "^cd[0-9]+ " | cutword 1`
-}
-
md_questions() {
echo
ask "Do you expect to run the X Window System?" y
diff --git a/distrib/mac68k/ramdisk/install.md b/distrib/mac68k/ramdisk/install.md
index 0fa3cd1617d..297242e9abb 100644
--- a/distrib/mac68k/ramdisk/install.md
+++ b/distrib/mac68k/ramdisk/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.12 2002/05/14 01:49:25 krw Exp $
+# $OpenBSD: install.md,v 1.13 2002/05/18 17:56:03 krw Exp $
#
# Copyright (c) 2002, Miodrag Vallat.
# All rights reserved.
@@ -70,16 +70,6 @@ ARCH=ARCH
md_set_term() {
}
-md_get_diskdevs() {
- # return available disk devices
- bsort `dmesg | egrep -a "^[sw]d[0-9]+ " | cutword 1`
-}
-
-md_get_cddevs() {
- # return available CDROM devices
- bsort `dmesg | egrep -a "^cd[0-9]+ " | cutword 1`
-}
-
md_questions() {
:
}
diff --git a/distrib/macppc/ramdisk/install.md b/distrib/macppc/ramdisk/install.md
index c7f58de0eca..f09e01c0d4d 100644
--- a/distrib/macppc/ramdisk/install.md
+++ b/distrib/macppc/ramdisk/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.12 2002/05/14 01:49:25 krw Exp $
+# $OpenBSD: install.md,v 1.13 2002/05/18 17:56:03 krw Exp $
#
#
# Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -47,16 +47,6 @@ ARCH=ARCH
md_set_term() {
}
-md_get_diskdevs() {
- # return available disk devices
- bsort `dmesg | egrep -a "^[sw]d[0-9]+ " | cutword 1`
-}
-
-md_get_cddevs() {
- # return available CDROM devices
- bsort `dmesg | egrep -a "^cd[0-9]+ " | cutword 1`
-}
-
md_questions() {
echo
ask "Do you expect to run the X Window System?" y
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 0362bf6a646..b3ee46176e1 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,4 +1,4 @@
-# $OpenBSD: install.sub,v 1.221 2002/05/14 01:49:25 krw Exp $
+# $OpenBSD: install.sub,v 1.222 2002/05/18 17:56:03 krw Exp $
# $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $
#
# Copyright (c) 1997-2002 Todd Miller, Theo de Raadt, Ken Westerback
@@ -71,16 +71,16 @@
#
# The following functions must be provided:
# md_congrats() - display friendly message
-# md_get_cddevs() - return available CD-ROM devices
-# md_get_diskdevs() - return available disk devices
# md_installboot() - install boot-blocks on disk
# md_prep_disklabel() - label the root disk
# md_set_term() - set up terminal
#
# The following variables can be provided if required:
-# MDTERM - 'vt220' assumed if not provided
-# MDFSTYPE - nothing assumed if not provided
-# MDFSOPTS - nothing assumed if not provided
+# MDTERM - 'vt220' assumed if not provided
+# MDFSTYPE - nothing assumed if not provided
+# MDFSOPTS - nothing assumed if not provided
+# MDDISKDEVS - '/^[sw]d[0-9][0-9]* /s/ .*//p' assumed if not provided
+# MDCDDEVS - '/^cd[0-9][0-9]* /s/ .*//p' assumed if not provided
. install.md
set_term() {
@@ -153,6 +153,14 @@ __EOT
md_congrats
}
+get_diskdevs() {
+ bsort `sed -ne ${MDDISKDEVS:-'/^[sw]d[0-9][0-9]* /s/ .*//p'} /tmp/dmesg.boot`
+}
+
+get_cddevs() {
+ bsort `sed -ne ${MDCDDEVS:-'/^cd[0-9][0-9]* /s/ .*//p'} /tmp/dmesg.boot`
+}
+
# Ask for a password, saving the input in $resp.
# Display $1 as the prompt.
# *Don't* allow the '!' options that ask does.
@@ -2158,9 +2166,12 @@ VERSION_MAJOR=$(( $VERSION / 10 ))
VERSION_MINOR=$(( $VERSION % 10 ))
export VERSION VERSION_MAJOR VERSION_MINOR
-# Use install.md routines to get lists of devices on system
-_DKDEVS=`md_get_diskdevs`
-_CDDEVS=`md_get_cddevs`
+# Extract and save one boot's worth of dmesg
+dmesg | sed -ne '/^OpenBSD /h;/^OpenBSD /!H;${g;p;}' > /tmp/dmesg.boot
+
+# Scan /tmp/dmesg.boot for disks and cds
+_DKDEVS=`get_diskdevs`
+_CDDEVS=`get_cddevs`
# extra "site" set can be provided by person doing install or
# upgrade.
diff --git a/distrib/mvme68k/ramdisk/install.md b/distrib/mvme68k/ramdisk/install.md
index d3000cee4f4..505f7b9aaa3 100644
--- a/distrib/mvme68k/ramdisk/install.md
+++ b/distrib/mvme68k/ramdisk/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.19 2002/05/14 01:49:25 krw Exp $
+# $OpenBSD: install.md,v 1.20 2002/05/18 17:56:03 krw Exp $
# Copyright (c) 1996 The NetBSD Foundation, Inc.
# All rights reserved.
#
@@ -46,16 +46,6 @@ ARCH=ARCH
md_set_term() {
}
-md_get_diskdevs() {
- # return available disk devices
- bsort `dmesg | egrep -a "^[sw]d[0-9]+ " | cutword 1`
-}
-
-md_get_cddevs() {
- # return available CDROM devices
- bsort `dmesg | egrep -a "^cd[0-9]+ " | cutword 1`
-}
-
md_questions() {
:
}
diff --git a/distrib/mvme88k/ramdisk/install.md b/distrib/mvme88k/ramdisk/install.md
index 64c39350673..abf5ba13a4b 100644
--- a/distrib/mvme88k/ramdisk/install.md
+++ b/distrib/mvme88k/ramdisk/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.14 2002/05/14 01:49:25 krw Exp $
+# $OpenBSD: install.md,v 1.15 2002/05/18 17:56:03 krw Exp $
# Copyright (c) 1996 The NetBSD Foundation, Inc.
# All rights reserved.
#
@@ -46,14 +46,6 @@ ARCH=ARCH
md_set_term() {
}
-md_get_diskdevs() {
- dmesg | egrep -a "^sd[0-9] "
-}
-
-md_get_cddevs() {
- dmesg | egrep -a "^cd[0-9] "
-}
-
md_get_ifdevs() {
# return available network devices
dmesg | egrep "(^ie[0-9] )|(^le[0-9] )" | cut -d" " -f1 | sort -u
diff --git a/distrib/mvmeppc/ramdisk/install.md b/distrib/mvmeppc/ramdisk/install.md
index fdd14937f74..004d248efa5 100644
--- a/distrib/mvmeppc/ramdisk/install.md
+++ b/distrib/mvmeppc/ramdisk/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.11 2002/05/14 01:49:25 krw Exp $
+# $OpenBSD: install.md,v 1.12 2002/05/18 17:56:03 krw Exp $
#
#
# Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -48,16 +48,6 @@ ARCH=ARCH
md_set_term() {
}
-md_get_diskdevs() {
- # return available disk devices
- bsort `dmesg | egrep -a "^[sw]d[0-9]+ " | cutword 1`
-}
-
-md_get_cddevs() {
- # return available CDROM devices
- bsort `dmesg | egrep -a "^cd[0-9]+ " | cutword 1`
-}
-
md_questions() {
:
}
diff --git a/distrib/sparc/install.md b/distrib/sparc/install.md
index 19f00ddf229..dc129d31000 100644
--- a/distrib/sparc/install.md
+++ b/distrib/sparc/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.41 2002/05/14 01:49:25 krw Exp $
+# $OpenBSD: install.md,v 1.42 2002/05/18 17:56:03 krw Exp $
# $NetBSD: install.md,v 1.3.2.5 1996/08/26 15:45:28 gwr Exp $
#
#
@@ -43,35 +43,12 @@
# Machine-dependent install sets
MDSETS=kernel
MDTERM=sun
+MDDISKDEVS="'/^sd[0-9] /s/ .*//p;/^x[dy][0-9] /s/ .*//p'"
ARCH=ARCH
md_set_term() {
}
-md_get_msgbuf() {
- # Only want to see one boot's worth of info
- dmesg > /tmp/msgbuf
- sed -n -f /dev/stdin /tmp/msgbuf <<- OOF
- /^OpenBSD /h
- /^OpenBSD /!H
- \${
- g
- p
- }
- OOF
-}
-
-md_get_diskdevs() {
- # return available disk devices
- md_get_msgbuf | sed -n -e '/^sd[0-9] /{s/ .*//;p;}' \
- -e '/^x[dy][0-9] /{s/ .*//;p;}'
-}
-
-md_get_cddevs() {
- # return available CDROM devices
- md_get_msgbuf | sed -n -e '/^cd[0-9] /{s/ .*//;p;}'
-}
-
md_questions() {
:
}
diff --git a/distrib/sparc64/common/install.md b/distrib/sparc64/common/install.md
index 99243bd2b0e..01c892f5c8c 100644
--- a/distrib/sparc64/common/install.md
+++ b/distrib/sparc64/common/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.10 2002/05/14 01:49:25 krw Exp $
+# $OpenBSD: install.md,v 1.11 2002/05/18 17:56:03 krw Exp $
# $NetBSD: install.md,v 1.3.2.5 1996/08/26 15:45:28 gwr Exp $
#
#
@@ -48,29 +48,6 @@ ARCH=ARCH
md_set_term() {
}
-md_get_msgbuf() {
- # Only want to see one boot's worth of info
- dmesg > /tmp/msgbuf
- sed -n -f /dev/stdin /tmp/msgbuf <<- OOF
- /^OpenBSD /h
- /^OpenBSD /!H
- \${
- g
- p
- }
- OOF
-}
-
-md_get_diskdevs() {
- # return available disk devices
- md_get_msgbuf | sed -n -e '/^[sw]d[0-9] /{s/ .*//;p;}'
-}
-
-md_get_cddevs() {
- # return available CDROM devices
- md_get_msgbuf | sed -n -e '/^cd[0-9] /{s/ .*//;p;}'
-}
-
md_questions() {
echo
ask "Do you expect to run the X Window System?" y
diff --git a/distrib/sun3/install.md b/distrib/sun3/install.md
index 2ef489c8156..cfce566a5fb 100644
--- a/distrib/sun3/install.md
+++ b/distrib/sun3/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.9 2002/05/14 01:49:25 krw Exp $
+# $OpenBSD: install.md,v 1.10 2002/05/18 17:56:03 krw Exp $
#
#
# Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -42,35 +42,12 @@
# Machine-dependent install sets
MDSETS=kernel
MDTERM=sun
+MDDISKDEVS="'/^sd[0-9] /s/ .*//p;/^x[dy][0-9] /s/ .*//p'"
ARCH=ARCH
md_set_term() {
}
-md_get_msgbuf() {
- # Only want to see one boot's worth of info
- dmesg > /tmp/msgbuf
- sed -n -f /dev/stdin /tmp/msgbuf <<- OOF
- /^OpenBSD /h
- /^OpenBSD /!H
- \${
- g
- p
- }
- OOF
-}
-
-md_get_diskdevs() {
- # return available disk devices
- md_get_msgbuf | sed -n -e '/^sd[0-9] /{s/ .*//;p;}' \
- -e '/^x[dy][0-9] /{s/ .*//;p;}'
-}
-
-md_get_cddevs() {
- # return available CDROM devices
- md_get_msgbuf | sed -n -e '/^cd[0-9] /{s/ .*//;p;}'
-}
-
md_questions() {
:
}
diff --git a/distrib/vax/install.md b/distrib/vax/install.md
index 52200391b73..85234eb53d5 100644
--- a/distrib/vax/install.md
+++ b/distrib/vax/install.md
@@ -1,4 +1,4 @@
-# $OpenBSD: install.md,v 1.14 2002/05/14 01:49:25 krw Exp $
+# $OpenBSD: install.md,v 1.15 2002/05/18 17:56:03 krw Exp $
# $NetBSD: install.md,v 1.3.2.5 1996/08/26 15:45:28 gwr Exp $
#
#
@@ -43,36 +43,13 @@
# Machine-dependent install sets
MDSETS=kernel
MDTERM=vt100
+MDDISKDEVS="'/^[hs]d[0-9] /s/ .*//p;/^r[al][0-9] /s/ .*//p'"
+MDCDDEVS="'/^cd[0-9] /s/ .*//p;/^ra[0-9] .* RRD40$/s/ .*//p'"
ARCH=ARCH
md_set_term() {
}
-md_get_msgbuf() {
- # Only want to see one boot's worth of info
- dmesg > /tmp/msgbuf
- sed -n -f /dev/stdin /tmp/msgbuf <<- OOF
- /^OpenBSD /h
- /^OpenBSD /!H
- \${
- g
- p
- }
- OOF
-}
-
-md_get_diskdevs() {
- # return available disk devices
- md_get_msgbuf |sed -n -e '/^[hs]d[0-9] /{s/ .*//;p;}' \
- -e '/^r[al][0-9] /{s/ .*//;p;}'
-}
-
-md_get_cddevs() {
- # return available CDROM devices
- md_get_msgbuf | sed -n -e '/^cd[0-9] /{s/ .*//;p;}' \
- -e '/^ra[0-9] .* RRD40$/{s/ .*//;p;}'
-}
-
md_questions() {
:
}