#!/bin/bash ############################################################################## ### Copyright Sun Microsystems, Inc. ALL RIGHTS RESERVED ### Use of this software is authorized pursuant to the ### terms of the license found at ### http://www.sun.com/bigadmin/common/berkeley_license.html ############################################################################## # # init_api # # Script to initialize the Python API. # # See Onstage 3.0, Enhancement Tools, Chapter 1 # for further infos # # Author: Juergen.Fleischer@Sun.COM # # v1.0: 01-Dec-2006 # v1.1: 01-Mar-2007 # Changes: adjusted to SC 1.1 # v1.2: 23-Apr-2007 # Changes: config.py needs path to uce.rc as last parameter # All installations with v1.1 will not work :-( # v1.3: 23-May-2007 # Changes: scripts fails if agent has not been installed # on target machine # # check for OS and define OS specific pathes if uname -a | grep Linux >/dev/null then BASEDIR=/usr/local/uce OPT=/opt/local/uce PYTHON=/usr/bin/python else BASEDIR=/opt/SUNWuce OPT=$BASEDIR PYTHON=/usr/sfw/bin/python fi # where can I find SDS server parameter ? PARAM_AGENT=$OPT/agent/bin/.uce.rc PARAM_CLI=$BASEDIR/cli/bin/.uce.rc PARAM_CONSOLE=$BASEDIR/console/bin/.uce.rc if [ -f "$PARAM_AGENT" ] then PARAM=$PARAM_AGENT SERVER=$( grep 'server_name' $PARAM |cut -d\" -f2 ) SERVERPORT=$( grep 'server_port' $PARAM |cut -d\ -f6 ) DISTRIZOR=$( grep 'distrizor_host' $PARAM |cut -d\" -f2 ) DISTRIZORPORT=$( grep 'distrizor_port' $PARAM |cut -d\ -f6 ) elif [ -f "$PARAM_CLI" ] then PARAM=$PARAM_CLI SERVER=$( grep 'server_name' $PARAM |cut -d\" -f2 ) SERVERPORT=$( grep 'server_port' $PARAM |cut -d\ -f7 ) DISTRIZOR=$( grep 'distrizor_host' $PARAM |cut -d\" -f2 ) DISTRIZORPORT=$( grep 'distrizor_port' $PARAM |cut -d\ -f7 ) elif [ -f "$PARAM_CONSOLE" ] then PARAM=$PARAM_CONSOLE SERVER=$( grep 'server_name' $PARAM |cut -d\" -f2 ) SERVERPORT=$( grep 'server_port' $PARAM |cut -d\ -f7 ) DISTRIZOR=$( grep 'distrizor_host' $PARAM |cut -d\" -f2 ) DISTRIZORPORT=$( grep 'distrizor_port' $PARAM |cut -d\ -f7 ) else echo ERROR: No .uce.rc config file found !!! echo ERROR: Please ensure, that the CLI, console or agent components are installed. exit 1 fi # path to certificate CERT_SDS=$BASEDIR/engine/bin/uce.public CERT_AGENT=$OPT/agent/bin/uce.public if [ -f "$CERT_SDS" ] then CERT=$CERT_SDS elif [ -f "$CERT_AGENT" ] then CERT=$CERT_AGENT else echo ERROR: No uce.public certificate found !!! echo ERROR: Please ensure, that agent or SDS components are installed. exit 1 fi # the Python API configuration directory UCE_PYTHON=$HOME/.uce_python if [ -d $UCE_PYTHON ] then echo "Moving existing directory $UCE_PYTHON to ${UCE_PYTHON}.old.$$" mv $UCE_PYTHON ${UCE_PYTHON}.old.$$ fi # script to configure the python API CONFIG=$OPT/api/python/lib/PyOsApi/utils/config.py # path to main uce.rc file UCE_RC_PATH=${OPT}/api/python/bin/uce.rc if [ -f "$CONFIG" ] then $PYTHON $CONFIG $SERVER $SERVERPORT $DISTRIZOR $DISTRIZORPORT $CERT $UCE_RC_PATH $UCE_PYTHON if [ -f "$UCE_PYTHON/.uce.rc" ] then echo Python API successfully initialized else echo ERROR: Python API initialization failed exit 1 fi else echo ERROR: Python API configuration script $CONFIG not found exit 1 fi