#!/bin/csh -f
if ("$1" == "-h" || $1 =~ "-help") then
goto USAGE
endif
set RemoteServer = 'http://afni.nimh.nih.gov/'
set RemoteSRC = $RemoteServer'AFNI/src'
set RemoteDOC = $RemoteServer'AFNI/doc'
set MacName = `hostname -s`
if ($status) then
#maybe you're on a Natalia's SUN, try this option
set MacName = $_INIT_UTS_NODENAME
endif
#set up the desitnation, based on the machine you're using
goto SETDESTIN
goto END
GetIt:
echo "About to Update AFNI on $MacName - Hit enter to continue (ctrl+c to escape)..."
set buf = $<
#make sure target directories exist
test -d $localSRC || goto NoSRCDir
test -d $localBIN || goto NoNINDir
test -d $localDOC || goto NoDOCDir
#Get the source
if ("$localSRC" != "") then
echo "Downloading Source Code ..."
wget -x -r -l10 -nv -m -np -nH -P $localSRC --cut-dirs=2 $RemoteSRC
endif
#Backup Old version -binaries only-
if ("$localBIN" != "") then
echo "Downloading Binaries ..."
test -d $localBIN.Bak || mkdir $localBIN.Bak
cp -r $localBIN/* $localBIN.Bak
#Get the binaries
wget -x -r -l10 -nv -m -np -nH -P $localBIN --cut-dirs=3 $RemoteBIN
endif
#Get the documentation
if ("$localDOC" != "") then
echo "Downloading Documentation ..."
wget -x -r -l10 -nv -m -np -nH -P $localDOC --cut-dirs=2 $RemoteDOC
endif
goto END
SETDESTIN:
#This is a template to modfy for your own computer
if ("$MacName" == 'MY_MACHINE') then #Change MY_MACHINE to your machine name
#for MY_MACHINE
set localSRC = '' #The full path indicating where AFNI source code are to be stored
set localBIN = '' #The full path indicating where AFNI executables are to be stored
set localDOC = '' #The full path indicating where AFNI Documentation is to be stored
#The location of the AFNI executables distribution for your computer
set RemoteBIN = $RemoteServer'AFNI/bin/linux_mdk72'
goto GetIt
endif
if ("$MacName" == 'finrod') then #Change MY_MACHINE to your machine name
#for MY_MACHINE
set localSRC = '/usr/Software/AFNI98' #The full path indicating where AFNI source code are to be stored
set localBIN = '/usr/Software/AFNI98/abin' #The full path indicating where AFNI executables are to be stored
set localDOC = '/usr/Software/AFNI98/DOC' #The full path indicating where AFNI Documentation is to be stored
#The location of the AFNI executables distribution for your computer
set RemoteBIN = $RemoteServer'AFNI/bin/sgi10k_6.5'
goto GetIt
endif
if ("$MacName" == 'ashlar') then #Change MY_MACHINE to your machine name
#for MY_MACHINE
set localSRC = '/usr/local/Afni/' #The full path indicating where AFNI source code are to be stored
set localBIN = '/usr/local/Afni/abin' #The full path indicating where AFNI executables are to be stored
set localDOC = '/usr/local/Afni/DOC' #The full path indicating where AFNI Documentation is to be stored
#The location of the AFNI executables distribution for your computer
set RemoteBIN = $RemoteServer'AFNI/bin/solaris26_gcc'
goto GetIt
endif
if ("$MacName" == 'safni') then #Change MY_MACHINE to your machine name
#for safni
set localSRC = '/home/ziad/Software/AFNI98/' #The full path indicating where AFNI source code are to be stored
set localBIN = '/home/ziad/abin' #The full path indicating where AFNI executables are to be stored
set localDOC = '/home/ziad/Software/AFNI98/DOC' #The full path indicating where AFNI Documentation is to be stored
#The location of the AFNI executables distribution for your computer
set RemoteBIN = $RemoteServer'AFNI/bin/linux_mdk72'
goto GetIt
endif
if ("$MacName" == 'potassium') then
#for potassium
set localSRC = '' #The full path indicating where AFNI source code are to be stored
set localBIN = '/usr/local/abin' #The full path indicating where AFNI executables are to be stored
set localDOC = '' #The full path indicating where AFNI Documentation is to be stored
#The location of the AFNI executables distribution for your computer
set RemoteBIN = $RemoteServer'AFNI/bin/linux_mdk72'
goto GetIt
endif
if ("$MacName" == 'iodine' || "$MacName" == 'rhodium' ) then
#for iodine
set localSRC = '/home/ziad/Software/AFNI98'
set localBIN = '/home/ziad/Software/AFNI98/abin'
set localDOC = '/home/ziad/Software/AFNI98/DOC'
set RemoteBIN = $RemoteServer'AFNI/bin/linux_mdk72'
#back up my on code
@BackUpPlugs
goto GetIt
endif
if ("$MacName" == 'neon') then
#for neon
set localSRC = '/usr/people/ziad/Software/AFNI98'
set localBIN = '/usr/people/ziad/Software/AFNI98/abin'
set localDOC = '/usr/people/ziad/Software/AFNI98/DOC'
set RemoteBIN = $RemoteServer'AFNI/bin/sgi10k_6.5'
goto GetIt
endif
if ("$MacName" == 'fim2') then
#for fim2
set localSRC = '/home/jfrost/Software/AFNI98'
set localBIN = '/home/jfrost/Software/AFNI98/abin'
set localDOC = '/home/jfrost/Software/AFNI98/DOC'
set RemoteBIN = $RemoteServer'AFNI/bin/linux_mdk72'
goto GetIt
endif
goto BadMachine
BadMachine:
echo "Error: Machine $MacName not supported"
goto END
NoSRCDir:
echo "You must create the directory : $localSRC"
goto END
NoNINDir:
echo "You must create the directory : $localBIN"
goto END
NoDOCDir:
echo "You must create the directory : $localDOC"
goto END
USAGE:
echo "Usage: `basename $0`"
echo 'Updates AFNI on your computer using wget'
echo 'If you are using the program for the first time,'
echo 'you must add some info about your computer into the script'
echo 'You can easily do so by modifying the template in the block SETDESTIN.'
echo "IMPORTANT: Rename this script once you modify it. Otherwise, "
echo "it will get overwritten whenever you update your AFNI distribution."
echo "Before the update begins, executables from the current version"
echo 'are copied into $localBIN.bak directory'
echo "For more info, see:"
echo "http://afni.nimh.nih.gov/~cox/afni_wget.html"
echo "Ziad Saad (ziad@nih.gov) SSCC/NIMH/NIH, Bethesda MD USA"
goto END
END:
syntax highlighted by Code2HTML, v. 0.9.1