summaryrefslogtreecommitdiffstats
path: root/etc/rc.initdiskless
diff options
context:
space:
mode:
authorgordon <gordon@FreeBSD.org>2002-07-18 05:00:17 +0000
committergordon <gordon@FreeBSD.org>2002-07-18 05:00:17 +0000
commit259601fa05ee9132dd014304b820ec38b47a67e4 (patch)
tree375610a72b2ea83aa73c7881302e5615e9cb7552 /etc/rc.initdiskless
parentc8703a911ad83b0f513197689a88ec949871f7ea (diff)
downloadFreeBSD-src-259601fa05ee9132dd014304b820ec38b47a67e4.zip
FreeBSD-src-259601fa05ee9132dd014304b820ec38b47a67e4.tar.gz
Merge in all the changes that Mike Makonnen has been maintaining for a
while. This is only the script pieces, the glue for the build comes next. Submitted by: Mike Makonnen <makonnen@pacbell.net> Reviewed by: silence on -current and -hackers Prodded by: rwatson
Diffstat (limited to 'etc/rc.initdiskless')
-rw-r--r--etc/rc.initdiskless39
1 files changed, 19 insertions, 20 deletions
diff --git a/etc/rc.initdiskless b/etc/rc.initdiskless
index 4eb37fa..1b72009 100644
--- a/etc/rc.initdiskless
+++ b/etc/rc.initdiskless
@@ -1,3 +1,5 @@
+#!/bin/sh
+#
# Copyright (c) 1999 Matt Dillion
# All rights reserved.
#
@@ -25,8 +27,12 @@
# $FreeBSD$
#
-#
-# /etc/rc.diskless1 - general BOOTP startup
+# PROVIDE: initdiskless
+# KEYWORD: FreeBSD
+
+dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
+[ ${dlv:=0} -eq 0 ] && exit 0
+
#
# BOOTP has mounted / for us. Assume a read-only mount. We must then
# - figure out our IP by querying the interface
@@ -46,7 +52,8 @@
# checks error code and drops into shell on failure.
# if shell exits, terminates script as well as /etc/rc.
#
-chkerr() {
+chkerr()
+{
case $1 in
0)
;;
@@ -58,7 +65,8 @@ chkerr() {
esac
}
-mount_md() {
+mount_md()
+{
/sbin/mdconfig -a -t malloc -s $1 -u $3
/sbin/disklabel -r -w md$3 auto
/sbin/newfs /dev/md$3c
@@ -93,8 +101,8 @@ done
echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
if [ -z "`hostname -s`" ]; then
- hostname=`kenv dhcp.host-name`
- hostname $hostname
+ hostname=`kenv dhcp.host-name`
+ hostname $hostname
echo "Hostname is $hostname"
fi
@@ -126,19 +134,10 @@ done
# build the resolv.conf
#
if [ ! -e /etc/resolv.conf ]; then
- echo domain `kenv dhcp.domain-name` > /etc/resolv.conf
+ echo domain `kenv dhcp.domain-name` > /etc/resolv.conf
- set `kenv dhcp.domain-name-servers`
- for ns in `IFS=','; echo $*`; do
- echo nameserver $ns >> /etc/resolv.conf;
- done
+ set `kenv dhcp.domain-name-servers`
+ for ns in `IFS=','; echo $*`; do
+ echo nameserver $ns >> /etc/resolv.conf;
+ done
fi
-
-# Tell /etc/rc to run the specified script after it does its mounts but
-# before it does anything else.
-#
-# This script is responsible for setting up the diskless mount environment.
-# This can be overriden by /conf/ME/rc.conf.local if, for example, you do not
-# want to run the standard system /etc/rc.diskless2
-
-diskless_mount="/etc/rc.diskless2"
OpenPOWER on IntegriCloud