Chapter 4. Deploying applications with DB2 205
# main program
# process command-line options
case $# in
0) syntax
exit 1;;
*)
while getopts "p:s:" OPT;
do
case $OPT in
p) INSTPATH=$OPTARG
mkdir -p $INSTPATH ;;
s) DB2PATH=$OPTARG
export DB2_HOME=$DB2PATH ;;
?) 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 ] ; then
echo " Application, or driver directory not existing.\n Abort."
exit 1
fi
# deploy applications to specified path
cd $INSTPATH
cp -R "$CURPATH/$DIR_APP" .
# extract the dbi and dbd::db2.
mkdir -p "$DIR_DRV"
cd $DIR_DRV
for file in $CURPATH/$DIR_DRV/*.tar.gz
do
gunzip -c $file|tar -xf -
done
# install dbi
cd DBI*
perl Makefile.PL
make
make install