#!/bin/csh -f -b
# 
#  This script sets up a machine to run the demo.  It must be
#  run prior to each run of the demo!!!  It should be run as
#  rootl.
#

#
# Please run this script as rootl
#
set reply
while (($reply != "y") && ($reply != "n"))
        echo -n "Are you running this script as rootl? [yn] "
        set reply = "$<"
end

if ($reply == "n") then
	echo "Please run this script as rootl."
	exit(-1)
endif


#
# Clean /tmp!!!
#

echo "Cleaning /tmp..."
/bin/rm -f /tmp/hdb*
/bin/rm -f /tmp/hoard*
/bin/rm -f /tmp/advice_srv*
/bin/rm -f /tmp/miss*
/bin/rm -f /tmp/command*
echo "Done cleaning /tmp."
echo ""
echo "[Hit return to continue.]"
set reply = "$<"

#
# Check the venus
#
echo ""
echo ""
echo ""
echo "Please check that this machine is running a 'good' venus."
echo "The /usr/coda/etc/venus.mre_demo on SERSE is a 'good' venus,"
echo "and this is what I used in testing the demo."
echo ""
echo "Another option, is one which Lily has setup to automatically"
echo "set the WeaklyConnected global variable in fso0.c.  You'll need"
echo "to double check that this demo still works under the new venus."
echo ""
echo "Venus should be reinit'd prior to each run of the demo."
echo ""
echo "[Hit return to continue.]"
set reply = "$<"

#
# Be paranoid
#
echo ""
echo ""
echo ""
echo "If Lu has installed the new version of cfs, make sure that"
echo "the version in /usr/coda/etc is consistent with the venus"
echo "that you chose during the DemoSetup.sh script."
echo ""
echo "[Hit return to continue.]"
set reply = "$<"


#
# Install slow, partition, and heal in /usr/coda/etc
#
echo ""
echo ""
echo ""
echo "Installing /usr/coda/bin/slow in /usr/coda/etc."
cp /usr/coda/bin/slow /usr/coda/etc
echo ""
echo "Installing /usr/coda/bin/heal in /usr/coda/etc."
cp /usr/coda/bin/heal /usr/coda/etc
echo ""
echo "Installing /usr/coda/bin/partition in /usr/coda/etc."
cp /usr/coda/bin/partition /usr/coda/etc
echo ""
echo "[Hit return to continue.]"
set reply = "$<"


#
# Install tcl/tk and the advice monitor
#
echo ""
echo ""
echo ""
echo "Please check that this machine has tcl/tk and the advice"
echo "monitor installed.  If it hasn't, then run the install.sh"
echo "script in the advice source area (or /c/u/mre/src/advice)."
echo ""
echo "[Hit return to continue.]"
set reply = "$<"

#
# Get the demo-er logged in and setup...
#
echo ""
echo ""
echo ""
echo "Log into the console of the laptop demo machine as yourself and start X."
echo ""
echo "[Hit return to continue.]"
set reply = "$<"

echo ""
echo ""
echo ""
echo "There's a bug in the tcl/tk installation in that it still"
echo "uses some files from /coda rather than /usr/coda.  I don't"
echo "have time to fix this so we're going to do a test run of"
echo "one of the tcl/tk scripts and cache the necessary files."
echo "From the machine's console, please run (as yourself):"
echo "    /usr/coda/etc/misslist /tmp/silly"
echo "Then, click on the 'Cancel' button."
echo "/coda/usr/mre/demo.wcc/vice/codaproc2.c & /usr/misc/bin/less (1)" > /tmp/silly
echo ""
echo "[Hit return to continue.]"
set reply = "$<"

echo ""
echo ""
echo ""
echo "Get coda tokens."
echo ""
echo "[Hit return to continue.]"
set reply = "$<"

echo ""
echo ""
echo ""
echo "Make two xterms..."
echo "One xterm should definitely be on the console of the machine."
echo "The other xterm should be an xtelnet from a DECstation.  Make"
echo "this xterm relatively large -- 1/2 the height of the screen."
echo "Again, the xtelnet should be as you."
echo ""
echo "[Hit return to continue.]"
set reply = "$<"

echo ""
echo ""
echo ""
echo "The laptop is now setup for the demo.  Please run the Demo"
echo "script from the second of the two xterms -- the one that may"
echo "be an xtelent.  The Demo script takes one argument -- the"
echo "hostname of the laptop machine."
echo ""
