77 lines
2.3 KiB
Bash
Executable File
77 lines
2.3 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Start and stop diskless interface with local /unix
|
|
#
|
|
# Copyright 1988-1991 Silicon Graphics, Inc.
|
|
# All rights reserved.
|
|
#
|
|
# This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
|
|
# the contents of this file may not be disclosed to third parties, copied or
|
|
# duplicated in any form, in whole or in part, without the prior written
|
|
# permission of Silicon Graphics, Inc.
|
|
#
|
|
# RESTRICTED RIGHTS LEGEND:
|
|
# Use, duplication or disclosure by the Government is subject to restrictions
|
|
# as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
|
|
# and Computer Software clause at DFARS 252.227-7013, and/or in similar or
|
|
# successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
|
|
# rights reserved under the Copyright Laws of the United States.
|
|
|
|
# This script is for pseudo-diskless mode support.
|
|
# It keeps the local copy of the kernel in sync with the /unix provided by
|
|
# the file server.
|
|
|
|
IS_ON=/etc/chkconfig
|
|
CP=cp
|
|
|
|
if $IS_ON verbose ; then
|
|
ECHO=echo
|
|
else
|
|
ECHO=:
|
|
fi
|
|
|
|
case "$1" in
|
|
'start')
|
|
;;
|
|
'stop')
|
|
if test "`/sbin/nvram diskless 2>/dev/null`" -ne 1 -o \
|
|
"`/sbin/nvram dlif 2>/dev/null`" = ""; then
|
|
exit 0
|
|
fi
|
|
|
|
# Map the ARCS filespec (scsi(x)disk(y)rdisk(0)partition(z)) to
|
|
# the Irix filespec (/dev/dsk/dksxdysz)
|
|
PARTITION=`/sbin/nvram OSLoadPartition | \
|
|
/sbin/sed -e 's_scsi(_/dev/dsk/dks_' \
|
|
-e 's_)disk(_d_' -e 's_)rdisk(0)partition(_s_' -e 's_)__'`
|
|
|
|
# Make sure this partition is mounted
|
|
MNTPT=`/sbin/mount | /sbin/grep $PARTITION | /usr/bin/awk '{print $3}'`
|
|
if test "$MNTPT" = ""; then
|
|
$ECHO "dlif: Couldn't check local bootfile: $PARTITION is not mounted"
|
|
exit 1
|
|
else
|
|
BOOTFILE=`/sbin/nvram OSLoadFilename`
|
|
if test -x /unix.install; then
|
|
|
|
# Copy /unix.install if one exists.
|
|
$ECHO "dlif: Updating local bootfile ($MNTPT$BOOTFILE)"
|
|
$CP /unix.install $MNTPT$BOOTFILE
|
|
|
|
elif test ! -x $MNTPT$BOOTFILE; then
|
|
# Copy /unix if the local bootfile doesn't exist (which would be the case
|
|
# if we've just turned dlif on
|
|
if test -x /unix; then
|
|
$ECHO "dlif: Installing local bootfile ($MNTPT$BOOTFILE)"
|
|
$CP /unix $MNTPT$BOOTFILE
|
|
|
|
else
|
|
# Neither /unix or the local bootfile exist! This is serious, the
|
|
# machine may not be able to reboot.
|
|
echo "dlif: WARNING: Could not create local bootfile ($MNTPT$BOOTFILE)"
|
|
fi
|
|
fi
|
|
fi
|
|
;;
|
|
esac
|