#!/bin/csh -f

# Change this line each term
set TOP=/afs/cs/academic/class/15349-s02

echo "*************************************"
echo "Running 15-349 login setup program..."
echo "*************************************"

set HOME=$home
set USER=$user
if (-e ${HOME}/15-349) then
    echo "There is already a file of some sort named '15-349' in your"
    echo "home directory. Rename (or delete it) and rerun the script."
else
    mkdir ${HOME}/15-349
    fs sa ${HOME}/15-349 system:campusnet rl
    echo "${USER}@ANDREW.CMU.EDU" > ${HOME}/15-349/.klogin
    cp ${TOP}/bin/simple.login ${HOME}/15-349/.login

    echo "I have created a directory '15-349' in your home directory"
    echo "and granted read access to system:campusnet. The 15-349 directory"
    echo "contains files '.klogin' and '.login', which are required to"
    echo "allow you to login to the FISH computers and authenticate to"
    echo "AFS. Do NOT store your course files in the 15-349 directory. And"
    echo "do NOT delete any files in the 15-349 directory."
    echo ""
    echo "NOTE: You must use ${USER}@andrew.cmu.edu to login to the"
    echo "FISH machines."
    echo ""
    echo "NOTE: To login, you must, at a minimum, give system:campusnet" 
    echo "lookup (l) permission in your home directory. For example,"
    echo "'fs sa -dir ~ -acl system:campusnet l'."
endif
echo ""
