#!/bin/sh 
# Copyright (c) 2001 Sun Microsystems, Inc., All Rights Reserved 
#
# Request script for SUNWutws.
# Determine if an upgrade is to be executed.
#
# Note that this script is only run by direct pkgadd,
# not through the ISP installer (nor SEAS).
#
trap 'exit 3' 15
#

UPGRADE=no

PROMPT="There are server configurations listed in $INSTALL_ROOT/etc/opt/SUNWut/http/httpd-instances.conf.\n Reuse those configurations? (If necessary, they will be converted for SRAS1.0)"

# 
# See if there's reason to believe there are existing configurations.
#
if [ -r $INSTALL_ROOT/etc/opt/SUNWut/http/httpd-instances.conf ]; then

    SERVER_LIST=`cat $INSTALL_ROOT/etc/opt/SUNWut/http/httpd-instances.conf | grep -v '#' | awk '{ print $2  }' `

    if [ -n "$SERVER_LIST" ]; then

	YN=`ckyorn -p "$PROMPT" -d y` || exit $?

#	See 'checkinstall' - this is polite bailout.
	if [ $? -eq 3 ]; then
		echo "quitinstall" >> $1
	fi;

	if [ "$YN" = "Y"  -o "$YN" = "YES" -o "$YN" = "yes" \
	    -o "$YN" =  "y" ]; then
		YN="yes"
	else
		YN="no"
	fi

	if [ "$YN" = "yes" ]; then
		UPGRADE=yes
	fi;
    fi;

fi;
echo DO_UPGRADE=$UPGRADE >> $1

