#!/bin/sh # $Revision: 1.2 $ # $Date: 2006-10-09 02:58:03 $ # 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 "\twhere INSTRUMENT can be hrpd, echidna, hipd, wombat ..."; } if [ $# -eq 0 -o $# -eq 2 -o $# -gt 3 ] then usage exit 1 fi INSTRUMENT=$1 SRCDIR=./ DESTDIR=${3:-/usr/local/sics/server} # Set the destination host and the # instrument src directory case $INSTRUMENT in hrpd|echidna) DESTHOST=${2:-ic-echidna.nbi.ansto.gov.au} INSTSRC=hrpd;; hipd|wombat) DESTHOST=${2:-ic-wombat.nbi.ansto.gov.au} INSTSRC=hipd;; qld|koala) DESTHOST=${2:-ic-koala.nbi.ansto.gov.au} INSTSRC=qld;; reflectometer|platypus) DESTHOST=${2:-ic-platypus.nbi.ansto.gov.au} INSTSRC=reflectometer;; rsd|kowari) DESTHOST=${2:-ic-kowari.nbi.ansto.gov.au} INSTSRC=qld;; sans|quokka) DESTHOST=${2:-ic-quokka.nbi.ansto.gov.au} INSTSRC=sans;; tas|taipan) DESTHOST=${2:-ic-taipan.nbi.ansto.gov.au} INSTSRC=tas;; esac 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) # Create a manifest of the files installed on the IC host echo "Date: $(date -Iminutes)" > /tmp/MANIFEST.TXT echo -e "The following files were installed by $USER\n" >> /tmp/MANIFEST.TXT cat $SRCDIR/MANIFEST.TXT $INSTSRC/MANIFEST.TXT >> /tmp/MANIFEST.TXT scp ../SICServer $COMMON $INSTSPEC /tmp/MANIFEST.TXT $DESTHOST:$DESTDIR rm /tmp/MANIFEST.TXT