DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T p

⟦0a8902459⟧ TextFile

    Length: 2354 (0x932)
    Types: TextFile
    Names: »patch_script«

Derivation

└─⟦1e97d88e5⟧ Bits:30000533 8mm tape, Rational 1000, RATIONAL ASIS (AIX) 110.2.4.15
    └─⟦this⟧ »./releases/asis.110.2.4.15/install/patch_script« 

TextFile

#!/bin/sh
# @(#)patch_script  $Revision: 1.8 $  $Date: 1994/01/17 17:43:45 $
# @(#)Copyright(c) 1993,1994 by Rational.
#
#
#  MODULE SPECIFICATION
#  Name:
#    patch_script
# 
#  Subsystem:
#    install
# 
#  Description:
#    Used to translate environment variables, such as APEX_BASE and
#    APEX_LICENSE_FILE, into actual values based on the customer installation
#    of Rational products.  It reads a list of symbols and values from a file
#    and patches a set of scripts.
#    The control file has the following form:
#
#	# comments start with '#'
#	VARNAME=value
#
#    (i.e.: it could be sourced by /bin/sh.
#
#  Notes:
#
#  Change history:
#    Created on 2/9/92 by Mike Cuddy

PROGNAME=`basename $0`
SED_CMDS=/tmp/sed_cmds.$$
SED_ERR=/tmp/sed_err.$$

if [ "$1" = '-q' ]
then
    ECHO=':'
    shift
else
    ECHO=echo
fi

if [ $# -lt 3 ] ; then
    echo "Usage: $PROGNAME [-q] patch_file dest_dir script_to_patch.sh [ ... ] "
    exit 2
fi

PATCH_FILE=$1
shift

if [ ! -f "$PATCH_FILE" ] ; then
    echo "$PROGNAME: patch file '$PATCH_FILE' does not exist."
    exit 1
fi

DEST_DIR=$1
shift
ERR=0
if [ ! -d "$DEST_DIR" ] ; then
    echo "$PROGNAME: destination directory '$DEST_DIR' does not exist, or "
    echo "is not a directory."
    exit 1
fi


if [ ! -w "$DEST_DIR" ] ; then
    echo "$PROGNAME: insufficient permissions to write in destination directory '$DEST_DIR'"
    exit 1
fi

# Turn patch file into sed commands... grep out comments, modify command lines,
# and grep out any lines that we didn't modify.
#
grep -v '^#' $PATCH_FILE |
    sed -e 's/^\([^=]*\)=\(.*\)$/s:%%\1%%:\2:/' |
    grep '^s:.*:$' > $SED_CMDS

$ECHO "$PROGNAME: Patching files ..."
for file in $* ; do
    if [ `expr "$file" : '.*\.sh$'` -eq 0 ] ; then 
	echo "$PROGNAME: source script '$file' must end in '.sh'"
	ERR=1
	continue
    fi

    DEST=`basename $file .sh`

    # can we create the file? (i.e.: can we remove it)
    rm -f $DEST_DIR/$DEST
    if [ -f "$DEST_DIR/$DEST" ] ; then
	echo "$PROGNAME: Insufficient permission to remove destination file $DEST."
	ERR=1
	break
    fi

    $ECHO "    $file -> $DEST_DIR/${DEST}"

    sed -f $SED_CMDS < $file > $DEST_DIR/$DEST 2>$SED_ERR


    if [ $? -ne 0 ] ; then
	echo "sed on '$file' failed."
	ERR=1
	cat $SED_ERR
	break
    fi

    chmod +x $DEST_DIR/$DEST
done

rm -f $SED_CMDS $SED_ERR
exit $ERR