#!/bin/tcsh -f ############################## # Keep this next line in script # AFNI_RUNME_COOKIE ############################## echo "" echo "This is going to:" echo " 1. get updated FATCAT_DEMO/Do scripts" echo " 2. get updated suma and 3dTrackID binaries" echo " 3. get an updated suma.pdf handout" echo " 4. actuall run the FATCAT_DEMO/Do_00 script" echo "" echo "starting after 10 second nap..." sleep 10 set get_file = fatcat.updates.tgz set fatdir = FATCAT_DEMO set fatback = $fatdir/backup.Do set get_progs = ( suma 3dTrackID ) set datadir = AFNI_demos # find $datadir or quit (we start in tmp dir) cd .. set cdir = `pwd` # locate $datadir and enter it if ( -d $datadir ) then echo "-- entering $datadir, ready" cd $datadir else if ( $cdir:t == $datadir ) then echo "-- in $datadir, ready" else if ( $cdir:h:t == $datadir ) then echo "-- 1 under $datadir, going up" cd .. else if ( $cdir:h:h:t == $datadir ) then echo "-- 2 under $datadir, going up" cd ../.. else if ( -d $HOME/$datadir ) then echo "-- found $datadir under HOME, going in" cd $HOME/$datadir else echo "** cannot find $datadir, please go there and re-run" exit endif # make sure fatcat is here if ( ! -d $fatdir ) then echo "** missing $fatdir under $datadir" exit endif # nuke old copy, if it exists if ( -f $get_file || -d $get_file:r ) then echo "-- removing old $get_file..." \rm -fr $get_file $get_file:r endif # get fatcat files echo "-- getting $get_file..." curl -OfS http://afni.nimh.nih.gov/pub/dist/edu/data/$get_file if ( $status || ! -f $get_file || -z $get_file ) then echo "** failed to get $get_file" exit endif echo "-- extracting $get_file ..." tar xfz $get_file if ( $status || ! -d $get_file:r ) then echo "** failed to extract $get_file" exit endif # get rid of tgz extension set get_file = $get_file:r echo "-- have $get_file files, ready to copy" \rm $get_file.tgz # back up old files set f1 = Do_01_RUNdti_convert_grads.tcsh if ( -d $fatback ) then echo "-- $fatback dir exists, not making new backup" else if ( -f $fatdir/$f1 ) then echo "-- backing up files to $fatback" mkdir $fatback cp -p $fatdir/Do* $fatback else echo "** missing files to back up, but continuing..." endif cmp -s $get_file/$f1 $fatdir/$f1 if ( $status ) then echo "-- updating files..." \cp -p $get_file/* $fatdir echo "-- FATCAT was updated" else echo "-- FATCAT scripts are current" endif echo "\n" echo "NEXT: will update afni programs $get_progs" @update.afni.binaries -prog_list $get_progs set get_file = suma.pdf echo "NEXT: will update $get_file" curl -OfS http://afni.nimh.nih.gov/pub/dist/edu/data/CD.expanded/afni_handouts/$get_file if ( $status || ! -f $get_file || -z $get_file ) then echo "** failed to get $get_file" exit endif set hdir = ../../afni_handouts if ( ! -d $hdir ) set hdir = ~/afni_handouts if ( -d $hdir ) then echo "-- copying $get_file to $hdir..." \cp -p $get_file $hdir else echo "-- cannot find afni_handouts, copying $get_file to HOME" \cp -p $get_file ~ endif sleep 5 echo "NEXT: will run Do script..." sleep 5 cd $fatdir tcsh Do_00_PRESTO_ALL_RUNS.tcsh echo "\nupdate complete\n"