aboutsummaryrefslogtreecommitdiff
path: root/unix/hlib/util.csh/pkgupdate
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /unix/hlib/util.csh/pkgupdate
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'unix/hlib/util.csh/pkgupdate')
-rwxr-xr-xunix/hlib/util.csh/pkgupdate106
1 files changed, 106 insertions, 0 deletions
diff --git a/unix/hlib/util.csh/pkgupdate b/unix/hlib/util.csh/pkgupdate
new file mode 100755
index 00000000..7d93bcd7
--- /dev/null
+++ b/unix/hlib/util.csh/pkgupdate
@@ -0,0 +1,106 @@
+#!/bin/csh -f
+#
+# PKGUPDATE - Update the named packages
+
+unalias grep ls
+
+set pkg = ""
+set all = no
+set list_only = no
+
+if ($#argv < 1) then
+ exit 0
+else
+ # Process cmdline flags.
+ while ("$1" != "")
+ switch ("$1")
+ case -all: # clean all package sources
+ set all = yes
+ breaksw
+ case -list: # list packages needing updating
+ set list_only = yes
+ breaksw
+ default:
+ set pkg = $1
+ break
+ endsw
+
+ shift
+ end
+endif
+
+
+set bindir = "`dirname $0`" # get iraf root directory
+set irafdir = $bindir:h
+
+set REPO = `${irafdir}/util/pkgrepo`
+if ($?IRAFARCH) then
+ set arch = $IRAFARCH
+else
+ set arch = `${irafdir}/unix/hlib/irafarch.csh -actual`
+endif
+
+echo "Updating repository data ...."
+../util/pkginit # init repository information
+
+# Check for a self-update.
+if ("$pkg" == "-self") then
+ echo "Updating utility scripts ...."
+ /bin/rm -f /tmp/util.tgz
+ ../util/pkgget ${REPO}/util-universal.tar.gz /tmp/util.tgz
+ (chdir ../util ; tar zxf /tmp/util.tgz ; /bin/rm -f /tmp/util.tgz)
+ echo "Done"
+ exit 0
+endif
+
+# Check for a extern update.
+if ("$pkg" == "-config") then
+ echo "Updating config script ...."
+ ../util/pkgget ${REPO}/config-universal configure
+ chmod 777 configure
+ echo "Done"
+ exit 0
+endif
+
+
+
+# Process the requested package and any dependencies.
+foreach ip ( `cat .repo_pkgs` )
+
+ if (-e $ip/.installed) then
+
+ set pd = `grep $ip $ip/.installed | awk '{printf("%s\n", $1)}'`
+ set rd = `grep $ip .repo_manifest | head -1 | awk '{printf("%s\n", $3)}'`
+
+ set alist = `(chdir $ip; ls -1 .inst*.* | sed -e "s/\.installed\.//g")`
+
+ if ($rd > $pd) then
+
+ # Update each installed architecture automatically.
+ foreach a ( $alist )
+
+ if ("$list_only" == "yes") then
+ printf "Package %-12s for %-8s is out of date ....\n" $ip $a
+ else
+ if ("$all" == "yes" || "$ip" == "$pkg") then
+ echo "Updating package '$ip' for '$a' ...."
+ ../util/pkginst $ip
+ endif
+ endif
+ end
+
+ else
+ if ("$list_only" == "yes" || $rd <= $pd) then
+ printf "Package %-12s is current ....\n" $ip
+ endif
+ endif
+
+ else
+ printf "Package %-12s is not installed ....\n" $ip
+ endif
+
+ ${irafdir}/util/pkgenv -init
+end
+
+echo "Done"
+exit 0