summaryrefslogtreecommitdiff
path: root/distrib/miniroot
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2009-05-28 02:34:57 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2009-05-28 02:34:57 +0000
commit6323c93e4f002e87a421fdb65776937f8f321b3b (patch)
treee91c61452b17f0da0aca0434bad156e204a9bad8 /distrib/miniroot
parentbc7582bd8baa23938fa8de0446c728775e9ca0c3 (diff)
Get the list of disks or cds whenever required rather than once at
startup. This means you can plugin USB disks or cds after the install has started and you will see the new device the next time the list is shown. The wonders of using sysctl. 'excellent' miod@
Diffstat (limited to 'distrib/miniroot')
-rw-r--r--distrib/miniroot/install.sh4
-rw-r--r--distrib/miniroot/install.sub25
2 files changed, 17 insertions, 12 deletions
diff --git a/distrib/miniroot/install.sh b/distrib/miniroot/install.sh
index b1e8b26bf3c..7740dfb5207 100644
--- a/distrib/miniroot/install.sh
+++ b/distrib/miniroot/install.sh
@@ -1,5 +1,5 @@
#!/bin/ksh
-# $OpenBSD: install.sh,v 1.189 2009/05/17 15:00:51 krw Exp $
+# $OpenBSD: install.sh,v 1.190 2009/05/28 02:34:56 krw Exp $
# $NetBSD: install.sh,v 1.5.2.8 1996/08/27 18:15:05 gwr Exp $
#
# Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback
@@ -67,7 +67,7 @@ MODE=install
cd /tmp
if [[ ! -f /etc/fstab ]]; then
DISK=
- _DKDEVS=$DKDEVS
+ _DKDEVS=$(get_dkdevs)
while :; do
_DKDEVS=$(rmel "$DISK" $_DKDEVS)
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index d08eb476c74..de0fe817d80 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,4 +1,4 @@
-# $OpenBSD: install.sub,v 1.555 2009/05/24 00:17:37 halex Exp $
+# $OpenBSD: install.sub,v 1.556 2009/05/28 02:34:56 krw Exp $
# $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $
#
# Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback
@@ -177,6 +177,14 @@ scan_disknames() {
IFS=$_oifs
}
+get_dkdevs () {
+ echo $(scan_disknames "${MDDKDEVS:-/^[sw]d[0-9][0-9]* /s/ .*//p}")
+}
+
+get_cddevs () {
+ echo $(scan_disknames "${MDCDDEVS:-/^cd[0-9][0-9]* /s/ .*//p}")
+}
+
get_ifdevs() {
ifconfig \
| egrep -v '^[[:space:]]|(bridge|enc|gif|gre|lo|pflog|pfsync|ppp|sl|tun|vlan)[[:digit:]]+:' \
@@ -1255,7 +1263,7 @@ install_mounted_fs() {
}
install_cdrom() {
- get_drive "CD-ROM" "$CDDEVS" || return
+ get_drive "CD-ROM" "$(get_cddevs)" || return
mount_mnt2 $resp || return
install_mounted_fs
@@ -1264,7 +1272,7 @@ install_cdrom() {
install_disk() {
ask_yn "Is the disk partition already mounted?"
if [[ $resp == n ]]; then
- get_drive "disk" "$DKDEVS" || return
+ get_drive "disk" "$(get_dkdevs)" || return
mount_mnt2 $resp || return
fi
@@ -1417,7 +1425,7 @@ install_sets() {
echo
- [[ -n $CDDEVS ]] && { _locs="cd $_locs" ; _d=cd ; }
+ [[ -n $(get_cddevs) ]] && { _locs="cd $_locs" ; _d=cd ; }
ifconfig netboot > /dev/null 2>&1 && _d=ftp
[[ -x /sbin/mount_nfs ]] && _locs="$_locs nfs"
[[ -n $MTDEVS && -x /bin/mt ]] && _locs="$_locs tape"
@@ -1743,7 +1751,7 @@ finish_up() {
sh MAKEDEV all
# Make sure any devices we found during probe are created in the
# installed system.
- for _dev in $DKDEVS $CDDEVS $MTDEVS; do
+ for _dev in $(get_dkdevs) $(get_cddevs) $MTDEVS ; do
sh MAKEDEV $_dev
done
)
@@ -1808,8 +1816,6 @@ CURRENT=$(scan_dmesg "/^OpenBSD $VNAME\([^ ]*\).*$/s//\1/p")
[[ -n $CURRENT ]] && FTPSETDIR=snapshots/$ARCH
# Scan /var/run/dmesg.boot for interesting devices.
-DKDEVS=$(scan_disknames "${MDDKDEVS:-/^[sw]d[0-9][0-9]* /s/ .*//p}")
-CDDEVS=$(scan_disknames "${MDCDDEVS:-/^cd[0-9][0-9]* /s/ .*//p}")
MTDEVS=$(scan_dmesg "${MDMTDEVS:-/^[cms]t[0-9][0-9]* /s/ .*//p}")
IFDEVS=$(get_ifdevs)
nifs=0
@@ -1888,10 +1894,9 @@ if [[ $MODE == install ]]; then
fi
# Get ROOTDISK, ROOTDEV and SWAPDEV.
-set -- $DKDEVS
-(( $# == 0 )) && { echo "No disks found." ; exit ; }
+[[ -n $(get_dkdevs) ]] || { echo "No disks found." ; exit ; }
-ask_which "disk" "is the root disk" "$DKDEVS"
+ask_which "disk" "is the root disk" "$(get_dkdevs)"
[[ $resp == done ]] && exit
makedev $resp || exit