summaryrefslogtreecommitdiff
path: root/distrib/miniroot
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-09-28 12:34:07 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-09-28 12:34:07 +0000
commit1867f0481ae9c390bfabc4d81443696e01e4add0 (patch)
treec88b0a8ca2b33937c2171d6491690de2ce0bf710 /distrib/miniroot
parent238d66c89238e3dc80ee4f49eaddea35d0987ae8 (diff)
nfs root patches; todd@
Diffstat (limited to 'distrib/miniroot')
-rw-r--r--distrib/miniroot/install.sh91
-rw-r--r--distrib/miniroot/install.sub14
2 files changed, 80 insertions, 25 deletions
diff --git a/distrib/miniroot/install.sh b/distrib/miniroot/install.sh
index 7225c5415ca..77fa9d6dad2 100644
--- a/distrib/miniroot/install.sh
+++ b/distrib/miniroot/install.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $OpenBSD: install.sh,v 1.33 1998/09/26 21:41:23 deraadt Exp $
+# $OpenBSD: install.sh,v 1.34 1998/09/28 12:34:06 deraadt Exp $
# $NetBSD: install.sh,v 1.5.2.8 1996/08/27 18:15:05 gwr Exp $
#
# Copyright (c) 1997,1998 Todd Miller, Theo de Raadt
@@ -159,8 +159,10 @@ if [ "`df /`" = "`df /mnt`" ]; then
getrootdisk
done
DISK=$ROOTDISK
+ iter=ROOT
else
DISK=""
+ iter=""
while [ "X${DISK}" = "X" ]; do
getanotherdisk
done
@@ -169,6 +171,7 @@ if [ "`df /`" = "`df /mnt`" ]; then
fi
fi
+ if [ "${DISK}" != "nfs" ]; then
# Deal with disklabels, including editing the root disklabel
# and labeling additional disks. This is machine-dependent since
# some platforms may not be able to provide this functionality.
@@ -185,7 +188,7 @@ You will be prompted for the mount point (full path, including the prepending
partition or "done" when you are finished.
__get_filesystems_1
- if [ "${DISK}" = "${ROOTDISK}" ]; then
+ if [ "${DISK}" = "${ROOTDISK}" -a "${ROOTDISK}" != "nfs"]; then
echo
echo "The following partitions will be used for the root filesystem and swap:"
echo " ${ROOTDISK}a /"
@@ -247,6 +250,47 @@ __get_filesystems_1
fi
_i=$(( ${_i} + 1 ))
done
+ else # above was for non nfs, this is nfs
+ while :; do
+ echo -n "nfs server: [$_nfs_server] "
+ getresp "$_nfs_server"
+ if [ "X$resp" = "X" ]; then
+ continue
+ fi
+ _nfs_server="$resp"
+ break
+ done
+ while :; do
+ echo -n "subdir on nfs server: [$_nfs_dir] "
+ getresp "$_nfs_dir"
+ if [ "X$resp" = "X" ]; then
+ continue
+ fi
+ _nfs_dir="$resp"
+ break
+ done
+ # Get the mount point from the user
+ while : ; do
+ if [ "${iter}" = "ROOT" ]; then
+ _mp="/"
+ break
+ fi
+ echo -n "Mount point for ${_nfs_server}:${_nfs_dir} [$_mp, RET, none, or done]? "
+ getresp "$_mp"
+ case "X${resp}" in
+ X/*) _mp=$resp
+ break ;;
+ Xdone|X)
+ break ;;
+ Xnone) _mp=
+ break;;
+ *) echo "mount point must be an absolute path!";;
+ esac
+ done
+ if [ -n "${_mp}" ]; then
+ echo "${_nfs_server}:${_nfs_dir} ${_mp}" >> ${FILESYSTEMS}
+ fi
+ fi
done
echo ""
@@ -267,15 +311,20 @@ __get_filesystems_1
esac
echo
echo "============================================================"
+ tmpfslist=""
+ while read _device_name _junk; do
+ # nfs is special
+ if [ "`echo $_device_name|sed '/^[^ ]*:/!d'`" ]; then
+ continue
+ fi
+ tmpfslist="${tmpfslist} ${_device_name}"
+ done < ${FILESYSTEMS}
+
+ # if it is all spaces aka all nfs
+ if [ "X${tmpfslist## *}" != "X" ]; then
+
echo "The next step will overwrite any existing data on:"
- (
- echo -n " "
- while read _device_name _junk; do
- echo -n "${_device_name} "
- done
- echo ""
- ) < ${FILESYSTEMS}
- echo ""
+ echo " ${tmpfslist}"
echo -n "Are you really sure that you're ready to proceed? [n] "
getresp "n"
@@ -290,11 +339,12 @@ __get_filesystems_1
# Loop though the file, place filesystems on each device.
echo "Creating filesystems..."
- (
- while read _device_name _junk; do
- newfs /dev/r${_device_name}
- done
- ) < ${FILESYSTEMS}
+
+ for _device_name in ${tmpfslist}; do
+ newfs /dev/r${_device_name}
+ done
+
+ fi # if [ "${tmpfslist...
else
# Get the root device
ROOTDISK=`df /mnt | sed -e '/^\//!d' -e 's/\/dev\/\([^ ]*\)[a-p] .*/\1/'`
@@ -463,6 +513,12 @@ if [ "`df /`" = "`df /mnt`" ]; then
# fstab.
(
while read _dev _mp; do
+ # nfs is special
+ if [ "`echo $_dev|sed '/^[^ ]*:/!d'`" ]; then
+ echo $_dev $_mp nfs rw 0 0
+ continue
+ fi
+
if [ "$_mp" = "/" ]; then
echo /dev/$_dev $_mp ffs rw 1 1
else
@@ -577,8 +633,9 @@ else
echo "done."
fi
-
-md_installboot ${ROOTDISK}
+if [ "${ROOTDISK}" != "nfs" ]; then
+ md_installboot ${ROOTDISK}
+fi
if [ ! -x /mnt/dev/MAKEDEV ]; then
echo "No /dev/MAKEDEV installed, something is wrong here..."
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index a885c5a49ee..d3867186022 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,5 +1,5 @@
#!/bin/sh
-# $OpenBSD: install.sub,v 1.97 1998/09/24 21:55:08 deraadt Exp $
+# $OpenBSD: install.sub,v 1.98 1998/09/28 12:34:06 deraadt Exp $
# $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $
#
# Copyright (c) 1997,1998 Todd Miller, Theo de Raadt
@@ -129,7 +129,7 @@ isin() {
if [ "$_a" = "$1" ]; then return 0; fi
shift
done
- return 1
+ return
}
addel() {
@@ -363,14 +363,12 @@ Now you can select another disk to initialize. (Do not re-select a disk
you have already entered information for). Available disks are:
__getanotherdisk_1
- _DKDEVS=`md_get_diskdevs`
+ _DKDEVS=`md_get_diskdevs; echo nfs`
echo "$_DKDEVS"
echo ""
echo -n "Which one? [done] "
getresp ""
- if [ "X${resp}" = "X" ]; then
- DISK=done
- elif [ "X${resp}" = "Xdone" ]; then
+ if [ "X${resp}" = "X" -o "X${resp}" = "Xdone" ]; then
DISK=done
elif isin $resp $_DKDEVS ; then
DISK="$resp"
@@ -392,7 +390,7 @@ Available disks are:
__getrootdisk_1
local _defdsk;
- _DKDEVS=`md_get_diskdevs`
+ _DKDEVS=`md_get_diskdevs; echo nfs`
_defdsk=`echo $_DKDEVS | cutlast`
if [ "${_defdsk}" != "${_DKDEVS}" ]; then
_defdsk=""
@@ -1601,7 +1599,7 @@ mkdir /mnt2 > /dev/null 2>&1
if ! mount_nfs $_nfs_tcp ${_nfs_server_ip}:${_nfs_server_path} \
/mnt2 ; then
echo "Cannot mount NFS server. Aborting."
- return
+ return 1
fi
# Get the directory where the file lives