#!/bin/sh
# =====================================================================         
# PROPRIETARY-STATEMENT:                                                        
# Licensed Material - Property of IBM                                           
#                                                                               
# 5724-I63, 5724-H88, 5655-N01, 5733-W61                                        
# (C) Copyright IBM Corp. 1999, 2010                                            
# All Rights Reserved                                                           
# US Government Users Restricted Rights - Use, duplication or                   
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.             
# =====================================================================         
<!-- import documents/data/buildInfo.script -->
# =====================================================================        
#                                                                               
# Creates the procs for the secure proxy server.                    
#                                                                              
# =====================================================================        
<!--  Change Activity:                                                -->         
<!--                                                                  -->         
<!-- F908-32216  V8.0  20101005 PDOP: Initial version                 -->
<!-- 676719      V8.0  20101102 PDOP: Escape response file values     -->
<!-- 677421      V8.0  20101108 PDOP: Use zCopyFilesToPds.sh for copy -->
<!-- ================================================================ -->

# Deletes directory to collect the customized procs
echo 'Deleting the directory to collect the customized procs (if it already exists)'
if [[ -d '/tmp/com.ibm.ws390.pmt/procs_${TIMESTMP}' ]]; then
    rm -R '/tmp/com.ibm.ws390.pmt/procs_${TIMESTMP}'
    rc="$?" 
    if [ "$rc" -ne 0 ]; then
        exit "$rc"
    fi
fi

# Creates empty directory to collect the customized procs
echo Creating empty directory to collect the customized procs
mkdir -p '/tmp/com.ibm.ws390.pmt/procs_${TIMESTMP}' 
rc="$?" 
if [ "$rc" -ne 0 ]; then
    exit "$rc"
fi 

# Invokes script to build the control region proc
echo Building control region proc
'${zSmpePath}/bin/zCreateProc.sh' \
 -procName '${zControlProcName}' \
 -procType ACR \
 -targetDirectory '/tmp/com.ibm.ws390.pmt/procs_${TIMESTMP}' \
 -mountPoint '${zConfigMountPoint}' \
 -wasServerDirectory '${zWasServerDir}' \
 -workDirectory '/tmp/com.ibm.ws390.pmt/${TIMESTMP}'
rc="$?" 
if [ "$rc" -ne 0 ]; then
    exit "$rc"
fi 

# Invokes script to build the daemon proc
echo Building daemon proc
'${zSmpePath}/bin/zCreateProc.sh' \
 -procName '${zDaemonProcName}' \
 -procType DMN \
 -targetDirectory '/tmp/com.ibm.ws390.pmt/procs_${TIMESTMP}' \
 -mountPoint '${zConfigMountPoint}' \
 -wasServerDirectory '${zWasServerDir}' \
 -workDirectory '/tmp/com.ibm.ws390.pmt/${TIMESTMP}'
rc="$?" 
if [ "$rc" -ne 0 ]; then
    exit "$rc"
fi 

# Invokes script to build the admin asynch proc
echo Building admin asynch proc
'${zSmpePath}/bin/zCreateProc.sh' \
 -procName '${zAdminAsynchProcName}' \
 -procType ASY \
 -targetDirectory '/tmp/com.ibm.ws390.pmt/procs_${TIMESTMP}' \
 -mountPoint '${zConfigMountPoint}' \
 -wasServerDirectory '${zWasServerDir}' \
 -workDirectory '/tmp/com.ibm.ws390.pmt/${TIMESTMP}'
rc="$?" 
if [ "$rc" -ne 0 ]; then
    exit "$rc"
fi 

# Copies procs from collection directory to proclib
echo Copying procs from collection directory to proclib
'${zSmpePath}/bin/zCopyFilesToPds.sh' \
 -sourceDirectory '/tmp/com.ibm.ws390.pmt/procs_${TIMESTMP}' \
 -targetPDS '${zProclibName}'
rc="$?" 
if [ "$rc" -ne 0 ]; then
    exit "$rc"
fi

# Deletes the directory used to collect the customized procs
echo Deleting the directory that was used to collect the customized procs
rm -R '/tmp/com.ibm.ws390.pmt/procs_${TIMESTMP}' 

echo All procs successfully created
 
exit 0
                                                                              
