CS> By the way, I really like the horae_install script. I am not an
CS> expert in shell scripting but if I can help keeping it working, I
CS> would be happy to.
Glad it worked out for you.
It currently works by my making sure to symlink "horae-latest.tar.gz"
to whatever the latest version of the tarball is and by making sure to
extract the HORAE file from the tar ball and place it, too, on the
server. I am a little worried about my actually remembering to do the
things each time!
Attached is an improvement (even though I said I wasn't going to work
on it -- I get obsessed and can't really help myself ;-) It uses wget
to fetch a listing of the directory where the tarballs live and
determines the most recent version to download. That seems easier for
me.
The script is highly dependent on wget. That could be a problem on
non-linux unix machines. One obvious improvement would be to allow
using some other program to grab the file. Another possibility would
be to write a similar script in perl or python so you could build a
web client right into the script.
Let me know if this works for you and I'll post it on the web site.
B
#!/bin/sh
#
# This file will attempt to download the Horae tarball
# and then build it for a linux system. This was cribbed
# from Matt Newville's PGPLOT_install script
#
# syntax: HORAE_install
#
# This may need customization for some systems
#
# verified on: linux
#
dir=`pwd`
logfile=$dir/HORAE_install.log
wget=/usr/bin/wget
ncftp=/usr/bin/ncftp
ftp=/usr/bin/ftp
do_log=0
# set horae file locales
#
horae_site='feff.phys.washington.edu'
horae_url="http://$horae_site/~ravel/"
horae_dir='software/exafs/packages/'
horae_file='horae-latest.tar.gz'
horae_version='HORAE'
horae_index="$horae_site/%7Eravel/$horae_dir/index.html"
if [ ! -f $wget ] ; then
echo "This script requires wget for downloading the horae package"
echo "you can grab the source code tarball for wget from"
echo " ftp://ftp.gnu.org/pub/gnu/wget/"
exit 1
fi
# # get command line options
# for opt
# do
# option=''
# case "$opt" in
# -*=*)
# optarg=`echo "$opt" | sed 's/[-_a-zA-Z0-9]*=//'`
# option=`echo "$opt" | sed 's/=.*//' | sed 's/-*//'`
# ;;
# *)
# option=`echo "$opt" | sed 's/^-*//'`
# optarg=
# ;;
# esac
# case "$option" in
# prefix) prefix=$optarg ;;
# system) system=$optarg ;;
# no-clean) do_clean=0 ;;
# no-log) do_log=0 ;;
# with-png) with_png=1 ;;
# with-gif) with_gif=1 ;;
# no-png) with_png=0 ;;
# no-gif) with_gif=0 ;;
# -help | --help | help) cat< $logfile
echo " " >> $logfile
fi
#
#-----------------------------------------
##
## determine most recent version of the horae tarball
## this will download a directory listing of the packages directory on
## the web site
wget -r -l1 $horae_url$horae_dir -A.dummy
## this will extract a list of all the files that have the word
## "horae" in the filename. The arguments to cut extract the tarball
## from a line of html
horae_list=`grep horae $horae_index | cut -d '"' -f 6 | sort`
## clean up a bit...
rm -rf $horae_site
## the list should be sorted in a way that the most recent version of
## the horae tarball comes last (except for -latest, which may still
## be hanging around the server
for f in $horae_list; do
if [ "$f" != 'horae-latest.tar.gz' ]; then
current=$f
fi
done
## strip the .tar.gz from the tarball filename. this gives the name
## of the directory that te kit is unpacked to
kit_dir=`echo $current | cut -d '.' -f 1`
if [ $do_log -eq 1 ] ; then
echo "wget -r -l1 $horae_url$horae_dir -A.dummy" >> $logfile
echo "grep horae $horae_index | cut -d '\"' -f 6 | sort" >> $logfile
echo "rm -rf $horae_site" >> $logfile
echo "kit_dir=`echo $current | cut -d '.' -f 1`" >> $logfile
echo " = fetching $kit_dir from $current" >> $logfile
fi
echo " "
echo " = fetching $kit_dir from $current"
echo " "
#
#-----------------------------------------
##
## fetch the current tarball using wget
echo " = Looking for HORAE file: $horae_file"
if [ -f $current ] ; then
x=1
else
echo " = HORAE file not found "
echo " = I'll try to download it for you using wget..."
tmp="$horae_url/$horae_dir/$current"
wget --tries=10 $tmp
fi
## here it would perhaps be nice to have some fallbacks... although,
## wget was essential earlier, so one would need fallbacks earlier as
## well...
##
## if we still don't have the file, croak
if [ -f $current_file ]; then
echo " = I see the current HORAE archive file. Good."
if [ $do_log -eq 1 ] ; then
echo " = I see the current HORAE archive file. Good." >> $logfile
fi
else
echo " = Sorry, I couldn't download the HORAE tar file."
echo " = You'll have to download it yourself"
echo " = from $horae_url$horae_dir"
echo " = then run this script again"
if [ $do_log -eq 1 ] ; then
echo " = Sorry, I couldn't download the HORAE tar file." >> $logfile
echo " = You'll have to download it yourself" >> $logfile
echo " = from $horae_url$horae_dir" >> $logfile
echo " = then run this script again" >> $logfile
fi
exit 1
fi
## unpack kit
echo " = Unpacking HORAE: "
gzip -dc $current | tar xvf -
echo " = Running HORAE's Makefile.PL script "
cd "$kit_dir"
perl Makefile.PL
if [ $do_log -eq 1 ] ; then
echo "gzip -dc $current_file | tar xvf -" >> $logfile
echo "cd $kit_dir/ " >> $logfile
echo "perl Makefile.PL " >> $logfile
fi
echo " = Running make "
make
if [ $do_log -eq 1 ] ; then
echo "make " >> $logfile
fi
who=`whoami`
if [ "$who" = "root" ] ; then
make install
if [ $do_log -eq 1 ] ; then
echo "make install" >> $logfile
fi
else
echo " "
echo " = = = = = = = = = = = = = = = = = = = = = = = = = = "
echo " = You need to become root to install Athena and Artemis."
echo " = When you become root, issue this command:"
echo " = make install"
echo " = in this directory."
if [ $do_log -eq 1 ] ; then
echo " " >> $logfile
echo " = = = = = = = = = = = = = = = = = = = = = = = = = = " >> $logfile
echo " = You need to become root to install Athena and Artemis." >> $logfile
echo " = When you become root, issue this command:" >> $logfile
echo " = make install" >> $logfile
echo " = in this directory." >> $logfile
echo " = = = = = = = = = = = = = = = = = = = = = = = = = = "
echo " "
fi
fi
echo " = = = = = = = = = = = = = = = = = = = = = = = = = = "
echo " "
# done
--
Bruce Ravel ----------------------------------- ravel@phys.washington.edu
Code 6134, Building 3, Room 222
Naval Research Laboratory phone: (1) 202 767 5947
Washington DC 20375, USA fax: (1) 202 767 1697
NRL Synchrotron Radiation Consortium (NRL-SRC)
Beamlines X11a, X11b, X23b, X24c, U4b
National Synchrotron Light Source
Brookhaven National Laboratory, Upton, NY 11973
My homepage: http://feff.phys.washington.edu/~ravel
EXAFS software: http://feff.phys.washington.edu/~ravel/software/exafs/