#!/bin/ksh
#
# ident "@(#)gl_defs.ksh	1.16 02/09/11 SMI"
#
# Copyright 2001-2002 Sun Microsystems, Inc.  All rights reserved.
#
#

#
# global variables definition
#
# NOTE: 
# These variables must be set by the master task:
#
# G_MEDIA_DIR which contains the pathname of modules, support_lib directories
#             (otherwise master task cannot source this library)
# G_PRODUCT_DIR which contains the pathname of the Sun Ray bundle area (SWS,
#             SunDs, ...)

# find temporary directory location
if [[ -d /var/tmp ]]; then
   export G_TMP_DIR=/var/tmp
elif [[ -d /tmp ]]; then
   export G_TMP_DIR=/tmp
elif [[ -d /usr/tmp ]]; then
   export G_TMP_DIR=/usr/tmp
else
   echo "$0: Error, cannot find a temporary directory"
   exit 1
fi

export G_PROGRAM_ID="$(basename $0)"
export G_MODE="install"
export G_ADMIN_FILE="${G_MEDIA_DIR}/admin_default"
export G_DEBUG="no"
export G_QUICK_INSTALL="no"

#
# pre-defined variables
#

export G_ADM_LOG_DIR="/var/adm/log"
export G_TIME_STAMP="$(date '+%Y_%m_%d_%H:%M:%S')"
export G_UT_PROD_NAME="Sun Ray server"
export G_UT_VERSION="2.0"
export G_LOGFILE="${G_ADM_LOG_DIR}/${G_PROGRAM_ID}.${G_TIME_STAMP}.log"
export G_UPGRADE_DIR="${G_TMP_DIR}/SUNWut.upgrade"
export G_OLD_PRESERVED_FILE="USE_OLD_PRESERVED"
export G_DAEMON_LOC="/etc/init.d"
export G_PID="$$"

export G_ACTIVITYM_PID=""
export G_MESSAGE_FILE="${G_TMP_DIR}/${G_PROGRAM_ID}.${G_PID}.message"

# Current installed Sun Ray version.  It will be empty if not installed.
export G_SR_CURRENT_VERSION=$(pkgparam SUNWutr VERSION 2>&- | cut -d_ -f1)

# Sun Ray Server Software directory
export G_SUNRAY_SERVER_DIR="Sun_Ray_Server_Software_2.0"
