diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /unix/hlib/util.csh/check_update | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'unix/hlib/util.csh/check_update')
-rwxr-xr-x | unix/hlib/util.csh/check_update | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/unix/hlib/util.csh/check_update b/unix/hlib/util.csh/check_update new file mode 100755 index 00000000..a26298e9 --- /dev/null +++ b/unix/hlib/util.csh/check_update @@ -0,0 +1,68 @@ +#!/bin/csh -f +# +# CHECK_UPDATE -- Check to see if an update is available. Return $status=1 +# if a patch is available. +# + +# Called from Makefile, set iraf root. +source $iraf/unix/hlib/irafuser.csh + + +set REPO = `${iraf}/util/pkgrepo` +if ($?IRAFARCH) then + set arch = $IRAFARCH +else + set arch = `${iraf}/unix/hlib/irafarch.csh -actual` +endif + + +# Check to see if a patch file is available. + +/bin/rm -f /tmp/_rdate /tmp/_pdate + +set FGET = "${iraf}/util/fget" +${FGET} -q -o /tmp/_rdate http://iraf.noao.edu/ftp/v216/PCIX/.release_date +${FGET} -q -o /tmp/_pdate http://iraf.noao.edu/ftp/v216/PCIX/.patch_release + +if (-e /tmp/_rdate) then + set rdate = `cat /tmp/_rdate` +else + echo "cannot get rdate" + exit 0 +endif +if (-e /tmp/_pdate) then + set pdate = `cat /tmp/_pdate` +else + echo "cannot get pdate" + exit 0 +endif + + +if (-e ${iraf}/.patch_release) then + set ipdate = `/bin/ls -l --time-style=+%s ${iraf}/.patch_release | \ + awk '{ print ($6) }'` +else + set ipdate = 0 +endif + +if ($#argv > 0 && "$1" == "-d") then # Debug + echo " rdate = " $rdate + echo " pdate = " $pdate + echo "ipdate = " $ipdate +endif + +if ($rdate > $pdate) then # New Release + exit 1 +endif + + +if ($pdate == 0) then + exit 0 + +else if ($pdate > $ipdate && $ipdate != 0) then # Patch newer than installed + exit 1 + +endif + + +exit 0 # No update available |