Add -n option for script testing and fix test directory structure
r1297 | dcl | 2006-11-16 15:21:17 +1100 (Thu, 16 Nov 2006) | 2 lines
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#!/bin/sh -x
|
||||
# $Revision: 1.12 $
|
||||
# $Date: 2006-11-16 03:39:25 $
|
||||
#!/bin/sh
|
||||
# $Revision: 1.13 $
|
||||
# $Date: 2006-11-16 04:21:17 $
|
||||
# Author: Ferdi Franceschini (ffr@ansto.gov.au)
|
||||
# Last revision by $Author: ffr $
|
||||
# Last revision by $Author: dcl $
|
||||
|
||||
# Deploys SICServer and configuration files to
|
||||
# an instrument control computer.
|
||||
@@ -14,19 +14,37 @@ cat <<EOF
|
||||
deploySICS.sh copies SICS and the files listed
|
||||
in the MANIFEST.TXT files to the IC host.
|
||||
Usage:
|
||||
./deploySICS.sh INSTRUMENT [TARGET_HOST [TARGET_DIR]]
|
||||
or
|
||||
./deploySICS.sh test/INSTRUMENT [TARGET_HOST [TARGET_DIR]]
|
||||
./deploySICS.sh [-n] INSTRUMENT [TARGET_HOST [TARGET_DIR]]
|
||||
where
|
||||
-n if present inhibits the actual deployment (for testing the script)
|
||||
INSTRUMENT can be hrpd, echidna, hipd, wombat, ...
|
||||
or test/INSTRUMENT or INSTRUMENT/test for test deployment
|
||||
TARGET_HOST can be a remote host or 'localhost'
|
||||
defaults to ics1-<instrument>.nbi... or ics1-test.nbi... for test
|
||||
TARGET_DIR is the top part of the directory tree
|
||||
defaults to /usr/local or /usr/local/TEST_SICS/<instrument> for test
|
||||
tail directories in TARGET_DIR will be created on TARGET_HOST if necessary
|
||||
tail directories in TARGET_DIR will be created on TARGET_HOST if necessary.
|
||||
Examples:
|
||||
./deploySICS.sh -n echidna
|
||||
prepares deployment of echidna (./hrpd)
|
||||
to directory /usr/local/sics on isc1-echidna.nbi.ansto.gov.au
|
||||
./deploySICS.sh -n reflectometer/test
|
||||
prepares deployment of platypus (./reflectometer)
|
||||
to directory usr/local/TEST_SICS/platypus on isc1-test.nbi.ansto.gov.au
|
||||
./deploySICS.sh -n test/echidna localhost $HOME
|
||||
prepares deployment of echidna (./hrpd)
|
||||
to directory $HOME/TEST_SICS/echidna on localhost
|
||||
EOF
|
||||
}
|
||||
|
||||
if [ "$1" = "-n" ]
|
||||
then
|
||||
DEPLOY="NO"
|
||||
shift
|
||||
else
|
||||
DEPLOY="YES"
|
||||
fi
|
||||
|
||||
if [ $# -eq 0 -o $# -gt 3 ]
|
||||
then
|
||||
usage
|
||||
@@ -87,6 +105,7 @@ if [ "$TESTING" = "test" ]
|
||||
then
|
||||
DESTHOST=${2:-ics1-test.nbi.ansto.gov.au}
|
||||
DESTDIR=${3:-/usr/local}/TEST_SICS/$INSTRUMENT
|
||||
TARDIR=$DESTDIR
|
||||
# remove and recreate the temporary directory
|
||||
rm -fr $TEMPDIR/$DESTDIR
|
||||
mkdir -p $TEMPDIR/$DESTDIR
|
||||
@@ -94,10 +113,11 @@ then
|
||||
cp -a $SRCDIR/TEST_SICS/* $TEMPDIR/$DESTDIR
|
||||
rm -fr $(find $TEMPDIR/$DESTDIR -name CVS)
|
||||
# step down to the sics directory
|
||||
DESTDIR=$DESTDIR
|
||||
DESTDIR=$DESTDIR/sics
|
||||
mkdir -p $TEMPDIR/$DESTDIR
|
||||
else
|
||||
DESTDIR=${3:-/usr/local}/sics
|
||||
TARDIR=$DESTDIR
|
||||
# remove and recreate the temporary directory
|
||||
rm -fr $TEMPDIR/$DESTDIR
|
||||
mkdir -p $TEMPDIR/$DESTDIR
|
||||
@@ -143,4 +163,9 @@ cat $SRCDIR/MANIFEST.TXT $SRCDIR/$INSTSRC/MANIFEST.TXT >> $TEMPDIR/$DESTDIR/serv
|
||||
cd $TEMPDIR
|
||||
|
||||
# Strip leading / from DESTDIR and extract to destination
|
||||
tar -cz ${DESTDIR:1} | $EXTRACT
|
||||
if [ "$DEPLOY" = "YES" ]
|
||||
then
|
||||
tar -cz ${TARDIR:1} | $EXTRACT
|
||||
else
|
||||
echo "tar -cz ${TARDIR:1} | $EXTRACT"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user