Restored accidentally removed file.
r1244 | ffr | 2006-11-07 12:57:45 +1100 (Tue, 07 Nov 2006) | 2 lines
This commit is contained in:
committed by
Douglas Clowes
parent
3d0bae3859
commit
65d0b79508
105
site_ansto/instrument/deploySICS.sh
Executable file
105
site_ansto/instrument/deploySICS.sh
Executable file
@@ -0,0 +1,105 @@
|
||||
#!/bin/sh
|
||||
# $Revision: 1.8 $
|
||||
# $Date: 2006-11-07 01:45:20 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by $Author: ffr $
|
||||
|
||||
# Deploys SICServer and configuration files to
|
||||
# an instrument control computer.
|
||||
# It requires a MANIFEST.TXT file for each instrument
|
||||
|
||||
usage()
|
||||
{
|
||||
echo deploySICS.sh copies SICS and the files listed
|
||||
echo in the MANIFEST.TXT files to the IC host.
|
||||
echo -e "Usage:\t./deploySICS.sh INSTRUMENT [TARGET_HOST TARGET_DIR]";
|
||||
echo -e "\t./deploySICS.sh test/INSTRUMENT [TARGET_HOST TARGET_DIR]";
|
||||
echo -e "\twhere INSTRUMENT can be hrpd, echidna, hipd, wombat ...";
|
||||
echo -e "\tTARGET_HOST can be a remote host or 'localhost'";
|
||||
echo -e "\twill create last directory in TARGET_DIR if necessary";
|
||||
}
|
||||
|
||||
if [ $# -eq 0 -o $# -eq 2 -o $# -gt 3 ]
|
||||
then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
INSTRUMENT=$1
|
||||
|
||||
SRCDIR=./
|
||||
DESTDIR=${3:-/usr/local/}
|
||||
mkdir -p ~/tmp/$DESTDIR
|
||||
rm -fr ~/tmp/$DESTDIR/*
|
||||
|
||||
# Set the destination host and the
|
||||
# instrument src directory
|
||||
case $INSTRUMENT in
|
||||
hrpd|echidna)
|
||||
DESTHOST=${2:-ics1-echidna.nbi.ansto.gov.au}
|
||||
INSTSRC=hrpd;;
|
||||
hipd|wombat)
|
||||
DESTHOST=${2:-ics1-wombat.nbi.ansto.gov.au}
|
||||
INSTSRC=hipd;;
|
||||
qld|koala)
|
||||
DESTHOST=${2:-ics1-koala.nbi.ansto.gov.au}
|
||||
INSTSRC=qld;;
|
||||
reflectometer|platypus)
|
||||
DESTHOST=${2:-ics1-platypus.nbi.ansto.gov.au}
|
||||
INSTSRC=reflectometer;;
|
||||
rsd|kowari)
|
||||
DESTHOST=${2:-ics1-kowari.nbi.ansto.gov.au}
|
||||
INSTSRC=qld;;
|
||||
sans|quokka)
|
||||
DESTHOST=${2:-ics1-quokka.nbi.ansto.gov.au}
|
||||
INSTSRC=sans;;
|
||||
tas|taipan)
|
||||
DESTHOST=${2:-ics1-taipan.nbi.ansto.gov.au}
|
||||
INSTSRC=tas;;
|
||||
test/*)
|
||||
#copy TEST_SICS/fakeDMC
|
||||
#TESTSRC=TEST_SICS
|
||||
cp -a TEST_SICS/* ~/tmp/$DESTDIR
|
||||
rm -fr $(find ~/tmp/$DESTDIR -name CVS)
|
||||
DESTHOST=$2
|
||||
INSTSRC=$(basename $INSTRUMENT);;
|
||||
esac
|
||||
|
||||
echo $DESTHOST
|
||||
if [ $DESTHOST = "localhost" ]
|
||||
then
|
||||
EXTRACT="tar vxz -C /"
|
||||
else
|
||||
EXTRACT="ssh $DESTHOST tar vxz -C /"
|
||||
fi
|
||||
|
||||
if [ ! -e $SRCDIR/MANIFEST.TXT ]
|
||||
then
|
||||
echo "$SRCDIR/MANIFEST.TXT not found"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -e $INSTSRC/MANIFEST.TXT ]
|
||||
then
|
||||
echo "$INSTSRC/MANIFEST.TXT not found"
|
||||
echo "You must list the files required for $INSTRUMENT in the manifest"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get list of files to copy
|
||||
COMMON=$(for f in $(cat $SRCDIR/MANIFEST.TXT); do echo -n "$SRCDIR/$f "; done)
|
||||
INSTSPEC=$(for f in $(cat $INSTSRC/MANIFEST.TXT); do echo -n "$INSTSRC/$f "; done)
|
||||
|
||||
mkdir -p ~/tmp/$DESTDIR/sics/{server,data,log,tmp}
|
||||
cp $COMMON $INSTSPEC ~/tmp/$DESTDIR/sics/server
|
||||
cp ../SICServer ~/tmp/$DESTDIR/sics/server
|
||||
|
||||
# Create a manifest of the files installed on the IC host
|
||||
echo "Date: $(date -Iminutes)" > ~/tmp/$DESTDIR/sics/server/MANIFEST.TXT
|
||||
echo -e "The following files were installed by $USER\n" >> ~/tmp/$DESTDIR/sics/server/MANIFEST.TXT
|
||||
cat $SRCDIR/MANIFEST.TXT $INSTSRC/MANIFEST.TXT >> ~/tmp/$DESTDIR/sics/server/MANIFEST.TXT
|
||||
|
||||
cd ~/tmp/
|
||||
|
||||
# Strip leading / from DESTDIR and extract to destination
|
||||
tar -cz ${DESTDIR:1} | $EXTRACT
|
||||
Reference in New Issue
Block a user