Consultor Eletrônico



Kbase 20730: Sample Shell Script for Installing a Progress Patch on Linux
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/21/2010
Status: Unverified

GOAL:

How to install a Progress patch on Linux via a shell script.

FIX:

This is a sample shell script that backs up the files that are modified by a patch into a compressed tar file (tgz) so that you can revert to it if necessary to undo or roll back the Progress patch.

Notes regarding the following shell script:
- The script assumes that the DLC environment variable is set to
the desired Progress installation.

For example:

# export DLC=/usr/dlc

- The patch file name is used as a parameter.

- The shell script assumes that the tar command supports tar czf
to create compressed files on the fly, tar tzf to list the
content, and tar xzf to extract the content of a compressed tar
file.

- You might receive error messages that indicate:

Cannot stat: No such file or directory.

These errors normally indicate that files that are not
installed are being accessed by the tar command.

The shell script is:

#!/bin/sh
# installpatch.sh
#
if [ -z "$1" ]
then
echo "Usage: installpatch.sh <patch-file>"
exit 1
fi
if [ -z "$DLC" ]
then
echo installpatch.sh requires the DLC environment variable to be set.
Aborting ...
exit 1
fi
#
TMPFILE=/tmp/installpatch`date +%y%m%d`
PATCHNAME=`echo $1 | cut -d. -f1-2`
# Fuzzy test to determine if the patch path given was relative or absolute
CWD=`pwd`
if [ -f "$CWD/$1" ]
then
PATCHFILE=$CWD/$1
else
PATCHFILE=$1
fi
#
echo "Progress install directory: $DLC"
echo "Patch to install : $PATCHNAME"
echo "Patch file : $PATCHFILE"
echo "Temporary file to use : $TMPFILE"
#
if [ -e "$DLC/$PATCHNAME.bk/$PATCHNAME.tgz" ]
then
echo "Patch seems to be already installed. Aborting ..."
exit 1
fi
#
echo Creating backup directory $DLC/$PATCHNAME.bk
mkdir $DLC/$PATCHNAME.bk
#
echo Retrieving patch content ...
tar -tf $PATCHFILE > $TMPFILE
#
echo Backing up files ...
cd $DLC ; tar -cf $PATCHNAME.bk/$PATCHNAME.tgz `cat $TMPFILE`
echo Errors regarding missing files normally correspond to files
echo in a product not installed
ls -l $DLC/$PATCHNAME.bk/$PATCHNAME.tgz
#
echo Extracting files ...
cd $DLC ; tar -xf $PATCHFILE
#
find $DLC -exec chown root {} \;
chmod 4755 $DLC/bin/_dbagent
chmod 4755 $DLC/bin/_dbutil
chmod 4755 $DLC/bin/_mprosrv
chmod 4755 $DLC/bin/_mprshut
chmod 4755 $DLC/bin/_orasrv
chmod 4755 $DLC/bin/_proapsv
chmod 4755 $DLC/bin/_progres
chmod 4755 $DLC/bin/_proutil
chmod 4755 $DLC/bin/_rfutil
chmod 755 $DLC/bin/_sqlsrv2
#
echo Installation of patch is completed
cat $DLC/version
rm $TMPFILE
#