aboutsummaryrefslogtreecommitdiff
path: root/util/iraf_latest
blob: 324621133d725103f28743bcdc849889e8d1e2fc (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
#
#  IRAF_LATEST - Update the system with the latest distribution files.


opt="all"


if (( $#<1 )); then
    /bin/echo "Usage:  iraf_latest <opt>"
    exit 0
else
    opt=$1
fi

# Initialize the $iraf and environment.
if [ -z "$iraf" ]; then
  if [ -e "$HOME/.iraf/setup.sh" ]; then
    source $HOME/.iraf/setup.sh
  else
    source unix/hlib/setup.sh
  fi
else
    source $iraf/unix/hlib/setup.sh
fi


# Called from Makefile, set iraf root.
if [ -e $iraf/unix/hlib/irafuser.sh ]; then
    source $iraf/unix/hlib/irafuser.sh
fi

echo '$iraf is '$iraf


REPO=`${iraf}/util/pkgrepo`
if [ -n "$IRAFARCH" ]; then
    arch=$IRAFARCH
else
    arch=`${iraf}/unix/hlib/irafarch.sh -actual`
fi


#/bin/echo "iraf_latest: cwd = " `pwd`

# Figure out which binaries are required.
files="patch-src.tar.gz"			# always need the source ....
bins=""
archs=("linux" "linux64" "macosx" "macintel")
for b in ${archs[@]} ; do
    if [ -e "bin.$b/x_images.e" ]; then
	bins=`/bin/echo $bins " " $b`
	case "$b" in
	"linux")
	    files=`/bin/echo "$files patch.lnux.x86.tar.gz"`
	    ;;
	"linux64")
	    files=`/bin/echo "$files patch.lnux.x86_64.tar.gz"`
	    ;;
	"macosx")
	    files=`/bin/echo "$files patch.macx.x86.tar.gz"`
	    ;;
	"macintel")
	    files=`/bin/echo "$files patch.macx.x86_64.tar.gz"`
	    ;;
	esac
    fi
done
/bin/echo "Updating binaries:  " $bins


# Download the needed files to /tmp

FGET="${iraf}/util/fget"
REPO=`${iraf}/util/pkgrepo`
for f in ${files[@]} ; do
    /bin/echo -n "Downloading: $f"
    ${FGET} -q -d /tmp/ $REPO/$f

    if [ ! -e /tmp/$f ]; then
	/bin/echo ""
	/bin/echo "Error: file $REPO/$f not found, quitting"
	exit 1
    elif [ -z /tmp/$f ]; then
	/bin/echo ""
	/bin/echo "Error downloading $REPO/$f, quitting"
	exit 1
    fi

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

    /bin/echo    " Done."
done


#  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
    /bin/echo "Update all external packages ..."
    (cd extern ; make update)
  fi
else
    /bin/echo "Unknown option '"$opt"'"
    exit 1
fi

/bin/echo ""
exit 0