#!/bin/csh
#
# ys_install.increm
# perform incremental backup of ys tree using incremental tar file:
# 
# S.L.Freeland 
# SLF 27-Oct-1993 (proto - will call / include in ys_install when tested)
# SLF 28-Oct-1993 (remove 't' qualifier from tar, rm increm when finished)
# SLF  3-Nov-1993 (linked it to ys_install - lots of associated refinements)
#
if (!($?ys)) then
   echo Need to run Yohkoh startup or define ys, exiting
   exit
endif

set host=`hostname`
set ysver=`$ys/gen/script/get_ysversion`
cd $ys/swmaint/tar
set ftpinc = $ys/site/script/getinc.ftp
echo
echo Generating ftp transfer script
#### build ftp script
echo open 133.74.8.100 	 >  $ftpinc
echo user ftp $host	 >> $ftpinc
echo binary		 >> $ftpinc
echo cd pub/swmaint/tar	 >> $ftpinc
echo get increm.$ysver.Z >> $ftpinc
echo bye		 >> $ftpinc
####

echo " "
echo Starting ftp transfer of increm.$ysver.Z
ftp -in < $ftpinc 
if (!(-e increm.$ysver.Z)) then
   echo Problem with ftp transfer, exiting
   exit
endif

echo " "
echo Uncompressing file increm.$ysver.Z
uncompress -f $ys/swmaint/tar/increm.$ysver.Z
#
# incremental paths are relative to $ys, so move there
cd $ys
echo " "
echo Starting tar extraction of increm.$ysver
tar -xf $ys/swmaint/tar/increm.$ysver 
#
echo " "
if ($?yssw_remove) then
   if ($yssw_remove == "1") then 
      echo Removing tar file $ys/swmaint/tar/increm.$ysver
      rm -f $ys/swmaint/tar/increm.$ysver
   endif
endif
#
echo " " 
echo Upgrade complete
setenv yssw_incremok 1
exit
