#!bin/sh # # $Revision: 1.13 $ # $Date: 2006/11/15 02:20:15 $ # LANG=C export LANG trap 'exit 3' 15 if [ "$PKG_INSTALL_ROOT" = "/" ]; then PKG_INSTALL_ROOT="" fi SUPPORT_UPGRADE="true" # first check it's upgrade install or fresh install. if [ "$SUPPORT_UPGRADE" = "true" ]; then PATH=/usr/sadm/bin:$PATH UPGR_SCRIPT=/tmp/upgr.$PKGINST UPGRADE_MSG="Do you want to upgrade the installed version ?" UPGRADE_HLP="If upgrade is desired, the existing version of the package will be replaced by this version. If it is not desired, this new version will be installed into a different base directory and both versions will be usable." UPGRADE_NOTICE="Conflict approval questions may be displayed. The listed files are the ones that will be upgraded. Please answer \"y\" to these questions if they are presented." CAN_UP="false" #pkginfo -v 2.4.0 -q SUNWsscs.\* pkginfo -q SUNWsscs.\* if [ $? -eq 0 ]; then # need the old pkg is 2.4 and MAXINST is bigger than 1. OldPkg=`pkginfo -x SUNWsscs.\* | nawk '/SUNW/{print $1} '` OldInst=`pkgparam $OldPkg MAXINST` if [ $OldInst -gt 1 ]; then CAN_UP="true" fi #OldVer=`pkgparam $OldPkg VERSION` #echo "OldPkg=$OldPkg OldInst=$OldInst OldVer=$OldVer CAN_UP=$CAN_UP" if [ "$CAN_UP" = "true" ]; then # See if upgrade is desired here response=`ckyorn -p "$UPGRADE_MSG" -h "$UPGRADE_HLP"` if [ $response = "y" ]; then # setup the pkgrm need admin file. sed -e "s/^\s*action=.*$/action=nocheck/g" \ /var/sadm/install/admin/default >/tmp/admin.$PKGINST # Initiate upgrade UPGR_FLAG=/tmp/upgr.SUNWsscs echo "PATH=/usr/sadm/bin:$PATH" > $UPGR_SCRIPT # handle only have two package then remove old one. echo "NINST=\`pkginfo SUNWsscs.\*|wc -l\`" >> $UPGR_SCRIPT echo "#echo NINST=\$NINST" >> $UPGR_SCRIPT echo "if [ \$NINST -gt 1 ]; then" >> $UPGR_SCRIPT echo " touch $UPGR_FLAG" >> $UPGR_SCRIPT echo " sleep 3" >> $UPGR_SCRIPT echo " echo Now removing old instance of $PKG" >> $UPGR_SCRIPT if [ ${PKG_INSTALL_ROOT} ]; then echo " pkgrm -a /tmp/admin.$PKGINST -n -R $PKG_INSTALL_ROOT $OldPkg" >> $UPGR_SCRIPT else echo " pkgrm -a /tmp/admin.$PKGINST -n $OldPkg" >> $UPGR_SCRIPT fi echo "fi" >> $UPGR_SCRIPT echo "rm /tmp/admin.$PKGINST" >> $UPGR_SCRIPT echo "rm $UPGR_SCRIPT >/dev/null 2>&1" >> $UPGR_SCRIPT echo "exit \$?" >> $UPGR_SCRIPT # Get the original package's base directory OldBD=`pkgparam $OldPkg BASEDIR` echo "BASEDIR=$OldBD" > $1 puttext -l 5 "$UPGRADE_NOTICE" cat >$1 </dev/null 2>&1 fi echo "Abort upgrade install." exit 1 fi else # the old package do not support upgrade install. echo "Remove package SUNWsscs and then try to install this package." exit 1 fi fi fi # # first check current arch. # CUR_ARCH=`uname -p` CUR_ARCH_EX=$CUR_ARCH if [ "$CUR_ARCH_EX" != "sparc" ]; then # may be it i86pc. CUR_ARCH_EX=i386 fi if [ "$CUR_ARCH_EX" != "i386" ]; then echo " " echo "This package can only be installed on i386 hardware." echo "This host appears to be a $CUR_ARCH system." echo "Please install the $CUR_ARCH version of this package instead." echo " " exit 1 fi # # Check Package is installed or not. # OTHER_ROOT="-R $PKG_INSTALL_ROOT" if [ "X$PKG_INSTALL_ROOT" = "X" ]; then OTHER_ROOT="" fi NEED_REMOVE_PKG_LIST="" for PKG_LIST in SUNWsscs SUNWscsd SUNWscsu SUNWscsa SUNWscui SUNWsccli SUNWfscs SUNWfscsd SUNWfscsu SUNWfscui SUNWjscs SUNWjscsd SUNWjscsu SUNWjscui SUNWjsccl SUNWcscs SUNWcscsd SUNWcscsu SUNWcscui; do pkginfo $OTHER_ROOT -q $PKG_LIST if [ $? -eq 0 ]; then NEED_REMOVE_PKG_LIST="$PKG_LIST $NEED_REMOVE_PKG_LIST" fi done if [ "X$NEED_REMOVE_PKG_LIST" != "X" ]; then echo " " echo "Remove below package(s) and then try to install this package." echo "$NEED_REMOVE_PKG_LIST" echo " " exit 1 fi # # First we check the JRE version for Console/DR # java -version 2>&1 | grep 'version "1.[2345]' >/dev/null 2>&1 if [ "$?" != "0" ]; then # # ask user to answer is it installed JRE 1.2 # echo "" echo "" echo "To find out the java version currently installed type #java -version" ans=`ckyorn -W 60 -Q -p "Is JRE 1.2.2, 1.3, 1.4, or 1.5 installed? "` if [ "$ans" = n -o "$ans" = no -o "$ans" = N -o "$ans" = NO ]; then echo "" echo "Install JRE 1.2.2, 1.3, 1.4, or 1.5 before installing the console." echo "Sun StorEdge(tm) Configuration Service needs JRE 1.2.2, 1.3, 1.4, or 1.5 to run." echo "The program will try to find it in /usr/java, /usr/jre," echo "/usr/local/java, or /usr/local/jre. " echo "If you installed the JRE in a directory other than" echo "one mentioned above, make a link." echo "" exit 1 fi fi # See if restore cfg is desired here RESTORE_CFG="false" RESTORE_MSG="The previous configuration was saved.\nDo you want to restore the configuration?" # only exist old cfg file save then ask user. if [ -f ${PKG_INSTALL_ROOT}/var/opt/SUNWsscs/sscscon.cfg.tar \ -o -f ${PKG_INSTALL_ROOT}/var/opt/SUNWsscs/sscsagt.cfg.tar \ -o -f ${PKG_INSTALL_ROOT}/var/opt/SUNWsscs/ssdgrptui.cfg.tar \ -o -f ${PKG_INSTALL_ROOT}/var/opt/SUNWsscs/ssdgrptd.cfg.tar \ ]; then ans=`ckyorn -p "$RESTORE_MSG "` if [ $ans = "y" ]; then RESTORE_CFG="true" else if [ $ans = "q" ]; then exit 1 else RESTORE_CFG="false" fi fi fi # # save env vars # cat >$1 <