Chapter 4. Deploying applications with DB2 195
DIR_EGG=egg # directory for egg file
unset REGVAR
# command-line syntax
syntax()
{
echo "
py_app_install -p <installpath> -r
-p specify the location where application and ODBC lib files will be deployed
-r specify to configure system variable for ODBC and CLI driver
example: py_app_install -p /home/db2app/myapp -r"
}
# main program
# process command-line options
case $# in
0) syntax
exit 1;;
*)
while getopts "p:r" OPT;
do
case $OPT in
p) INSTPATH=$OPTARG
mkdir -p $INSTPATH ;;
r) REGVAR=Y ;;
?) echo "invalid command line option $*"
syntax
exit 1 ;;
esac
done
;;
esac
# verify the ODBC driver files and application files are ready
# and then start the deployment
TESTPATH=`echo $0|egrep '^/'`
if [ -z $TESTPATH ]; then
dirname `pwd`/$0|read CURPATH
else
CURPATH=`dirname $0`
fi
cd $CURPATH
if [ ! -d $DIR_DRV ] || [ ! -d $DIR_APP ] || [ ! -d $DIR_EGG ] ; then
echo " ODBC CLI driver, Application, or Egg directory not existing.\n Abort."
exit 1
fi
# deploy applications and ODBC CLI driver to specified path
cd $INSTPATH
cp -R "$CURPATH/$DIR_APP" .