aboutsummaryrefslogtreecommitdiff
path: root/unix/hlib/util.csh/iraf_latest
blob: dfde78937009fdc8e68b7137478aeb1f6267b4ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/csh -f
#
#  IRAF_LATEST - Update the system with the latest distribution files.

unalias 	grep ls

set opt		= "all"


if ($#argv < 1) then
    echo "Usage:  iraf_latest <opt>"
    exit 0
else
    set opt = $1
endif


# Called from Makefile, set iraf root.
set  iraf       = $cwd/			
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


echo "iraf_latest: cwd = " $cwd

# Figure out which binaries are required.
set files = "patch-src.tar.gz"			# always need the source ....
set bins = ""
foreach b (linux linux64 macosx macintel)
    if (-e "bin.$b/x_images.e") then
	set bins = `echo $bins " " $b`
	switch ($b)
	case linux:
	    set files = `echo "$files patch.lnux.x86.tar.gz"`
	    breaksw
	case linux64:
	    set files = `echo "$files patch.lnux.x86_64.tar.gz"`
	    breaksw
	case macosx:
	    set files = `echo "$files patch.macx.uni.tar.gz"`
	    breaksw
	case macintel:
	    set files = `echo "$files patch.macx.x86_64.tar.gz"`
	    breaksw
	endsw
    endif
end
echo "Updating binaries:  " $bins


# Download the needed files to /tmp

set FGET        = "${iraf}/util/fget"
set REPO	= `util/pkgrepo`
foreach f ($files)
    echo -n "Downloading: $f"
    ${FGET} -q -d /tmp/ $REPO/$f
    if (! (-e /tmp/$f)) then
	echo ""
	echo "Error downloading $REPO/$f, quitting"
	exit
    endif

    echo -n " Unpacking ..."
    tar zxf /tmp/$f
    /bin/rm -f /tmp/$f

    echo    " Done."
end


#  For the initial release, the update procedures haven't yet been defined.
#  This script will be replaced by the working version at the first release.


if ($opt == "all") then				# Update everything
  if (-e extern/.installed) then
    echo "Update all external packages ..."
    (chdir extern ; make update)
  endif
endif

echo ""
exit 0