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 u

⟦653de30c4⟧ TextFile

    Length: 6535 (0x1987)
    Types: TextFile
    Names: »uninstall«

Derivation

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

TextFile

#!/bin/sh
#@(#)uninstall  $Revision: 1.5 $  $Date: 1994/01/24 17:24:57 $
#@(#)Copyright(c) 1993,1994 by Rational.

CMD=`basename $0`
DIR=`dirname $0`
SUBDIR=`basename $DIR`
TMP=/tmp/$CMD.$$
TMP2=/tmp/$CMD.2.$$
trap 'rm -f $TMP $TMP2; exit' 1 2 3 4 15
TRUE=0
FALSE=1
WARN_DIR=$FALSE
WARN_OWNER=$FALSE
umask 002

#------------------------------------------------------------------------
Usage() {
#------------------------------------------------------------------------

    echo "
usage:  $CMD <feature> <version>

        Uninstall installed <feature> <version> in the 'rational_dir'.
        Looks for the release under releases/<feature>.<version>.
        Looks for any subsystem views under base/*/*.ss/*.<version>.rel.
        Asks you if you want to uninstall them.

        You need to be in the 'rational_dir' where config, releases and base
        are located.
    "
    exit 1
}


#------------------------------------------------------------------------
warn() {
#------------------------------------------------------------------------

    if [ $1 = owner ]
    then
        if [ $WARN_OWNER -eq $TRUE ]
        then
            echo
            echo "Since $owner installed one or more of the above directories,"
            echo "$owner must uninstall it."
        fi
    else # dir
        if [ $WARN_DIR -eq $FALSE ]
        then
            echo
            echo "  By not deleting this directory, you will not be completely"
            echo "  uninstalling $feature $version."
            WARN_DIR=$TRUE
        fi
    fi
}


#------------------------------------------------------------------------
not_owner_of() {
#------------------------------------------------------------------------

    owner=`/bin/ls -ld $1 | awk '{print $3}'`
    if [ "$owner" = $USER ]
    then
        # USER is the owner of the directory, return FALSE
        return $FALSE
    fi
    return $TRUE

}


#------------------------------------------------------------------------
other_releases_using_base() {
#------------------------------------------------------------------------

    if [ -z "$others" ]
    then
        others=`/bin/ls releases/*/install/base_components 2>/dev/null |
                grep -v /$feature.$version/`
    fi

    if [ -z "$others" ]
    then
        # No other base_component files to check.
        return $FALSE
    fi

    if grep $1 $others >/dev/null
    then
        return $TRUE
    fi
    return $FALSE
}


#------------------------------------------------------------------------
confirm_uninstall() {
#------------------------------------------------------------------------

    if [ -z "$2" ]
    then
        return $FALSE
    fi
 
    for dir in $2
    do
        if [ ! -d $dir ]
        then
            continue
        fi

        if [ $1 = base ]
        then
            if other_releases_using_base $dir
            then
                # Other releases are using dir
                continue
            fi
        fi

        if not_owner_of $dir
        then
            echo
            echo "You are not the owner of $dir."
            WARN_OWNER=$TRUE
            continue
        fi

        prompt="Remove $dir? [no] "
        if [ `echo "$prompt" | wc -c` -lt 77 ]
        then
            echo 
            echo -n "$prompt"
        else
            echo 
            echo "Remove $dir?"
            echo -n "[no] "
        fi

        read reply

        case $reply in
            Y*|y*)
                echo "  Will remove this directory"
                REMOVE_DIR_LIST="$REMOVE_DIR_LIST $dir"
                ;;
            *)
                echo "  Okay, will not remove this directory"
                warn dir
                ;;
        esac
    done
}


#------------------------------------------------------------------------
uninstall_dirs() {
#------------------------------------------------------------------------

    if [ -z "$REMOVE_DIR_LIST" ]
    then
        echo
        echo "Nothing to uninstall"
        return $FALSE
    fi

    for dir in $REMOVE_DIR_LIST
    do
        echo "Removing $dir"
        chmod -R +w  $dir 2>/dev/null
        /bin/rm -fr  $dir
    done

    /bin/rm -f config/$feature.$version.startup

    return $WARN_DIR
}


#------------------------------------------------------------------------
# Main
#------------------------------------------------------------------------

# Run the script in the config directory only.
case "$SUBDIR" in
    install )
        # Invoke the uninstall script that is in the config directory
        if [ -x config/$CMD ]
        then
            config/$CMD $*
            exit $?
        else
            echo
            echo "Please use the $CMD script in the 'config' directory."
            Usage
        fi
        ;;
    config )
        : # This is what we want.
        ;;
    * )
        echo
        echo "Please use the $CMD script in the 'config' directory."
        Usage
esac

if [ $# -lt 2 ]
then
    Usage
fi


if [ ! -d releases ]
then
    Usage
fi

feature=$1
version=$2

echo
case $feature in
    rose|soda )
        echo "You are about to uninstall $feature.$version."
        ;;
    * )
        echo "You are about to uninstall $feature.$version and any base subsystem"
        echo "libraries that were installed with it.  Before doing so, make sure"
        echo "that all subsystem views that are using this release get remodeled"
        echo "to use the new release: remodel -model \$APEX_DEFAULT_MODEL <views>..."
        echo "You need to be in the new Apex environment to run the remodel command."
        ;;
esac


# Save license.dat file, if necessary
if [ -f releases/$feature.$version/license.dat ]
then
    if [ ! -f config/license.dat ]
    then
        if [ ! -d config ]
        then
            mkdir config
        fi

        # Save the license.dat file for future installs.
        cp  releases/$feature.$version/license.dat  config/license.dat
    fi
fi

base_components=releases/$feature.$version/install/base_components
if [ -f $base_components ]
then
    prod_base=`cat $base_components`
else
    prod_base=`/bin/ls -d1 base/*/*.ss/*.$version.rel 2>/dev/null`
fi

confirm_uninstall release releases/$feature.$version
confirm_uninstall base    "$prod_base"
        
if uninstall_dirs
then
    if [ -f config/install_db ]
    then
        echo "Removing $feature.$version entry from config/install_db" 
        grep -v "^$feature.$version " config/install_db > $TMP
        cp $TMP config/install_db
    fi
fi

warn owner

rm -f $TMP $TMP2