beautypg.com

IBM Data Server DB2 User Manual

Page 199

background image

Chapter 4. Deploying applications with DB2

185

#
##########################################################################
#set -x

# Define variables
DIR_DRV=odbcdrv # directory for odbc and cli driver files
DIR_APP=bin # directory for applications
DIR_GEM=gem # directory for gem file
unset REGVAR

# command-line syntax
syntax()
{
echo "
ruby_app_install -p -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: ruby_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_GEM ] ; then