#! /bin/csh -f
#
#  manybodybootstrap.csh: bootstrapping manybody.org software modules 
#  (takes about 11' to run on a P600 linux laptop)
#
#   1-dec-2001		Created				Peter Teuben
#
#

#  NOTE ::  if you have a local repository, set 'cvsdir' to the correct local directory
#           else it will just use anonymous CVS
#	    exit your username if you have a real name that allows write access too
set cvsdir=/home/cvsroot
set cvsuser=anonymous
#                                       note: the order of modules may be important
set modules=(starlab partiview nemo)

# -- should be no need to change anything below this -- 

#	parse command line options
foreach _a ($*)
  set $_a
end

if (-d $cvsdir) then
  setenv CVSROOT :local:/home/cvsroot/
else
  setenv CVSROOT :pserver:$cvsuser@cvs.astro.umd.edu:/home/cvsroot
  if (-e ~/.cvspass) then
    grep -s :pserver:$cvsuser@cvs.astro.umd.edu:/home/cvsroot ~/.cvspass
    set ask=$status
  else
    set ask=1
  endif
  if ($ask) then
    echo ""
    echo You will now be prompted for your $cvsuser password
    echo Note that the anonymous password is blank, just hit ENTER
    echo the guest password is guest, the rest will have write access
    echo ""
    cvs login
  endif
endif

#  checkout modules (in quiet mode)

set done=()
foreach module ($modules)
  echo "==============================================================================="
  echo "CVS: Checkout out module $module from $CVSROOT"
  cvs -Q checkout $module
  cd $module
  source AAA_SOURCE_ME
  cd ..
  set done=($done $module)
end

# 
mv partiview/src/partiview $STARLAB/bin
#

set rc=manybody_start

if (! -e $rc) then
  echo "source $STARLAB_PATH/starlab_start" >> $rc
  echo "source $NEMO/nemo_start"            >> $rc
else
  echo Warning: $rc already existed, did not overwrite it
endif

