diff --git a/site_ansto/instrument/deploySICS.sh b/site_ansto/instrument/deploySICS.sh index 5a487e89..53c4ee01 100755 --- a/site_ansto/instrument/deploySICS.sh +++ b/site_ansto/instrument/deploySICS.sh @@ -1,8 +1,6 @@ -#!/bin/bash -# $Revision: 1.28.10.1 $ -# $Date: 2010-01-27 03:15:13 $ +#!/bin/bash # Author: Ferdi Franceschini (ffr@ansto.gov.au) -# Last revision by $Author: jgn $ +# Author: Douglas Clowes (dcl@ansto.gov.au) # Deploys SICServer and configuration files to # an instrument control computer. @@ -54,8 +52,10 @@ copy_server_config() { fi } +# Set shell matches to be case insensitive shopt -s nocasematch +# If the first argument is "-n" then it is a dry-run only if [[ "$1" = "-n" ]] then DEPLOY="NO" @@ -64,12 +64,17 @@ else DEPLOY="YES" fi +# If the wrong number of arguments is given, print usage info and exit if [ $# -eq 0 -o $# -gt 3 ] then usage exit 1 fi +# Allow test/animal or animal/test or just animal +# animal produces TESTING=".", INSTRUMENT=animal +# test/animal produces TESTING=test, INSTRUMENT=animal +# animal/test produces TESTING=animal, INSTRUMENT=test (we then swap them) TESTING=$(dirname "$1") INSTRUMENT=$(basename "$1") if [[ "$INSTRUMENT" = "test" ]] @@ -81,7 +86,10 @@ fi SRCDIR="." TEMPDIR=$HOME/tmp - +# We allow the instrument to be specified as either the animal name or the +# mnemonic as we have to map between the two. This is because the source +# directory is named by the mnemonic and the destination directory is named by +# the animal. Any instrument-specific processing should be done within the case. # Set the destination host # instrument name and the @@ -138,8 +146,10 @@ INSTSRC=$SRCDIR/dingo;; esac INSTCFDIR=$INSTSRC/config +# Perform any instrument-specific make processing make -C ../ $INSTRUMENT || exit $? +# Set up the staging directories and, if testing, the testing parts if [[ "$TESTING" = "test" ]] then DESTHOST=${2:-ics1-test.nbi.ansto.gov.au} @@ -162,8 +172,10 @@ else mkdir -p $TEMPDIR/$DESTDIR fi +# Notify progress and intention echo "Deploying $INSTRUMENT to $DESTHOST:$DESTDIR" +# Set up the commands that we will be using for the "deploy" phase EXTRACT_CMDS="tar vxzp -C /; touch /$DESTDIR/{DataNumber,extraconfig.tcl,newserver/config/nexus/nexus.dic,script_validator/DataNumber}" if [[ "$DESTHOST" = "localhost" ]] then @@ -178,6 +190,7 @@ EXTRACT="ssh $DESTHOST $EXTRACT_CMDS" EXTRACT_NODEPLOY="ssh $DESTHOST $EXTRACT_CMDS" fi +# Ensure that we have the needed manifest files if [ ! -e $SRCDIR/MANIFEST.TXT ] then echo "$SRCDIR/MANIFEST.TXT not found"