#! /bin/csh
#
# Script for installation of SNePS-2.1
# Depends on the following parameters:

set parent_dir = $1
set clisp = `basename $2`
set installer = $3

set temp_actual = `dereflink $parent_dir Temp`
set dist_actual = `dereflink $parent_dir Dist`

cd $parent_dir/Temp

if (`fgrep -c "End of SNePS" $parent_dir/Temp/Logs/$clisp-compilation.log` \
     >= 1) then
   # All went well, swap the links
   echo Updating protection bits...
   chmod -R ugo+rX *
   chmod -R go-w *
   echo Swapping links...
   cd $parent_dir
   "rm" -f Dist
   ln -s $temp_actual ./Dist
   "rm" -f Temp
   ln -s $dist_actual ./Temp
   echo . | mail -s "SNePS-2.1 installed on $HOST" $installer
else
   # it bombed somewhere
   echo . | mail -s "SNePS-2.1 installation on $HOST bombed" $installer
endif

