aboutsummaryrefslogtreecommitdiff
path: root/unix/hlib/util.csh/iraf_update
blob: f43ede90d7da910e7a86f6986aec8301ed29fa12 (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
#!/bin/csh -f
#
#  IRAF_UPDATE - Update the core IRAF system with a cumulative patch.

unalias 	grep ls

set opt		= "all"
set all		= yes
set src_only	= no
set list_only	= no
set core_only	= no
set noao_only	= no
set vo_only	= no

if ($#argv < 1) then
    set opt	= "all"
    set all	= yes
else

    # Process cmdline flags.
    while ("$1" != "")
      switch ("$1")
      case -all:                          # clean all package sources
        set all = yes
	set opt	 = "all"
        breaksw
      case -src:                          # update only source code
        set src_only = yes
	set opt	 = "src"
        breaksw
      case -list:                         # list files needing updating
        set list_only = yes
	set opt	 = "list"

	echo ""
	util/check_update
	if ($status == 0) then
	    echo "IRAF is up to date"
	else
	    echo "An IRAF update is available"
	endif
	echo ""
	(chdir util ; ${iraf}/util/pkgupdate -list)
	exit 0

      case -core:                         # update only core system
        set core_only = yes
	set opt	 = "core"
        breaksw
      case -noao:                         # update only NOAO package
        set noao_only = yes
	set opt	 = "noao"
        breaksw
      case -vo:                           # update only VO package
        set vo_only = yes
	set opt	 = "vo"
        breaksw
      default:
        echo "Error: Unknown option '"$1"', quitting."
        exit 1
      endsw

      shift
   end
endif


# Called from Makefile, set iraf root.
set  iraf       = $cwd/			
source $iraf/unix/hlib/irafuser.csh
set  irafdir    = $iraf


set REPO	= `${irafdir}/util/pkgrepo`
if ($?IRAFARCH) then
    set arch    = $IRAFARCH
else
    set arch    = `${irafdir}/unix/hlib/irafarch.csh -actual`
endif


#  Init the build scripts as the first update.
#echo "Updating build scripts ...."
util/self_update


#  Execute the update.
echo "Updating IRAF system  ...."
util/iraf_latest $opt

if ($status == 2) then
   echo -n "Update Status:    No updates necessary"
else if ($status == 0) then
   echo -n "Update Status:    Successful	"
else
   echo -n "Update Status:    Fails	"
endif
echo ""

exit 0