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

bindir="`dirname $0`"                # get iraf root directory 
irafdir=${bindir%/*}

# 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


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


$irafdir/util/pkgget ${REPO}/REPO.MANIFEST  .repo_manifest
if (( $?>0 )); then
    /bin/echo "Cannot download repository manifest file, quitting."
    exit $?
fi

$irafdir/util/pkgget ${REPO}/REPO.DESC 	    .repo_desc
if (( $?>1 )); then
    /bin/echo "Cannot download repository description file, quitting."
    exit $?
fi


# 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 [ -n "$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
fi


exit 0