Metropoli BBS
VIEWER: install.csa6400 MODE: TEXT (ASCII)
#       @(#) install.csa6400 1.0 04/25/94
#
#       Copyright (C) CMD Technology, Inc. 1993-1994 
#
#

PATH=/bin:/usr/bin:/etc
TMP=/tmp
CONFDIR=/etc/conf/cf.d
NODEDIR=/etc/conf/cf.d
PACKDHD=/etc/conf/pack.d/hd
UINSTD=/usr/lib/custom
SDEVICED=/etc/conf/sdevice.d

#
: ${OK=0} ${FAIL=1} ${TRUE=0} ${FALSE=1}

# Function definitions

cleanup() 
{
        rm -rf $tmp*
				exit $1
}

# usage: safecopy file1 file2
# copies file1 to file2 without chance of interruption

safecopy() 
{
        trap "" 1 2 3 15
        cp $1 $2
        trap 1 2 3 15
}


# usage: setbootstring
# sets DEFBOOTSTR

setbootstring() 
{
	sed -e 's;hd(40)unix;hd(40)unix hd=clbi0;' < /etc/default/boot > /tmp/boot.$$
	mv /tmp/boot.$$ /etc/default/boot
}


#
#   MAIN()
#

trap 'cleanup $FAIL' 1 2 3 15
setbootstring
rm -f $UINSTD/PCI640x.conf
grep "wd\	" $CONFDIR/mdevice > $UINSTD/PCI640x.conf
grep "wd0" $CONFDIR/mdevice >> $UINSTD/PCI640x.conf
grep "wd1" $CONFDIR/mdevice >> $UINSTD/PCI640x.conf
cat $CONFDIR/mdevice $CONFDIR/Master > $TMP/mdevice.new
safecopy $TMP/mdevice.new $CONFDIR/mdevice
grep -v "wd\	" $CONFDIR/mdevice > $TMP/mdevice.new
safecopy $TMP/mdevice.new $CONFDIR/mdevice
grep -v "wd0" $CONFDIR/mdevice > $TMP/mdevice.new
safecopy $TMP/mdevice.new $CONFDIR/mdevice
grep -v "wd1" $CONFDIR/mdevice > $TMP/mdevice.new
safecopy $TMP/mdevice.new $CONFDIR/mdevice
sed -e 's;Y;N;' < $SDEVICED/wd > $TMP/wd.new
safecopy $TMP/wd.new $SDEVICED/wd
if [ -f $SDEVICED/wd0 ] 
then
	sed -e 's;Y;N;' < $SDEVICED/wd0 > $TMP/wd0.new
	safecopy $TMP/wd0.new $SDEVICED/wd0
	sed -e 's;wd0;clbi0;g' < $PACKDHD/space.c > $TMP/space.new
	sed -e 's;Y;N;' < $SDEVICED/wd1 > $TMP/wd1.new
	safecopy $TMP/wd1.new $SDEVICED/wd1
	safecopy $TMP/space.new $PACKDHD/space.c
	if [ -f $NODEDIR/wd1 ]; then
		sed -e 's;wd1;clbi1;g' < $NODEDIR/wd1 > $NODEDIR/clbi1
		safecopy $NODEDIR/wd1 $UINSTD/wd1.node
	fi
else
	sed -e 's;wd;clbi0;g' < $PACKDHD/space.c > $TMP/space.new
	safecopy $TMP/space.new $PACKDHD/space.c
fi
#
rm -f $TMP/*.new
cd $CONFDIR
./link_unix

exit $OK
[ RETURN TO DIRECTORY ]