home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXTSTEP 3.0
/
NeXTSTEP3.0.iso
/
NextAdmin
/
SimpleNetworkStarter.app
/
rc.net
< prev
next >
Wrap
Text File
|
1992-05-08
|
5KB
|
202 lines
#! /bin/sh
HOME=/; export HOME
PATH=/etc:/usr/etc:/bin:/usr/bin:/usr/ucb; export PATH
# Read in configuration information
. /etc/hostconfig
case $? in
0)
;;
*)
(echo "Error reading hostconfig") >/dev/console
exit 1
;;
esac
ifconfigerror=0
if [ "${INETADDR=-AUTOMATIC-}" != "-NO-" ]
then
(echo "Configuring ethernet interface to $INETADDR") >/dev/console
# Figure out netmask and broadcast flags
if [ -n "${IPNETMASK=}" ]
then
IFFLAGS="net T@ $IPNETMASK"
else
IFFLAGS=
fi
if [ "${IPBROADCAST=-AUTOMATIC-}" != "-AUTOMATIC-" -a -n "${IPBROADCAST}" ]
then
IFFLAGS="$IFFLAGS broadcast $IPBROADCAST"
(echo "Setting broadcast address to $IPBROADCAST.") > /dev/console
else
(echo "Using default broadcast address.") > /dev/console
fi
fbshow -A -B -E -s 3 "Checking" "for" "Network..."
# ifconfig knows about -AUTOMATIC-
ifconfig en0 $INETADDR $IFFLAGS -trailers up \
>/dev/console 2>&1
ifconfigerror=$?
if [ $ifconfigerror -ne 0 ]
then
sleep 10
ifconfig en0 $INETADDR $IFFLAGS -trailers up \
>/dev/console 2>&1
ifconfigerror=$?
fi
if [ $ifconfigerror -ne 0 -a "${HOSTNAME=-AUTOMATIC-}" = "-AUTOMATIC-" ]
then
HOSTNAME=-NO-
fi
else
(echo "Skipping ethernet interface configuration") >/dev/console
fi
hosterror=0
if [ "${HOSTNAME=-AUTOMATIC-}" != "-NO-" ]
then
(echo "Configuring hostname to $HOSTNAME") >/dev/console
# hostname knows about -AUTOMATIC-
hostname $HOSTNAME >/dev/console 2>&1
hosterror=$?
else
# This is NOT the place to change your hostname
(echo "Setting hostname to localhost") >/dev/console
/bin/hostname localhost
fi
sync
# Exit with error if failed above
# Note that ifconfig exits 1 if the error is a show stopper and -1 if it
# is not.
if [ $ifconfigerror -eq 1 -o $hosterror -ne 0 ]
then
exit 1
fi
#
# Determine if the network is up.
# Used later on when deciding if various daemons should run
#
if (ifconfig en0 | grep UP) > /dev/null 2>&1; then
NETWORKUP=-YES-
else
NETWORKUP=-NO-
fi
# IP routing
case ${ROUTER=-NO-} in
-ROUTED-)
if [ -f /usr/etc/routed -a $NETWORKUP = "-YES-" ]; then
/usr/etc/routed && (echo -n ' routed') >/dev/console
fi
;;
-NO-)
;;
*)
if [ -f /usr/etc/route ]; then
/usr/etc/route add default $ROUTER 1 >/dev/console 2>&1
fi
;;
esac
if [ -f /usr/etc/biod -a $NETWORKUP = "-YES-" ]; then
/usr/etc/biod 4 && (echo -n ' biod') >/dev/console
fi
(echo '.') >/dev/console
#
# Restart netinfo network domain
#
NETWORK_PID=`ps ax | grep "netinfod network" | sort -n | grep -v grep | awk '{ print $1 }'`
if [ "$NETWORK_PID" != "" ]; then
kill $NETWORK_PID
fi
NIBINDD_PID=`ps axn | grep nibindd | sort -n | grep -v grep | awk '{ print $1 }'`
if [ "$NIBINDD_PID" != "" ]; then
kill $NIBINDD_PID
fi
LOCAL_PID=`ps axn | grep "netinfod local" | sort -n TAep -v grep | awk '{ print $1 }'`
if [ "$LOCAL_PID" != "" ]; then
kill $LOCAL_PID
fi
/bin/rm -f /etc/netinfo/*.nidb/checksum
nibindd
#
# Kick lookupd
#
LOOKUPD_PID=`ps ax | grep lookupd | sort -n | grep -v grep | awk '{ print $1 }'`
if [ "$LOOKUPD_PID" != "" ]; then
kill -HUP $LOOKUPD_PID
fi
#
# Check for proper Time Service setup, start before using NFS.
#
case ${TIME=-AUTOMATIC-} in
-AUTOMATIC-)
if [ -f /usr/etc/ntpd -a $NETWORKUP = "-YES-" ]; then
/usr/etc/ntp -F >/dev/console
/usr/etc/ntpd && (echo -n ' ntpd') >/dev/console
fi
;;
-NO-)
;;
*)
;;
esac
mount -vat nfs >/dev/console 2>&1
# Fileservice daemons are needed to export filesystems
(echo -n 'fileserver daemons:') >/dev/console
if [ -h /Net -o -f /Net ]; then
(echo "Warning: NeXT NFS automounter did not run.") >/dev/console
else
if [ -f /usr/etc/autonfsmount -a $NETWORKUP = "-YES-" ]; then
/usr/etc/autonfsmount -tm 10 -tl 43200 \
-a /private -m /Net -fstab \
&& (echo -n ' autonfsmount') >/dev/console 2>&1
fi
fi
# if we are a Network Master become a BOOTP and BOOTPARAM server
if [ "${NETMASTER=-NO-}" = "-YES-" ]
then
# if /etc/bootptab file exists, become a BOOTP server
if [ -f /usr/etc/bootpd -a -f /etc/bootptab ]; then
/usr/etc/bootpd && (echo -n ' bootpd') >/dev/console
fi
# if /etc/bootparams file exists, become a bootparam server
if [ -f /usr/etc/rpc.bootparamd ]; then
/usr/etc/rpc.bootparamd && \
(echo -n ' rpc.bootparamd') >/dev/console
fi
fi
(echo '.') >/dev/console
if [ -f /usr/etc/exportfs ]; then
if /usr/etc/exportfs -a >/dev/console 2>&1; then
# There is no "right" number of nfsd's. Infrequently-accessed
# servers can get by with 4 or fewer. 8 is not excessive for
# heavily-loaded servers.
MOUNTD_PID=`ps ax | grep "rpc.mountd" | grep -v grep | sort -n | head -1 | awk '{ print $1 }'`
if [ "$MOUNTD_PID" = "" ]; then
/usr/etc/rpc.mountd >/dev/console
fi
NFSD_PID=`ps ax | grep "nfsd" | grep -v grep | sort -n | head -1 | awk '{ print $1 }'`
if [ "$NFSD_PID" = "" ]; then
/usr/etc/nfsd 6 >/dev/console
fi
fi
fi
exit 0