aboutsummaryrefslogtreecommitdiff
path: root/util/self_update
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 /util/self_update
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'util/self_update')
-rwxr-xr-xutil/self_update58
1 files changed, 58 insertions, 0 deletions
diff --git a/util/self_update b/util/self_update
new file mode 100755
index 00000000..8e438909
--- /dev/null
+++ b/util/self_update
@@ -0,0 +1,58 @@
+#!/bin/bash
+#
+# SELF_UPDATE - Update the update scripts.
+
+
+# Initialize the $iraf and environment.
+if [ -z "$iraf" ]; then
+ if [ -e "$FAKEHOME/setup.sh" ]; then
+ source $FAKEHOME/setup.sh
+ else
+ source unix/hlib/setup.sh
+ fi
+else
+ source $iraf/unix/hlib/setup.sh
+fi
+
+source $iraf/unix/hlib/irafuser.sh
+
+cd $iraf/util
+
+REPO=`${iraf}/util/pkgrepo`
+if [ -n "$IRAFARCH" ]; then
+ arch=$IRAFARCH
+else
+ arch=`${iraf}/unix/hlib/irafarch.sh -actual`
+fi
+
+
+/bin/echo -n "Updating utility scripts ...."
+
+# Delete any existing downloads.
+if [ -e /tmp/util.tgz ]; then
+ /bin/rm -f /tmp/util.tgz
+fi
+
+# Get the latest script distribution.
+./fget -o /tmp/util.tgz ${REPO}/util-universal.tar.gz
+
+# Go to iraf root, unpack and clean up. Using the IRAF root gives us
+# the chance to update the toplevel Makefile or other build scripts in
+# the system, e.g. in the 'vendor' directory.
+(cd ../; tar zxf /tmp/util.tgz; /bin/rm -f /tmp/util.tgz )
+
+# Edit the current IRAF path into the scripts.
+cd $iraf/unix/hlib
+pfiles=("cl.sh" "cl.csh" "ecl.sh" "ecl.csh" "vocl.sh" "vocl.csh" "setup.sh" "setup.csh" "mkiraf.sh" "mkiraf.csh")
+d_iraf="/iraf/iraf/"
+TEMP="/tmp/iraf_update.$$"
+/bin/rm -f $TEMP
+
+for file in ${pfiles[@]}; do
+ sed -e "s+$d_iraf+$iraf+" $file > $TEMP
+ mv $TEMP $file
+done
+cd $iraf
+/bin/echo "Done"
+
+exit 0