#! /bin/bash . acsstartupAcsPorts #Import functions like this in bash=( #******************************************************************************* # ALMA - Atacama Large Millimiter Array # (c) European Southern Observatory, 2002 # Copyright by ESO (in the framework of the ALMA collaboration) # and Cosylab 2002, All rights reserved # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307 USA # # "@(#) $Id: acspyInteractiveContainer,v 1.1 2004/09/01 18:29:25 dfugate Exp $" # # who when what # -------- -------- ---------------------------------------------- # dfugate 9-1-04 created # These options can be recognized LONGOPTS=help SHORTOPTS=h CL_HELP= # Usage info. Be nice and keep this up-to-date! function printUsage { echo "Starts an interactive Python container session" echo "" echo "Usage: `basename $0` [OPTIONS] container_name container_args" echo "Options: " echo " -h | -help prints this help and exits" } # Run getopt (posixly_correct needed). We run twice: # First run is simply to check the commandline for correctness # Second run is the real deal which replaces the command line args with getopt's output export POSIXLY_CORRECT=1 getopt -n `basename $0` -Q -u -a -l $LONGOPTS $SHORTOPTS "$@" || { printUsage exit 43; } set -- `getopt -u -a -l $LONGOPTS $SHORTOPTS "$@"` # # Iterate over getopt's output and set CL_XXX variables accordingly # while : do case "$1" in --help) CL_HELP=true ;; -h) CL_HELP=true ;; --) break ;; esac shift done shift export POSIXLY_CORRECT= unset POSIXLY_CORRECT if [ "$CL_HELP" ] ; then printUsage exit 0 fi #choose the correct script if [ -e ../bin/ACSStartContainerPy ] then PYBINARY=../bin/ACSStartContainerPy elif [ -e $INTROOT/bin/ACSStartContainerPy ] then PYBINARY=$INTROOT/bin/ACSStartContainerPy elif [ -e $ACSROOT/bin/ACSStartContainerPy ] then PYBINARY=$ACSROOT/bin/ACSStartContainerPy else echo "ERROR - expected to find ACSStartContainerPy in the ALMA Software directory structure but did not!" exit 42 fi exec python -i $PYBINARY $@ -interactive