summaryrefslogtreecommitdiff
path: root/distrib
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2002-11-10 01:08:34 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2002-11-10 01:08:34 +0000
commit02828fe5887e20be12558aeb22998ae9e57d7b06 (patch)
tree0d022c321b5670b22dea8ec2ae11593e3d6709c9 /distrib
parentde1d1e1cbc24d557371e6eb81461372c94b12bf9 (diff)
Fix makedev() so that if the device nodes are *not* created, makedev()
returns false, and the device is *not* added to DEVSMADE.
Diffstat (limited to 'distrib')
-rw-r--r--distrib/miniroot/install.sub37
1 files changed, 24 insertions, 13 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index 9617b1d095a..e20e259503f 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,4 +1,4 @@
-# $OpenBSD: install.sub,v 1.272 2002/11/09 06:16:06 krw Exp $
+# $OpenBSD: install.sub,v 1.273 2002/11/10 01:08:33 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
@@ -379,22 +379,33 @@ quit
__EOT
}
+# Check for the existance of the device nodes for the
+# supplied device name. If they are missing (as indicated
+# by r${1}c not being found) then create them. In either
+# case, return true if the nodes exist and false if not.
+#
+# $1 = name of the device that is about to be used.
makedev() {
- local _d=$1
+ local _dev=$1 _node=/dev/r${1}c
- # Don't need to make network interface devices.
- isin $_d $IFDEVS && return
+ # Don't need to make network interface devices nodes. If the device
+ # nodes exist, don't need to create them.
+ if isin $_dev $IFDEVS || [[ -c $_node ]] ; then
+ return 0
+ fi
- if [ ! -c /dev/r${_d}c ]; then
- if [ -r /dev/MAKEDEV ]; then
- (cd /dev; sh MAKEDEV $_d)
- DEVSMADE=`addel $_d $DEVSMADE`
- else
- echo "Device nodes for $_d are missing, and MAKEDEV"
- echo "does not exist to create them with. Sorry."
- false
- fi
+ if [[ ! -r /dev/MAKEDEV ]] ; then
+ echo "No /dev/MAKEDEV. Can't create device nodes for ${_dev}."
+ return 1
fi
+
+ (cd /dev; sh MAKEDEV $_dev)
+
+ # If the device nodes still do not exist, assume MAKEDEV issued a useful
+ # error message and return false.
+ [[ -c $_node ]] || return 1
+
+ DEVSMADE=`addel $_dev $DEVSMADE`
}
get_rootdisk() {