#!/bin/ksh # Copyright 12/17/99 Sun Microsystems, Inc. All Rights Reserved. # "@(#)iplanet_remove 1.80 99/12/17 Sun Microsystems" ################################################################ # # Set up the environment # ECHO=/bin/echo EXPR=/usr/bin/expr AWK=/usr/bin/awk INSTALL_LOG=/var/opt/SUNWstnr/debug/iplanet_remove.log.$$ PRODUCTNAME="i-Planet WebTop" KEYBASE=/etc/opt/SUNWstnr KEYSTORE=$KEYBASE/rp.keystore KEYSTOREPASSFILE=$KEYBASE/.rppass CASTORE=$KEYBASE/rp.CAstore ################################################################ # # packages to remove # GW_PKG_LIST="SUNWsnrp SUNWsrman" #SIC_PKG_LIST="SICGbdcdr SICGcrc2 SICGcrc4 SICGes SICGkisup SICGkeymg" PLAT_PKG_LIST="SUNWsnad SUNWsrlgs SUNWsrlg SUNWsrcm SUNWsrdoh SUNWsrdmn \ SUNWsrjd SUNWsrsin" APPS_PKG_LIST="SUNWsndt SUNWsnsvs SUNWsnps SUNWsnut SUNWsrfl SUNWsrnm \ SUNWwa SUNWwasn SUNWsrcm SUNWrwin SUNWsrdoh SUNWsrua SUNWsrsmb \ SUNWsrjd SUNWsrssl SUNWsrtrn SUNWwa SUNWwasn" ALL_GW_PKG_LIST="$GW_PKG_LIST" DEF_PLAT_PKG_LIST="$PLAT_PKG_LIST $APPS_PKG_LIST" ALL_PKG_LIST=" \ $GW_PKG_LIST \ $PLAT_PKG_LIST \ $APPS_PKG_LIST" ################################################################ # # # remove_platform_conf() { if [ "$CLEANUP" -eq 1 ] then rm -f /etc/opt/SUNWstnr/platform* fi } ################################################################ # # # RemoveIfPresent() { pkginfo $1 > /dev/null 2>&1 if [ $? -eq 0 ]; then pkgrm -n -a /tmp/swsadmin.$$ $1 fi; } ################################################################ # # # nes_remove() { if [ -f "/.wsinstalled" ]; then $ECHO "After uninstall, some Netscape Server files will be left on the" $ECHO "system in: $basedir/netscape/server4" $ECHO "Included in these files will be any certificate databases you" $ECHO "have created." $ECHO $ECHO "You may choose to have this program completely remove these" $ECHO "files, or leave them. If you choose to leave them, please" $ECHO "note you will not be able to re-install $PRODUCTNAME on this" $ECHO "system until they are removed." $ECHO $ECHO "Remove all remaining Netscape Server files after uninstall? y/[n] \c" if [ "$auto" = "1" ]; then remove=y else read remove fi pkginfo -q SUNWsnad #> /dev/null 2>&1 if [ $? -eq 0 ]; then basedir=`pkginfo -i -l SUNWsnad | $AWK '/BASEDIR/ { print $2 }'` fi # in ad isn't installed, try to assume /opt basedir=${basedir:-"/opt"} CONTROL_SCRIPT="/etc/init.d/iplanet_serv" if [ -f "$CONTROL_SCRIPT" ]; then # if the nes control script is there, try to stop the server $ECHO "Stopping webserver ... \c" $CONTROL_SCRIPT stop >$INSTALL_LOG 2>&1 $ECHO "done" else $ECHO $ECHO "No $PRODUCTNAME control script found. Please be sure all" $ECHO "webserver processes are stopped afer uninstall." fi UNINSTALL="$basedir/netscape/server4/uninstall" if [ ! -f "$UNINSTALL" ]; then # no uninstall script $ECHO "Webserver uninstall script not found, cannot uninstall" return else cd "$basedir/netscape/server4" $ECHO "Uninstalling webserver ... \c" $UNINSTALL -s -u admin -p admin > $INSTALL_LOG 2>&1 $ECHO "done" fi #tmp file we use to indicate we installed the webserver rm -f /.wsinstalled if [ "$remove" = "Y" ] || [ "$remove" = "y" ]; then cd "/" $ECHO "Removing $basedir/netscape/server4 ... \c" rm -rf $basedir/netscape/server4 $ECHO "done" fi fi } ################################################################ # # # remove_license_tools() { if [ -f "/.licinstalled" ]; then LICPKGS="SUNWlicsw SUNWlit" for LP in $LICPKGS do pkginfo -q $LP if [ $? -eq 0 ]; then $ECHO " $LP..." pkgrm -n -a $EMRMADMIN $LP >> $INSTALL_LOG 2>&1 fi done rm -f /.licinstalled fi } ########################################### # # # check_for_keystore() { #check for and remind of keystore if [ -f $KEYSTORE ] ; then $ECHO $ECHO "NOTE: The removal script found a keystore file at: $KEYSTORE" $ECHO "If you have installed a SSL server certificate from a" $ECHO "Certificate Authority (CA) (other than the self-signed" $ECHO "certificate generated at install), make sure to save the" $ECHO "keystore file, as it contains the private key used to validate" $ECHO "your SSL server certificate." $ECHO fi if [ -f $CASTORE ] ; then $ECHO $ECHO "NOTE: The removal script found an imported Certificate Authority certificate" $ECHO "file at: $CASTORE" $ECHO "If you have imported a root CA certificate to use a Server Certificate from" $ECHO "a CA other than Verisign, you must re-import the root CA certificate" $ECHO "to use the Server Certificate if you re-install the product." $ECHO fi } ############################################################################ # # create the admin file used by pkgrm # display_installed_bundles() { $ECHO "The following package bundles are currently installed on this system..." CLEANUP=0 grep -w SUNWsnad /tmp/pkg_installed.tmp > /dev/null 2>&1 if [ $? = 0 ] then $ECHO " $PRODUCTNAME Server" platform_installed=1 CLEANUP=`$EXPR $CLEANUP + 1` else platform_installed=0 fi grep -w SUNWsnrp /tmp/pkg_installed.tmp > /dev/null 2>&1 if [ $? = 0 ] then $ECHO " $PRODUCTNAME Gateway" rp_installed=1 CLEANUP=`$EXPR $CLEANUP + 1` else rp_installed=0 fi } ############################################################################ # # create the admin file used by pkgrm # create_admin_file() { EMRMADMIN=/tmp/srrmadmin $ECHO "action=nocheck" > $EMRMADMIN $ECHO "idepend=nocheck" >> $EMRMADMIN $ECHO "rdepend=nocheck" >> $EMRMADMIN $ECHO "mail=" >> $EMRMADMIN } ########################################### # # check if root user # check_root_user() { if test `id | /usr/bin/awk '{print $1}'` != "uid=0(root)" then $ECHO "You must be root user to run $0" exit 1 fi } ########################################### # # create debug directory # create_remove_log() { if [ ! -d /var/opt/SUNWstnr/debug ] then mkdir -p /var/opt/SUNWstnr/debug fi } ########################################################################### ########################################################################### # # rmsel=0 auto=0 while getopts :sgba opt; do case $opt in a) auto=1 ;; s) rmsel=1 ;; g) rmsel=2 ;; b) rmsel=3 ;; \?) print "unrecognized argument: $opt" exit 1 ;; esac done shift $(($OPTIND - 1)) check_root_user create_remove_log if [ "$rmsel" = "0" ]; then #while [ 1 ] #do /usr/bin/pkginfo > /tmp/pkg_installed.tmp $ECHO $ECHO $ECHO $ECHO "***************************************************************" $ECHO " Removing $PRODUCTNAME Packages" $ECHO "***************************************************************" $ECHO $ECHO display_installed_bundles $ECHO $ECHO "Please select one of the bundles to remove..." $ECHO "1) Server" $ECHO "2) Gateway" $ECHO "3) All" $ECHO "4) Quit" $ECHO "-------------------------" $ECHO "choice: [4] \c" read rmsel fi create_admin_file case $rmsel in 1) $ECHO $ECHO "Removing $PRODUCTNAME Server componenets ... " nes_remove $ECHO "Removing core $PRODUCTNAME server packages:" for i in $DEF_PLAT_PKG_LIST do pkginfo $i > /dev/null 2>&1 if [ $? -eq 0 ]; then $ECHO " $i..." pkgrm -n -a $EMRMADMIN $i >> $INSTALL_LOG 2>&1 fi done #remove_license_tools remove_platform_conf rm -f /etc/opt/SUNWstnr/console.conf rm -f /etc/opt/SUNWstnr/log.conf* ;; 2) $ECHO $ECHO "Removing $PRODUCTNAME Gateway..." $ECHO "Removing core $PRODUCTNAME gateway packages:" for i in $ALL_GW_PKG_LIST do pkginfo $i > /dev/null 2>&1 if [ $? -eq 0 ]; then $ECHO " $i..." pkgrm -n -a $EMRMADMIN $i >> $INSTALL_LOG 2>&1 fi done remove_platform_conf check_for_keystore ;; 3) $ECHO $ECHO "Removing all $PRODUCTNAME components ... " nes_remove if [ $both_pa=1 ]; then $ECHO "Removing core $PRODUCTNAME packages ... " for i in $ALL_PKG_LIST do pkginfo $i > /dev/null 2>&1 if [ $? -eq 0 ]; then $ECHO " $i..." pkgrm -n -a $EMRMADMIN $i >> $INSTALL_LOG 2>&1 fi done #remove_license_tools rm -f /etc/opt/SUNWstnr/console.conf rm -f /etc/opt/SUNWstnr/platform.conf* fi check_for_keystore ;; *) break ;; esac #done