#!/bin/ksh # # The script should be run as id Lawson. # # Turn Lawson Security OFF during the Use of this Script. # # This script should reside in $GENDIR/bin and have file permissions 770. # This script should be owned by lawson and group lawson. # # This script in its entirety is in no way supported by Lawson Software. # Use of this script is on an as is basis. # The User of this script assumes full responsibility for any actions this script takes. # Lawson Softare or the creator of this script is not liable for ANY Damages that # may result from the Use of this script. # # The person using this script must read this entire script and understand what it # does before using it. # # Create a Staging Directory to place ALL of the CTP's to be applied. # Once the Staging Directory is created place all the CTP's that you are applying # in that directory. # The Staging Directory will be a command line variable passed to this script to # allow the script to find # the Staged CTP's that need to be applied. Make sure when typing the stage directory # that you place Quotes # around the directory included on the command line. # # This script will create an apply directory and will copy the CTP from the present # directory to the apply directory. # Once the file is in the apply directory it is untared. # Next the lasetup is run for the patch. Then a request to check the install # log is made. The Script stops at this point in time asking that the associated log # file be checked for errors before # continuing with the execution of the script. Do all checking in another window and # DO NOT exit this script in the middle # of execution as it will not complete the application of a CTP that it is in the # process of applying meaning the process # will require manual intervention to correct run time errors. # # Once the error log has been viewed and no errors are present then the script runs # the appmetaload portion # of the process. # Once the appmetaload completes then a requestis made for you to check the metaload log. # Once the # the log check is made press a key and enter and the script contines to the # next script in the list of CTP's. # # Next the script will move the completed tar of the CTP to an applied directory. # # Put ALL the CTP's to be applied in the directory with this script. Then # execute the script by . ./patch.sh It will get a list of the patch tar files # and then loop through each tar file in the directory applying the patch info # to the a product line to be named after the script name on the commandline. # set -x if [[ $LOGNAME != "lawson ]]; then echo "\nMust be executed by the 'lawson' user\n" exit fi clear echo "This Script is written to run all associated processes required to apply CTP's." echo "If you are not planning on applying CTP's this is the wrong script to run!" echo "To exit Press CTRL C ----- To Continue Press ENTER!" read START if [[ $# -eq 0 ]];then clear echo " " echo " Please execute this script with the name of a product line" echo "and the name of the Staging Directory you placed all the CTP's in." echo " DO NOT INCLUDE a Trailing / in the name of the Stage Directory!" echo " " echo " per this example: $0 " break else alias rm='/usr/bin/rm -f' export WHEN=`date` export WHO=`id` export APPLY=$2/apply export LOGFILE=$2/patches.log export APPLIED=$2/applied.log export APPLIEDDIR1=$2/$1 export APPLIEDDIR2=$2/$1/applied echo "" > $APPLIED echo "" > $LOGFILE echo " " echo "Performing CTP Updates to "$1" Product Line" >> $LOGFILE 2>&1 echo "Performing CTP Updates to "$1" Product Line" echo $WHO" is performing the CTP Updates on "$WHEN >> $LOGFILE 2>&1 echo $WHO" is performing the CTP Updates on "$WHEN echo " " echo "Making "$APPLY" directories!" >> $LOGFILE 2>&1 echo "Making "$APPLY" directories!" mkdir $APPLY >> $LOGFILE 2>&1 mkdir $APPLIEDDIR1 >> $LOGFILE 2>&1 mkdir $APPLIEDDIR2 >> $LOGFILE 2>&1 clear cd $2 for i in `ls *.tar | sed "s/8.0.3_patch_//g"| sed "s/.tar//g"` do cp $2/8.0.3_patch_$i.tar $APPLY >> $LOGFILE 2>&1 echo " " echo "Copied CTP "$i" from "$2" to the "$APPLY" directory" >> $LOGFILE 2>&1 echo "Copied CTP "$i" from "$2" to the "$APPLY" directory" echo "Check the "$APPLY" directory for the tar file" echo " " echo "Press CTRL C To EXIT ----- To Continue Press ENTER!" read NEW1 clear cd $APPLY tar -xvf $APPLY/8.0.3_patch_$i.tar >> $LOGFILE 2>&1 echo " " echo "Untared CTP "$i" in the "$APPLY" directory" >> $LOGFILE 2>&1 echo "Untared CTP "$i" in the "$APPLY" directory" echo "Check the "$APPLY" directory for untared files" echo " " echo "To exit Press CTRL C ----- To Continue Press ENTER!" read NEW2 clear perl $GENDIR/bin/lasetup patch $1 >> $LOGFILE 2>&1 echo " " echo "Ran Lasetup "$i" for the "$1" Product Line" >> $LOGFILE 2>&1 echo "Ran Lasetup "$i" for the "$1" Product Line" echo "Check the "LAWDIR"/"$1"/Admin/install.log for errors!" echo " " echo "To exit Press CTRL C ----- To Continue Press ENTER!" read NEW3 clear chmod -R 777 $LAWDIR/$1 >> $LOGFILE 2>&1 chown -R lawson:lawson $LAWDIR/$1 >> $LOGFILE 2>&1 echo " " echo "File Permissions reset for "$LAWDIR"/"$1 >> $LOGFILE 2>&1 echo "File Permissions reset for "$LAWDIR"/"$1 perl $GENDIR/bin/appmetaload $1 $i >> $LOGFILE 2>&1 echo " " echo "Ran Appmetaload on "$1" Product Line for CTP "$i >> $LOGFILE 2>&1 echo "Ran Appmetaload on "$1" Product Line for CTP "$i echo "Check the "LAWDIR"/"$1"/Admin/appmetaload.log for errors!" echo " " echo "To exit Press CTRL C ----- To Continue Press ENTER!" read NEW4 clear chmod -R 777 $LAWDIR/$1 >> $LOGFILE 2>&1 chown -R lawson:lawson $LAWDIR/$1 >> $LOGFILE 2>&1 echo "File Permissions reset for "$LAWDIR"/"$1 >> $LOGFILE 2>&1 echo "File Permissions reset for "$LAWDIR"/"$1 echo " " echo "Cleaning up "$i" in "$APPLY" directory" >> $LOGFILE 2>&1 echo "Cleaning up "$i" in "$APPLY" directory" rm $APPLY/* echo "Cleaned "$i" in the "$APPLY" directory" >> $LOGFILE 2>&1 echo "Cleaned "$i" in the "$APPLY" directory" echo "Check the apply directory for the file" echo " " echo "To exit Press CTRL C ----- To Continue Press ENTER!" clear read NEW5 # echo $i >> $APPLIED # touch $LAWDIR/$1/CTP/8.0.3_patch_$i # echo "Created the touch file signifying that 8.0.3_patch_"$i".tar was applied to "$1" Product Line" >> $LOGFILE 2>&1 # echo "Created the touch file signifying that 8.0.3_patch_"$i".tar was applied to "$1" Product Line" # echo "Check the "$LAWDIR"/"$1"/CTP directory for the touch file" # echo " " # echo "To exit Press CTRL C ----- To Continue Press ENTER!" # read NEW5 mv 8.0.3_patch_$i.tar $APPLIEDDIR2 >> $LOGFILE 2>&1 echo "Moved 8.0.3_patch_"$i".tar to the "$APPLIEDDIR2" directory" >> $LOGFILE 2>&1 echo "Moved 8.0.3_patch_"$i".tar to the "$APPLIEDDIR2" directory" echo "Check the applied directory for the file" echo " " echo "To exit Press CTRL C ----- To Continue Press ENTER!" read NEW5 cd $STAGE done for a in `cat $APPLIED` do perl $GENDIR/bin/patchcompile $1 $a >> $LOGFILE 2>&1 echo "CTP "$a" is now on the compile queue!" >> $LOGFILE 2>&1 echo "CTP "$a" is now on the compile queue!" echo " " echo "To exit Press CTRL C ----- To Continue Press ENTER!" read NEW clear done echo "Cleaning up install directory!" >> $LOGFILE 2>&1 echo "Cleaning up install directory!" rm $APPLY/* >> $LOGFILE 2>&1 rmdir $APPLY >> $LOGFILE 2>&1 echo "Moving Log Files to "$APPLIEDDIR1 mv $LOGFILE $APPLIEDDIR1 mv $APPLIED $APPLIEDDIR1 echo "End of Run!" fi