aboutsummaryrefslogtreecommitdiff
path: root/unix/hlib/util.csh/pkginit
blob: b93eb61de3786d46f5c55c9bee85dee6ba29ed2f (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
#!/bin/csh -f
#
#  PKGINIT - Initialize the dynamic package directory by fetching the most
#  recent repository definition files.

unalias 	grep

set  bindir     = "`dirname $0`"                # get iraf root directory 
set  irafdir    = $bindir:h

set  REPO	= `${irafdir}/util/pkgrepo`	# get repo url
set  man 	= ".repo_manifest"
set  arch	= `${irafdir}/unix/hlib/irafarch.csh -actual`


$irafdir/util/pkgget ${REPO}/REPO.MANIFEST  .repo_manifest
if ($status == 1) then
    echo "Cannot download repository manifest file, quitting."
    exit $status
endif

$irafdir/util/pkgget ${REPO}/REPO.DESC 	    .repo_desc
if ($status == 1) then
    echo "Cannot download repository description file, quitting."
    exit $status
endif


# Create a list of packages available for the current platform.  We pull
# out the list from the repository manifest of all packages.  If we have
# IRAFARCH defined, assumed we're interested in managing multiple
# architectures so don't filter by the current architecture.

if ($?IRAFARCH) then
    cat $man | egrep -v "^#" | awk '{printf("%s\n", $2)}' | uniq  >  .repo_pkgs
    cat $man    			 	        	  >  .repo_local
else
    cat $man | grep "${arch}\ " | awk '{printf("%s\n", $2)}' 	  >  .repo_pkgs
    cat $man | grep "${arch}\ " 			 	  >  .repo_local
endif


exit 0