#!/bin/ksh -p
#
# ident "@(#)M20SRAS.ksh	1.46 05/05/27 SMI"
#
# Copyright 2001-2002,2004,2005 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

#
# MODULE NAME: Sun Ray Admin Server (SRAS)
# AUTHOR     :
# DESCRIPTION: To manage installation and upgrade of SRAS packages 
#
# The following exported variables (initialized by the master task) are 
# available (read-only) for the module:
#
# G_PROGRAM_ID    : program name
# G_MEDIA_DIR     : pathname of the install directory on the media (CD,...)
# G_PRODUCT_DIR   : pathname of the bundles directory on the media (CD,...)
# G_ADMIN_FILE    : pathname of the admin file used by pkgadd.
#                   default provided.
# G_DEBUG         : debug on/off. Possible values "yes", "no"
# G_QUICK_INSTALL : used to force a quick install (no user inputs).
#                   possible values "yes", "no"
# G_TMP_DIR       : pathname of the temporary directory 
# G_UT_PROD_NAME  : product name
# G_UT_VERSION    : product version
# G_DAEMON_LOC    : location of OS daemon scripts
# G_LOGFILE       : pathname of the log file.
#

#
# LOCAL FUNCTIONS
#
#

EstablishUtconfig_Env(){

  ETC_OPT_UT="$UT_ETC_DIR" 
  VAR_OPT_UT="$UT_VAR_DIR"
  THIS_HOST=$(uname -n)
  TMP_DIR_PATH="${UT_VAR_DIR}/tmp"
  TMP_PROGID=${TMP_DIR_PATH}/$G_PROGRAM_ID.$$
  TMP_FILE="${TMP_PROGID}.tmp"
  TMP_CONF_FILE="${TMP_PROGID}.conf"

  # XXX Core package location cannot be determined due to current
  # remove order.
  # SUNWuto, SUNWuta are removed prior to SRAS.
  # UTA_BASEDIR="$(${G_MEDIA_DIR}/utprodinfo -r SUNWuta)/SUNWut"
  # UTO_BASEDIR="$(${G_MEDIA_DIR}/utprodinfo -r SUNWuto)/SUNWut"
  UTA_BASEDIR="/opt/SUNWut"
  UTO_BASEDIR="/opt/SUNWut"

  UTADMIN_GROUP=utadmin
  UTCONF_FILE=${UT_ETC_DIR}/utadmin.conf

  UT_INST=""
  TOKEN_DIR="${UT_VAR_DIR}/cgitokens"
  
  EN_DOC_DIR="/opt/SUNWut/doc/en/html"
  JA_DOC_DIR="/opt/SUNWut/doc/ja/html"
  
  LOCAL_EN_DOC_DIR="lib/locale/en_US/docdir"
  LOCAL_FR_DOC_DIR="lib/locale/fr/docdir"
  LOCAL_JA_DOC_DIR="lib/locale/ja/docdir"
  LOCAL_ZH_DOC_DIR="lib/locale/zh/docdir"

  BEFORE="before.$G_PROGRAM_ID"
  DELETE_CGI_USER=true

  UT_INST=""
  UT_PORT=""
  SSLENABLE=""
  CGI_USER=""
  REMOTE_ENABLE=""

  typeset COMMENT="ut admin web server cgi user"
}

EstablishOldWebEnv(){

  UT_HTTP_BIN="/usr/bin"
  UT_HTTP_ETC="/etc/http"
  UT_HTTP_VAR="/var/http"

  # Set the Product name to SWS for configuration library.
  PROD_NAME=$SWS_PROD_NAME
}


EstablishNewWebEnv(){

  UT_HTTP_BIN="/opt/SUNWut/http/bin"
  UT_HTTP_ETC="$UT_ETC_DIR/http"
  UT_HTTP_VAR="$UT_VAR_DIR/http"

  # Set the Product name to SWS for configuration library.
  PROD_NAME=$SRAS_PROD_NAME
}


#
# SWSVersion()
#
# Description:
#     Checks the version of SWS installed. 
#
# Parameters:
#    
#
# Globals used:
#
SWSVersion() {
  typeset -r pkg="SUNWhttp"

  $G_MEDIA_DIR/utprodinfo -t installed $pkg || return 1
  SWS_INSTALLED_VERSION="$($G_MEDIA_DIR/utprodinfo -p $pkg VERSION 2>&-)"

  if CompareVersion "$SWS_INSTALLED_VERSION" $1; then
     # matches
     return 0
  fi
  return 1
}


#
# MakeSRASAdmin()
#
# Description:
#    Generates an admin file for use during the pkgadd and pkgrm of the Sun
#    Ray Admin Server packages.
#    Note: Also used in pkgrm of old Sun Web Packages.
#
# Parameters:
#    (none)
#
# Globals used:
#    
MakeSRASAdmin(){
  cat > $SRAS_ADMIN_FILE <<-!
	# Default admin file for SRAS installation.
	#
	mail=
	instance=overwrite
	partial=nocheck
	runlevel=quit
	idepend=nocheck
	rdepend=nocheck
	space=quit
	setuid=nocheck
	conflict=nocheck
	action=nocheck
	basedir=default
	!
	return 0
}

InstalledSSLCheck(){

  #
  # Installation Encryption checks
  #

  if ! SRASVersion $SRAS_VERSION; then

    SSL_PKG_RM_LIST="$SRAS_SSL_PKG_OLD"
  elif ProductInstalled $SRAS_SSL_PKG_HI \
      && ! ProductPartiallyInstalled $SRAS_SSL_PKG_HI; then

    SSL_PKG_RM_LIST="$SRAS_SSL_PKG_HI"

  elif ProductInstalled $SRAS_SSL_PKG_LOW \
      && ! ProductPartiallyInstalled $SRAS_SSL_PKG_LOW; then

    SSL_PKG_RM_LIST="$SRAS_SSL_PKG_LOW"

  fi

  return 0
}

DetermineHttpLocation(){

  EstablishUtconfig_Env
  # Determine location of any exisiting SRAS/SWS
  # Used to manage removal.
  if SRASConfigured; then
    if [[ -d /opt/SUNWut/http/bin ]]; then
      SRAS_CONFIG_LOCATION=new
      EstablishNewWebEnv
    elif [[ -d /usr/http/bin ]]; then
      SRAS_CONFIG_LOCATION=old
      EstablishOldWebEnv
    fi
    # Determine configuration and store the instance name for later use.
    SWSInfo
    EXIST_INSTANCE=$UT_INST
  elif IsDataPreserved; then
    # Allow restore to happen if tar bundle.
    SRAS_CONFIG_LOCATION=tar_bundle_no_config
  else
    # No configuration preserved or existing, so use this to bypass restore.
    SRAS_CONFIG_LOCATION=none
  fi
}


#
# SRAS_PreInstall()
#
# Description:  Pre-install procedure
#   Check the media against any existing installation.
#   Discover what needs to be installed
#
# Parameters:
#    (none)
#
# Globals used:
#    (none)
SRAS_PreInstall(){

  typeset sras_install="no"

  InstalledSSLCheck

  # If any SRAS packages exist then trigger the remove event.
  if AnyPackageInstalled $SRAS_PKG_LIST ; then
    
    ProductMsg -n "$SRAS_PROD_NAME $SRAS_INSTALLED_VERSION"
    SRAS_FULL_UNINSTALL="yes"
    _DO_REMOVE="yes"
    print "installed - will be removed"
    AddPostInitMessage "Remove\t [ $SRAS_PROD_NAME $SRAS_VERSION ]"

  fi
  # Check for any vestiges of SWS
  # This represents SRES 1.0 or other some other old SWS.
  if AnyPackageInstalled $SWS_PKG_LIST; then
    # Obtain SWS_INSTALLED_VERSION for later use.
    SWSVersion $SWS_VERSION
    ProductMsg -n "$SWS_PROD_NAME $SWS_INSTALLED_VERSION"
    SWS_OLD="yes"
    _DO_REMOVE="yes"
    print "installed - will be removed"
    AddPostInitMessage "Remove\t [ $SWS_PROD_NAME $SWS_INSTALLED_VERSION ]"
  fi

  if SRASConfigured ; then
    _SW_INSTALLED="yes"
  fi

  DetermineHttpLocation

  return 0
}


#
# SWS_PreUnInstall()
#
# Description:
#    Pre-UnInstall procedure: Determine if any SRAS packages/configuration.
#
# Parameters:
#    (none)
#
# Globals used:
#    (none)
SWS_PreUnInstall(){
      
  if AnyPackageInstalled $SRAS_PKG_LIST
  then
    if SRASConfigured; then
      Note "WARNING: SRAS configuration detected. Please run utconfig -u" \
	   "prior to uninstall."
    fi

    DetermineHttpLocation
    _DO_REMOVE="yes"
    SRAS_FULL_UNINSTALL="yes"
    AddPostInitMessage "Remove\t [ $SRAS_PROD_NAME $SRAS_VERSION ]"
    return 0
  fi
}


#
# SRAS_PrePreserve()
#
# Description:  Pre-Preserve procedure
#   Discover preserve context
#
# Parameters:
#    (none)
#
# Globals used:
#    (none)
SRAS_PrePreserve(){

  # Any configuration to preserve?
  # If configuration is in place, then packaging should be OK.
  if SRASConfigured; then

    DetermineHttpLocation
    # Trigger the preserve.
    _SW_INSTALLED="yes"
  fi

  if AnyPackageInstalled $SWS_PKG_LIST; then
    SWS_OLD="yes"
  fi

  return 0
}


#
# Module developers to provide the following functions:
# Module_Init, Module_Preserve, Module_Remove, Module_Install, Module_Restore
# Module_Abort, Module_Exit

#
# Module_Init()
#
# Description:
#   initialization of the module for installation, uninstallation
#   Any irregularities need to be disocovered here so that the user
#   may be warned and can abort prior to any work.
#
# Parameters:
#   (none)
#
# Globals used:
#

Module_Init(){

  set -u

  typeset exit_no=0
  . ${G_MEDIA_DIR}/support_lib/sras_config

  if IsInstallRequired; then
    SRAS_PreInstall
    exit_no=$?
    if IsDataPreserved || \
        SRASConfigured; then
      AddPostInitMessage \
         "Migrate\t [ Configuration for $SRAS_PROD_NAME $SRAS_VERSION ]"
    fi

  elif IsUninstallRequired; then
    SWS_PreUnInstall
    exit_no=$?

  elif IsPreserveRequired; then
    # XXX Ensure this is sufficient reason not too explore config?
    # This check protects us from incomplete SWSInfo in cases of no config.
    if SRASConfigured; then
      SRAS_PrePreserve
      SRAS_INSTALLED_VERSION="$($G_MEDIA_DIR/utprodinfo -p SUNWutws VERSION 2>&-)"
      AddPostInitMessage \
        "Preserve [ Configuration for $SRAS_PROD_NAME $SRAS_INSTALLED_VERSION ]"
    fi
  fi

return $exit_no
}

#
# Module_Preserve()
#
# Description:
#  
#
# Parameters:
#   (none)
#
# Globals used:
#

Module_Preserve(){

  set -u

  # Nothing to preserve.
  [[ $SRAS_CONFIG_LOCATION == none ]] && return 0

  . ${G_MEDIA_DIR}/support_lib/sras_config
  EstablishUtconfig_Env

  # Must ensure that preserve is not allowed to continue
  # unless configuration is actually in place.
  if [[ $SRAS_CONFIG_LOCATION == old ]]; then
    EstablishOldWebEnv
  elif [[ $SRAS_CONFIG_LOCATION == new ]]; then
    EstablishNewWebEnv
  elif [[ $SRAS_CONFIG_LOCATION == tar_bundle_no_config ]]; then
    Error "Internal: Preserve event called with preserve bundle in place."
  fi

  # Determine configuration.
  SWSInfo

  # Construct a new location version of the existing configuration
  # suitable for preserve and subsequent parsing by SWSInfo.
  # Needed if either location change _or_ instance change.
  if [[ $SRAS_CONFIG_LOCATION == old ]] || [[ $UT_INST != $UT_INST_F ]]; then

    mkdir -p ${UT_ETC_DIR}/http
    print "${UT_INST_F} ${UT_ETC_DIR}/http/${UT_INST_F}.httpd.conf enable" \
      > ${UT_ETC_DIR}/http/${HTTP_INST_FILE}
    print \
      "site_path ${UT_VAR_DIR}/http/${UT_INST_F}/websites/default_site\n" \
      "port ${UT_PORT}\n" \
      "ssl_enable ${SSLENABLE}\n" \
      "site_config \"conf/default_site.site.conf\"\n" \
      > ${UT_ETC_DIR}/http/${UT_INST_F}.httpd.conf

    mkdir -p ${UT_VAR_DIR}/http/${UT_INST_F}/${WEB_DEF_DIR}
    # Note: No instance configuration it derived from these files.
    # so no need to tweak internal instance values.
    cp ${UT_HTTP_VAR}/${UT_INST}/${SITE_CONF} \
      ${UT_VAR_DIR}/http/${UT_INST_F}/$SITE_CONF
    cp ${UT_HTTP_VAR}/${UT_INST}/${ACCESS_CONF} \
      ${UT_VAR_DIR}/http/${UT_INST_F}/$ACCESS_CONF

    # UT_INST_F is now the only allowed instance name.
    # Temporarily adjust the admin.http.cfile key with this instance for
    # UT_INST_F is now the only allowed instance name.
    # Temporarily adjust the admin.http.cfile key with this instance for
    # preserve.
    SetUtAdminKey admin.http.cfile ${UT_ETC_DIR}/http/${UT_INST_F}.httpd.conf
  fi

  SaveFiles $SRAS_PRESERVE_FILES
  if [[ $? != "0" ]]; then
     return 2
  fi

  # XXX Having completed preserve we should remove any of the temp conf
  # files created to populate the preserve.


  if [[ $SRAS_CONFIG_LOCATION != old ]] && [[ $UT_INST != $UT_INST_F ]]; then
    # Get back the old instance file back to allow SWSInfo for unconfigure.
    print "${UT_INST} ${UT_ETC_DIR}/http/${UT_INST}.httpd.conf enable" \
      > ${UT_ETC_DIR}/http/${HTTP_INST_FILE}
  fi

  # Re-adjust the admin.http.cfile key to allow SWSInfo for unconfigure.
  SetUtAdminKey admin.http.cfile ${UT_HTTP_ETC}/${UT_INST}.httpd.conf

  return 0
}

#
# Module_Remove()
#
# Description:
#    Remove SRAS/SWS as required
#
# Parameters:
#   (none)
#
# Globals used:
#

Module_Remove(){

  set -u
  typeset tmp_utconfig="no"
  typeset tmp_vartmp="no"
  typeset tmp_cgitokens="no"

  typeset pkg_uninstall=""
  typeset patch_uninstall=""

  if [[ $SRAS_FULL_UNINSTALL == "yes" ]]; then
    RemoveMsg "$SRAS_PROD_NAME" "$SRAS_INSTALLED_VERSION"
    case "$SRAS_INSTALLED_VERSION" in
	1*) pkg_uninstall="$SRAS_1X_PKGS"
	    ;;
	2*) pkg_uninstall="$SRAS_2X_PKGS"
	    ;;
    esac

  fi
  if [[ $SWS_OLD == "yes" ]]; then
    # An upgrade full SWS (old) product removal.
    RemoveMsg "$SWS_PROD_NAME" "$SWS_INSTALLED_VERSION"
    case "$SWS_INSTALLED_VERSION" in
      # XXX Are there any 1.x patches we need to be aware of.
      1*) pkg_uninstall="$pkg_uninstall $SWS_1X_PKGS"
          ;;
      2*) pkg_uninstall="$pkg_uninstall $SWS_2X_PKGS"
          patch_uninstall="$SWS_PATCH_LIST"
          ;;
    esac

  fi

  # Remove any SSL encryption packages.
  pkg_uninstall="$pkg_uninstall $SSL_PKG_RM_LIST"

  # Only attempt to unconfigure existing SRAS/SWS if it is configured.
  if [[ $SRAS_CONFIG_LOCATION == "old" ]] || \
      [[ $SRAS_CONFIG_LOCATION == "new" ]]; then

    . ${G_MEDIA_DIR}/support_lib/sras_config
    EstablishUtconfig_Env

    if [[ $SRAS_CONFIG_LOCATION == old ]]; then
      EstablishOldWebEnv
    elif [[ $SRAS_CONFIG_LOCATION == new ]]; then
      EstablishNewWebEnv
    fi

    # XXX Workaround for bug where /etc/opt/SUNWut/* /var/opt/SUNWut/* gets
    # removed by any module earlier in uninstall sequence.
    if [[ ! -d /var/opt/SUNWut/tmp ]]; then
      mkdir -p /var/opt/SUNWut/tmp
      tmp_vartmp="yes"
    fi
    if [[ ! -d /var/opt/SUNWut/cgitokens ]]; then
      mkdir -p /var/opt/SUNWut/cgitokens
      tmp_cgitokens="yes"
    fi
    if [[ ! -f ${UT_ETC_DIR}/utadmin.conf ]]; then
      touch ${UT_ETC_DIR}/utadmin.conf
      SetUtAdminKey admin.http.cfile \
	${UT_HTTP_ETC}/${EXIST_INSTANCE}.httpd.conf
      tmp_utconfig="yes"
    fi

    # Determine configuration and remove it.
    SWSInfo
    UT_INST_SITE=$UT_HTTP_VAR/$UT_INST/websites/default_site
    if [[ $SWS_OLD == "yes" ]]; then
        UnconfigOldSWS
    fi
    UnconfigSWS
    # Lose any temporary files and directories.
    [[ $tmp_utconfig == "yes" ]] && rm -f ${UT_ETC_DIR}/utadmin.conf
    [[ $tmp_vartmp == "yes" ]] && rm -rf /var/opt/SUNWut/tmp
    [[ $tmp_cgitokens == "yes" ]] && rm -rf /var/opt/SUNWut/cgitokens
  fi

  # Perform the product remove.
  if [[ -n $patch_uninstall ]]; then
    if ! RemovePatch $patch_uninstall; then
  
      Note "$SWS_PROD_NAME patch $patch_uninstall not successfully." \
        "removed"
      return 1
    fi
  fi
  MakeSRASAdmin
  # Remove based on full possible list of packages
  if ! RemoveProduct $SRAS_ADMIN_FILE $pkg_uninstall; then

     # XXX This message to be more specific
     Note "$SWS_PROD_NAME not successfully removed"
     rm $SRAS_ADMIN_FILE 2> /dev/null
     return 1
  fi

  rm $SRAS_ADMIN_FILE 2> /dev/null
  rm -f $SRAS_CORE_FILES 2> /dev/null
  rm -rf $UT_HTTP_VAR/${UT_INST_F} 2> /dev/null
  rm -f $UT_HTTP_ETC/$UT_INST.httpd.conf* 2> /dev/null
  rm -rf /opt/SUNWut/http/src/* 2> /dev/null
  return 0
}


#
# Module_Install()
#
# Description:
#    To install Sun Ray Administration Server
#
# Parameters:
#   (none)
#
# Globals used:
#

Module_Install(){

    return 0
}

#
# Module_Restore()
#
# Description:
#    Restore saved configuration data
#
# Parameters:
#   (none)
#
# Globals used:
#

Module_Restore(){

  set -u

  #
  # need to restore from a previously preserved data.
  # this is needed to support the case when the tarfile is installed
  # on a clean system.
  #
  if [[ $SRAS_CONFIG_LOCATION == none ]]; then
    if IsModuleDataPreserved; then
      SRAS_CONFIG_LOCATION=new
    else
      typeset CURR_MOD=$_MODULE_NAME
      _MODULE_NAME=M15LDAP
      if ! IsModuleDataPreserved; then
        return 0
      fi
      _MODULE_NAME=$CURR_MOD
      SRAS_CONFIG_LOCATION=old
    fi
  fi

  # Only attempt restore if necessary.
  if [[ $SRAS_CONFIG_LOCATION != none ]]; then
    echo "Restoring SRAS configuration."
 
    typeset preservedfile
    typeset path
    typeset file
 
    . ${G_MEDIA_DIR}/support_lib/sras_config
    EstablishUtconfig_Env
    EstablishNewWebEnv
  
    # For file restore, need to re-establish the complete path.
    mkdir -p ${UT_VAR_DIR}/http/${UT_INST_F}/${WEB_DEF_DIR}

    # utadmin.conf has strong coupling with other module(s).
    # The current version of this file may have migration changes applied by
    # module called earlier in the framework.
    # SRAS will be restoring a potentially older copy to determine the
    # original SRAS/SWS configuration.
    # Make a copy of the file ensuring perms are retained.
    if [[ -f ${UT_ETC_DIR}/utadmin.conf ]]; then
      cp -p ${UT_ETC_DIR}/utadmin.conf ${UT_ETC_DIR}/utadmin.conf.migrated
    fi

    # Restore preserved files
    for file in $SRAS_PRESERVE_FILES; do
       if GetPreservedFilePath "$file"; then
          preservedfile=${_RETURN_VAL}
          cp -p "$preservedfile" "$file"
       fi
    done

    # Check for configuration from the restored files.
    if ! SRASConfigured; then
      # No configuration to restore.
      rm -f ${UT_ETC_DIR}/utadmin.conf.migrated
      return 0
    fi
    SWSInfo
    UT_INST_SITE=$UT_HTTP_VAR/$UT_INST/websites/default_site

    # Lose all temporarily restored SRAS config files and directories.
    # Note: Keep utadmin.conf as we may be the first to change it.
    rm $SRAS_PRESERVE_FILES
    rm -rf ${UT_VAR_DIR}/http/${UT_INST_F}

    # Having obtained the configuration, replace back the most current
    # version of utadmin.conf ensuring correct perms.
    if [[ -f ${UT_ETC_DIR}/utadmin.conf.migrated ]]; then
      cp -p ${UT_ETC_DIR}/utadmin.conf.migrated ${UT_ETC_DIR}/utadmin.conf
      rm -f ${UT_ETC_DIR}/utadmin.conf.migrated
    fi

    UT_HOSTNAME=`hostname`
    if [[ $REMOTE_ENABLE == "+" ]]; then
        REMOTE="yes"
    else
        REMOTE="no"
    fi
    mkdir -p ${UT_ETC_DIR}/http
    # Save the SRAS config into HTTPCFG which is picked up by the M21HTTP preserve
    # and restored there as well.
    typeset -r dstdir=$(dirname $HTTPCFG)
    if [[ ! -e $dstdir ]]; then
	mkdir -p $dstdir >/dev/null 2>&1
    fi
    print "Port $UT_PORT\n" \
          "User $CGI_USER\n" \
          "Group $UT_INST_F\n" \
          "ServerName $UT_HOSTNAME\n" \
          "RemoteAdmin $REMOTE\n" \
        > $HTTPCFG
    echo "Restoration of SRAS configuration complete."
  fi

  return 0
}

#
# Module_Abort()
#
# Description:
#    Abort procedure
#
# Parameters:
#   (none)
#
# Globals used:
#

Module_Abort() {

   return 0
}

#
# Module_Exit()
#
# Description:
#    Exit procedure (normal termination)
#
# Parameters:
#   (none)
#
# Globals used:
#

Module_Exit() {

   return 0

}

#
# MAIN STARTS HERE
#

trap "exit 2" HUP INT QUIT TERM

#
# include libraries
#

. ${G_MEDIA_DIR}/support_lib/iu_lib
. ${G_MEDIA_DIR}/support_lib/module_lib
. ${G_MEDIA_DIR}/support_lib/upgrade_lib
. ${G_MEDIA_DIR}/support_lib/util_lib

export _EVENT=$1
export _MODULE_NAME=$(basename $0)
export _VARS_LIST=""
export _EXIT_CODE=0
export _RETURN_VAL=0
export _VAR_STORAGE_FILE="${G_TMP_DIR}/.${G_PROGRAM_ID}.${_MODULE_NAME#???}"

DeclareModuleVar _DO_INSTALL="no"
DeclareModuleVar _DO_REMOVE="no"
DeclareModuleVar _SW_INSTALLED="no"
DeclareModuleVar _SW_COMPATIBLE="yes"

#
# BEGIN: Developers module variables definition here
#

# XXX Generic versions of these surely exist elsewhere.
export UT_ETC_DIR="/etc/opt/SUNWut"
export UT_VAR_DIR="/var/opt/SUNWut"

export WEB_DEF_DIR="websites/default_site/conf"

export UT_INST_F="utadmin"
export HTTP_CFG_F="${UT_INST_F}.httpd.conf"
export HTTP_INST_FILE="httpd-instances.conf"
export SITE_CONF="${WEB_DEF_DIR}/default_site.site.conf"
export ACCESS_CONF="${WEB_DEF_DIR}/access.conf"

# the converted preserve file location for the M21HTTP module
export HTTPCFG="${G_UPGRADE_DIR}/preserve/M21HTTP/etc/opt/SUNWut/http/http.conf"

export SRAS_CORE_FILES="${UT_ETC_DIR}/http/$HTTP_INST_FILE \
                        ${UT_ETC_DIR}/http/$HTTP_CFG_F \
                        ${UT_VAR_DIR}/http/${UT_INST_F}/$SITE_CONF \
                        ${UT_VAR_DIR}/http/${UT_INST_F}/$ACCESS_CONF 
                        "

export SRAS_PRESERVE_FILES="${UT_ETC_DIR}/utadmin.conf \
                            $SRAS_CORE_FILES
                            "
DeclareModuleVar SSL_PKG_RM_LIST
DeclareModuleVar SWS_INSTALLED_VERSION

DeclareModuleVar SRAS_INSTALLED_VERSION
DeclareModuleVar SRAS_CONFIG_LOCATION="none"
DeclareModuleVar EXIST_INSTANCE

# State vars to control the Module_XXX operations.
DeclareModuleVar SWS_OLD="no"
DeclareModuleVar SRAS_FULL_UNINSTALL="no"

DeclareModuleVar SRAS_PROD_NAME="Sun Ray Admin Server"
DeclareModuleVar SRAS_VERSION="2.0"
typeset -r SRAS_PKG_LIST="SUNWutws SUNWutwsc"

typeset -r SWS_PROD_NAME="Sun Web Server"
typeset -r SWS_VERSION="2.1"
typeset -r SWS_PKG_LIST="SUNWhttp SUNWhttpc"
typeset -r SWS_PATCH_LIST="107609-03"

typeset -r SRAS_SSL_PKG_HI="
        SUNWutskd SUNWutskr SUNWutssd
	"
typeset -r SRAS_SSL_PKG_LOW="
        SUNWutsko SUNWutskr SUNWutss
	"
typeset -r SRAS_SSL_PKG_OLD="
        SUNWski   SUNWskicw SUNWskild SUNWssld
        SUNWskimu SUNWskimc SUNWskica SUNWssl
        "
typeset -r SRAS_ADMIN_FILE="/tmp/${G_PROGRAM_ID}.${G_PID}.sras_admin_default"

typeset -r SWS_1X_PKGS="
        SUNWhttpu SUNWhttpv SUNWhttpr SUNWskica
        SUNWskimc SUNWskimu SUNWssld  SUNWssl
        SUWNskild SUNWskicw SUNWski
	"
typeset -r SWS_2X_PKGS="
        SUNWhttpc SUNWhtsvl SUNWhtadm SUNWhttp
        SUNWhtdoc SUNWhtman SUNWixklg SUNWixavm
        SUNWski   SUNWskicw SUNWssl   SUNWskimu
        SUNWskimc SUNWskica SUNWskild SUNWssld
	"
typeset -r SRAS_1X_PKGS="
        SUNWutwsc SUNWhtsvl SUNWhtadm SUNWutws
        SUNWhtdoc SUNWhtman SUNWixklg SUNWixavm
        SUNWski   SUNWskicw SUNWssl   SUNWskimu
        SUNWskimc SUNWskica SUNWskild SUNWssld
	"
typeset -r SRAS_2X_PKGS="
        SUNWutwsc SUNWutws  SUNWutskd SUNWutsko
        SUNWutskr SUNWutssd SUNWutss
        "

UTCONFIG_LOG="${G_DIR_TMP}/utconfig.${G_TIME_STAMP}.log"


#
# END
#

#
# FRAMEWORK CODE 
#

. ${G_MEDIA_DIR}/support_lib/framework_lib
