#!/bin/ksh # # @(#)wasetup 1.0 1998/09/23 SMI # Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. # # wasetup is the main setup script for Sun Web Access. # # Revision History: # --------------------------------------------------------- # 10/21/1998 Marc Latour Modified for Webaccess # # aliases of common utilities GREP=/bin/grep PS=/bin/ps KILL=/bin/kill CAT=/bin/cat AWK=/bin/awk PKGADD=/usr/sbin/pkgadd PKGRM=/usr/sbin/pkgrm PKGINFO=/usr/bin/pkginfo PKGPARAM=/usr/bin/pkgparam TEE=/usr/bin/tee EXPR=/bin/expr HEAD=/bin/head SORT=/bin/sort CUT=/bin/cut SED=/bin/sed TR=/usr/bin/tr BASENAME=/usr/bin/basename DOMAINNAME=/bin/domainname RM=/bin/rm MV=/usr/bin/mv CP=/bin/cp MKDIR=/usr/bin/mkdir # i18n # assumption, caller (setup-tty) exports TEXTDOMAIN and TEXTDOMAIN_DIR gettext=/usr/bin/gettext # minimum system requirement variables SPACEREQD_OPT=90000 SCSOPTDIR="/opt" SPACEREQD_USR=10500 SCSUSRDIR="/usr" MEMORY_REQD=64 SCSVARDIR="/var" SPACEREQD_VAR=20000 # aliases for special characters, used in eval statements and gettext AMPERSAND='&' DOLLAR='$' NEWLINE='\n' TAB='\t' FORWARDQUOTE="'" BACKQUOTE='`' DOUBLEQUOTE='"' LBRACKET='<' RBRACKET='>' OPEN='(' CLOSE=')' BAR='|' # WA version PRODUCT_FULL_NAME="Sun Web Access(tm)" PRODUCT_SHORT_NAME="WA" WA_MAJOR_VERSION=1 WA_MINOR_VERSION=0 WA_POINT_VERSION=3 WA_VERSION=${WA_MAJOR_VERSION}.${WA_MINOR_VERSION}.${WA_POINT_VERSION} # files used during installation # TODO: modify these!! SETUP_DATA_FILE=/tmp/wasetup.dat SAVED_DATA_FILE=/var/opt/SUNWwa/log/wasetup.dat ADMIN_FILE="/tmp/wa_admin" _waRespFile="/tmp/wa_response" _hostname=`LC_ALL=C; /sbin/uname -n` DEFAULT_EMAIL_DOMAIN=`LC_ALL=C; /usr/bin/domainname"` #installation status codes, component names and status filename INSTALL_STATUS_FILE="/tmp/wa_status" CALENDAR=calendar WEBACCESS=webaccess REBOOT=reboot LOG=log ALL_OK=0 CONFIG_FAILURE=1 INSTALL_FAILURE=2 NOT_INSTALLED=3 DO_UPGRADE=0 # # definition of yes/no values used in this script # _no=0 _yes=1 DATESTAMP=`date '+%y%m%d.%H:%M'` INSTALL_LOG=/tmp/WA_installation_log.${DATESTAMP} INSTALL_LOG_FINAL_PLACE=/var/opt/SUNWwa/log/WA_installation_log.${DATESTAMP} CLEAR="/usr/bin/tput clear" # misc. variables used in the install scripts ARCH=`LC_ALL=C; uname -p` typeset -l COMMANDARG COMMANDARG=install typeset -l VERSIONARG VERSIONARG=Sims INTERACTIVE=true SILENT=false CURRENT_DIR=`LC_ALL=C; pwd` HOSTNAME=`LC_ALL=C; uname -n` SUBDIR=wa # setup the directory from where the packages are installed # if [ -f /tmp/.solsticedir/CDROM ]; then CDROM=`$CAT /tmp/.solsticedir/CDROM` TEXTDOMAINDIR=$CDROM/products/scs/locale/${ARCH} DIST_DIR="$CDROM/products/${SUBDIR}/Image/${ARCH}" PATCH_DIR="$CDROM/etc/patches" else RELATIVE_DIR=`/bin/dirname $0` TEXTDOMAINDIR=$RELATIVE_DIR/locale/${ARCH} DIST_DIR=$RELATIVE_DIR/Image/${ARCH} PATCH_DIR="$RELATIVE_DIR/../../etc/patches" fi #----------------------------------------------------------- # I18N/L10N stuffs #----------------------------------------------------------- if [ ! -z "$LC_MESSAGES" ]; then LANG=$LC_MESSAGES fi if [ -z "$LANG" ]; then LANG="C" fi if [ ! -d ${TEXTDOMAINDIR}/${LANG} ]; then # Strip off the dialect component TMPLANG=`echo $LANG | $CUT -f1 -d.` if [ ! -d ${TEXTDOMAINDIR}/${TMPLANG} ]; then # Strip off the regional component TMPLANG=`echo $TMPLANG | $CUT -f1 -d_` if [ ! -d ${TEXTDOMAINDIR}/${TMPLANG} ]; then # Language not supported, default to C TMPLANG="C" fi fi LANG=$TMPLANG fi export LANG TEXTDOMAIN=config export TEXTDOMAIN export TEXTDOMAINDIR OSREV=`LC_ALL=C; /bin/uname -r` OSREV=${OSREV:-5.0} OSMAJOR=`echo $OSREV | $CUT -f1 -d.` OSMINOR=`echo $OSREV | $CUT -f2 -d.` L10NPACKAGES=`$gettext 'L10NPACKAGES'` L10NBASEPACKAGES=`$gettext 'L10NBASEPACKAGES'` L10NMUST_REMOVE_PKGS=`$gettext 'L10NMUST_REMOVE_PKGS'` if [ $L10NPACKAGES == "L10NPACKAGES" ]; then L10NPACKAGES="" fi if [ $L10NBASEPACKAGES == "L10NBASEPACKAGES" ]; then L10NBASEPACKAGES="" fi if [ $L10NMUST_REMOVE_PKGS == "L10NMUST_REMOVE_PKGS" ]; then L10NMUST_REMOVE_PKGS="" fi if [ $OSMAJOR -eq 5 -a $OSMINOR -eq 6 ]; then ICONVPACKAGES="SUNWjiu8j SUNWtiu8" fi #----------------------------------------------------------- # package names and patches to be installed #----------------------------------------------------------- # Sun WebAccess packages WAPACKAGES="SUNWjeev SUNWwa" # All packages ALLPACKAGES=${WAPACKAGES} #--------------------------------------------------------- # trap uses "finally" to be read and executed when the # shell receives singal: 0, 1, 2, 3, and 15. #--------------------------------------------------------- trap 'finally' 0 1 2 3 15 #----------------------------------------------------------- # variable that go into the wasetup.dat file # Directory parameters #----------------------------------------------------------- INSTALL_MODE= SELECT_OPTION= OLD_SCS_BASE= _savedConf= webaccess= rconsole= #================================================================= # runtime_environment() - set the runtime environments #================================================================= runtime_environment() { return 0 } #================================================================= # killproc() - kill process #================================================================= killproc() { pid=`$PS -ef | $GREP "$2" | $GREP -v $GREP | $AWK '{ print $2 }'` if [ "$pid" != "" ] then $KILL -$1 $pid return 0 else return 1 fi } #================================================================= # checkSystemState() - check system status #================================================================= # checks to see if the sytem has # - required memory # - required disk space # - required base OS # returns 0 on succesful completion checkSystemState() { _OSREV=`/bin/uname -r` _OSREV=${_OSREV:-5.0} _OSMAJOR=`echo $_OSREV | $CUT -f1 -d.` _OSMAJOR=${_OSMAJOR:-4} _OSMINOR=`echo $_OSREV | $CUT -f2 -d.` _OSMINOR=${_OSMINOR:-0} _OSMINORMINOR=`echo $_OSREV | $CUT -f3 -d.` _OSMINORMINOR=${_OSMINORMINOR:-0} _REQ_MINS_OS_VER=560 if [ $_OSMAJOR$_OSMINOR$_OSMINORMINOR -lt $_REQ_MINS_OS_VER ]; then $gettext "ERROR: Your version of Solaris is ${_OSREV}. At least Solaris 5.6 is needed to install.\n" if [ "${SILENT}" != "true" ]; then # i18n, No newline on the following line. $gettext "Press to Exit..." read dummy fi myexit fi return 0 } #================================================================= # myexit() - display generic message and exit #================================================================= myexit() { echo "" echo "`$gettext 'Exiting Installer .. '`" if [ "${SILENT}" != "true" ]; then echo "`$gettext 'Press the key to exit'`" read dummy fi exit 1 } #================================================================= # initially() - perform initialization work #================================================================= initially() { ## Do necessary to preserver user's environment if [ -f ${INSTALL_STATUS_FILE} ]; then $RM -f ${INSTALL_STATUS_FILE} fi } #================================================================= # finally() - called by trap to perform final works #================================================================= finally() { ## Do necessary to remove tmp files if [ -f /tmp/wa_status ]; then $MV -f /tmp/wa_status /tmp/status_wa fi #$RM -f /tmp/wa* /tmp/SCS* if [ -f /tmp/status_wa ]; then $MV -f /tmp/status_wa /tmp/wa_status fi } #================================================================= # setDefaults() - set defaults #================================================================= setDefaults() { INSTALL_MODE=1 PACKAGE_BASE_DIR=/ INSTALL_LIC=0 DO_UPGRADE=0 webaccess=1 rconsole=1 HOST=`LC_ALL=C; uname -n` TMPPORT="/tmp/findport.$$" (/bin/telnet $HOST 80 <<- EOF ^] close EOF ) > $TMPPORT 2>&1 test_text="Connection refused" rc=`$GREP -c "$test_text" $TMPPORT` if [ -f $TMPPORT ]; then $RM $TMPPORT fi } #================================================================= # addPackages() - add packages # # * adds all the WA packages. #================================================================= addPackages() { # remove ANY instances of WA_PACKAGES from the system. # The older packages will leave their configuration around and we # can use them if the RESTORECONFIG=yes is set. # First revert the order of packages for removal _allPackages=${ALLPACKAGES} _pkg= _revertedScsPackages= for _pkg in ${_allPackages}; do _revertedScsPackages="$_pkg $_revertedScsPackages" done _pkg= _pkgToRm= for _pkgToRm in $_revertedScsPackages; do if [ "`$PKGINFO $_pkgToRm 2>/dev/null \ | $GREP -ci $_pkgToRm`" != "0" ]; then eval echo `$gettext 'Removing existing $_pkgToRm...'` 2>&1 \ | $TEE -a ${INSTALL_LOG} $PKGRM -n -a ${ADMIN_FILE} ${_pkgToRm} 2>&1 | $TEE -a ${INSTALL_LOG} # if for some reason we fail to remove it we try again if [ "`$PKGINFO $_pkgToRm 2>/dev/null \ | $GREP -ci $_pkgToRm`" != "0" ]; then $PKGRM -n -a ${ADMIN_FILE} ${_pkgToRm} 2>&1 | $TEE -a ${INSTALL_LOG} fi fi done _revertedScsPackages= _pkgToRm= ERR_COUNT=0 echo "`$gettext 'Starting installation of software packages...'`" echo " " # # install all the wa core packages # echo "BASEDIR=/opt" >> ${_waRespFile} WORK_RESPONSE_FILE=${_waRespFile} eval echo `$gettext 'work response = ${WORK_RESPONSE_FILE}'` addPkg= for addPkg in ${_allPackages}; do if [ "`$PKGINFO $addPkg 2>/dev/null | $GREP -ci $addPkg`" = "0" ]; then if [ -d ${DIST_DIR}/$addPkg ]; then eval echo `$gettext '--------------------------------------------'` eval echo `$gettext 'Adding Package : $addPkg ...'` eval echo `$gettext '--------------------------------------------'` \ | $TEE -a ${INSTALL_LOG} eval echo `$gettext '======${RBRACKET} Adding Package : $addPkg'` \ | $TEE -a ${INSTALL_LOG} $PKGADD -a ${ADMIN_FILE} -r ${WORK_RESPONSE_FILE} \ -d ${DIST_DIR} $addPkg 2>&1 | $TEE -a ${INSTALL_LOG} if [ "`$PKGINFO $addPkg 2>/dev/null | $GREP -ci $addPkg`" != "0" ]; then eval echo `$gettext '======${RBRACKET} Successfully added $addPkg'` \ | $TEE -a ${INSTALL_LOG} else ERR_COUNT=1 eval echo `$gettext 'Error adding package : $addPkg'` eval echo `$gettext '======${RBRACKET} Error adding package : $addPkg'` \ | $TEE -a ${INSTALL_LOG} fi else ERR_COUNT=1 eval echo `$gettext '==== WARNING == $addPkg not found in distribution.'` \ | $TEE -a ${INSTALL_LOG} fi fi done # done adding all the packages if [ ${ERR_COUNT} -gt 0 ]; then eval echo `$gettext 'There was an error while installing packages. The error is logged in${NEWLINE}${INSTALL_LOG_FINAL_PLACE}.${NEWLINE}'` else eval echo `$gettext 'Installation log is in ${INSTALL_LOG_FINAL_PLACE}.'` fi startRequiredPrograms } #================================================================= # startRequiredPrograms() - start required programs #================================================================= startRequiredPrograms() { # No need to start license manager return 0 } #================================================================= # createAdminFile() - create admin file for non-interactive # and and the reponse file used by the request # scripts duing the non-interactive installation #================================================================= createAdminFile() { if [ -f ${ADMIN_FILE} ]; then $RM -f ${ADMIN_FILE} fi # generate the admin file used for all pkgadd and pkgrm operations # echo "instance=nocheck partial=nocheck runlevel=nocheck idepend=nocheck rdepend=nocheck space=nocheck setuid=nocheck conflict=nocheck action=nocheck basedir=default" > ${ADMIN_FILE} # # generate the generic response file for all non SCS packages # echo "RESTORECONFIG=${RESTORE_RESPONSE}" > ${_waRespFile} # # generate the reponse file for WA packages # echo "BASEDIR=/ EMAIL_DOMAIN=${DEFAULT_EMAIL_DOMAIN} RESTORECONFIG=${RESTORE_RESPONSE}" > ${_waRespFile} } #================================================================= # installStatus() - displace installation status #================================================================= installStatus() { # # determine the installation status of the packages and their configuration # if [ -z "$PATCHES_TO_INSTALL" ]; then doReboot=0 else doReboot=1 # i18n/l10n: Try to make the #'s a surrounding box. echo "###################################################################" echo "###################################################################" echo "# #" # i18n/l10n: Try to put the translated text to the space of the following line. echo "`$gettext '# #\n'`" echo "`$gettext '# YOU HAVE INSTALLED PATCHES THAT REQUIRE A REBOOT OF THE SYSTEM #\n# PLEASE REBOOT TH IS SYSTEM BEFORE STARTING THE CALENDAR SERVER #\n'`" echo "# #" echo "###################################################################" echo "###################################################################" fi # #get WebAccess status # if [ "$webaccess" == "1" ]; then _webaccessInstalled=$ALL_OK _webaccessPkg=0 _count=`echo $WAPACKAGES | awk '{print NF}'` for _pkg in $WAPACKAGES; do if [ "`$PKGINFO $_pkg 2>/dev/null | $GREP -ci $_pkg`" != "0" ]; then _webaccessPkg=`$EXPR $_webaccessPkg + 1` fi done if [ $_webaccessPkg -ne $_count ]; then _webaccessInstalled=$INSTALL_FAILURE else if [ "$DO_UPGRADE" == "0" -a "rconsole" == "0" ]; then _ocFile=$CONFIG_FAILURE _atFile=$CONFIG_FAILURE _confFile=/etc/opt/SUNWconn/ldap/current/slapd.oc.conf if [ -f ${_confFile} ]; then if [ `$GREP -c IMCalendarUser ${_confFile}` -ge 1 ]; then _ocFile=$ALL_OK fi fi _confFile="/etc/opt/SUNWconn/ldap/current/slapd.at.conf" if [ -f ${_confFile} ]; then if [ `$GREP -c IMcalendarHost ${_confFile}` -ge 1 ]; then _atFile=$ALL_OK fi fi if [ "$_ocFile" == "$ALL_OK" -a "$_atFile" == "$ALL_OK" ]; then _webaccessInstalled=$ALL_OK fi fi fi else _webaccessInstalled=$NOT_INSTALLED fi echo "$CALENDAR=$_calendarInstalled $WEBACCESS=$_webaccessInstalled $LOG=$INSTALL_LOG_FINAL_PLACE $REBOOT=$doReboot" > ${INSTALL_STATUS_FILE} chmod 755 ${INSTALL_STATUS_FILE} } #================================================================= # collectUserInput() - collect user input #================================================================= collectUserInput() { plat=`uname -p` PWD=`pwd` # Convert $DIST_DIR into an absolute path if [ "`echo $DIST_DIR | $GREP -c "^\."`" != "0" ]; then dir=`echo $DIST_DIR | $SED -e 's,^\.,'${PWD}',g'` else dir=${DIST_DIR} fi } #================================================================= # generateConfiguration() - generate configuration #================================================================= generateConfiguration() { # return 0; } #================================================================= # agree() - ask user agree or not #================================================================= agree() { $gettext 'Do you agree with the above notice and/or conditions? (y/n) :' read choice if [ "$choice" != "y" -a "$choice" != "Y" ]; then myexit fi } #================================================================= # usage() - display program usage #================================================================= usage() { echo "" eval echo `$gettext 'Usage: ${0} [-c install ${BAR} remove] [-d] [-v sims ${BAR} scs] [-?]'` echo "" } #================================================================= # welcome() - display welcome message #================================================================= welcome() { echo "" eval echo `$gettext '${PRODUCT_FULL_NAME} provides support for IETF - ${NEWLINE}Internet Engineering Task Force - calendar standards, iCalendar.${NEWLINE}This support for Internet standards-based features makes it easier${NEWL INE}for users to share calendaring information across the Internet.${NEWLINE}'` echo "" } #================================================================= # installLicenses() - install licenses #================================================================= installLicenses() { # Licenses are not required return 0 } #================================================================= # installLicenseFile() - install the license file #================================================================= # # install the license file # installLicenseFile() { # Licenses are not required installLicenses return 0 } #================================================================= # readLicense() - read the license file #================================================================= readLicense() { # Licenses are not required return 0 } #================================================================= # doLicenses() - do license checking #================================================================= doLicenses() { # Licenses are not required return 0 } #================================================================= # getInstallInfo() - get installation information #================================================================= getInstallInfo() { OLD_SCS_BASE=$? echo "`$gettext 'Checking system for minimum requirements.'`" checkSystemState if [ $? = 0 ] ; then eval echo `$gettext 'System check indicates $HOSTNAME met minimum requirements.'` return 0 else eval echo `$gettext 'System check indicates $HOSTNAME failed minimum requirements.'` return 1 fi } #================================================================= # packageInfo() - return the package information #================================================================= # packageInfo() { Installed=`$PKGINFO | $GREP -c ${PKG}` return $Installed } #================================================================= # configureWebAccess() - configure Sun WebAccess # # Inputs: # Sims Install: # Property Name Description LDAP Attribute Required? # ------------- ----------- -------------- --------- # ldap-server LDAP Server Name N/A Y # ldap-port LDAP Port Number N/A Y # country Country c Y # org-name Orginization Name o Y # org-unit Orginization Unit ou N # # SCS Install: # Property Name Description Required? # ------------- ----------- --------- # nis-type NIS or NIS+ Y # nis-domain NIS Domain N # # Errors: # 1. WA Properties file not found # 2. Required field not defined in Setup File, if INTERACTIVE == false # #================================================================= # configureWebAccess() { case "$VERSIONARG" in #----------------------------------------------------------- # Sims version #----------------------------------------------------------- 'sims') echo "`$gettext 'Configuring Web Access for Sims'`" 2>&1 | $TEE -a ${INSTALL_LOG} #----------------------------------------------------------- # Check for Sims properties file #----------------------------------------------------------- confFile="/opt/SUNWwa/properties/realm.Sims.properties" if [ ! -w "$confFile" ]; then eval echo `$gettext '==== ERROR === $confFile not found.'` \ | $TEE -a ${INSTALL_LOG} return fi #----------------------------------------------------------- # LDAP Server Name #----------------------------------------------------------- if [ "${INTERACTIVE}" == "false" ]; then ldapserv=`$GREP ldap-server= ${SETUP_DATA_FILE} 2>/dev/null \ | $AWK -F= '{print $2}' | $AWK '{print $1}'` if [[ -z $ldapserv ]]; then eval echo `$gettext '==== ERROR ===${NEWLINE}\ Required field: ldap-server not found in $SETUP_DATA_FILE.'` \ | $TEE -a ${INSTALL_LOG} return fi else # prompt user... echo "Please enter LDAP server(${HOSTNAME}): \c"; read ldapserv if [[ -z $ldapserv ]]; then # default... ldapserv=${HOSTNAME} fi fi #----------------------------------------------------------- # LDAP Port #----------------------------------------------------------- if [ "${INTERACTIVE}" == "false" ]; then ldapport=`$GREP ldap-port= ${SETUP_DATA_FILE} 2>/dev/null \ | $AWK -F= '{print $2}'` if [[ -z $ldapport ]]; then eval echo `$gettext '==== ERROR ===${NEWLINE}\ Required field: ldap-port not found in $SETUP_DATA_FILE.'` \ | $TEE -a ${INSTALL_LOG} return fi else # prompt user... echo "Please enter LDAP server port (389): \c"; read ldapport if [[ -z $ldapport ]]; then # default... ldapport=389 fi fi #----------------------------------------------------------- # LDAP Country #----------------------------------------------------------- if [ "${INTERACTIVE}" == "false" ]; then c=`$GREP country= ${SETUP_DATA_FILE} 2>/dev/null | $AWK -F= '{print $2}'` if [[ -z $c ]]; then eval echo `$gettext '==== ERROR ===${NEWLINE}\ Required field: country not found in $SETUP_DATA_FILE.'` \ | $TEE -a ${INSTALL_LOG} return fi else # this is a required field w/ no defaults, loop until user inputs something c= while [[ -z $c ]]; do echo "Please enter LDAP Country (ie. c=us): \c"; read c done fi #----------------------------------------------------------- # LDAP Org Name #----------------------------------------------------------- if [ "${INTERACTIVE}" == "false" ]; then o=`$GREP org-name= ${SETUP_DATA_FILE} 2>/dev/null | $AWK -F= '{print $2}'` if [[ -z $o ]]; then eval echo `$gettext '==== ERROR ===${NEWLINE}\ Required field: org-name not found in $SETUP_DATA_FILE.'` \ | $TEE -a ${INSTALL_LOG} return fi else # this is a required field w/ no defaults, loop until user inputs something o= while [[ -z $o ]]; do echo "Please enter LDAP Orginization Name (ie. o=sun): \c"; read o done fi #----------------------------------------------------------- # LDAP Org Unit #----------------------------------------------------------- if [ "${INTERACTIVE}" == "false" ]; then # not required... ou=`$GREP org-unit= ${SETUP_DATA_FILE} 2>/dev/null | $AWK -F= '{print $2}'` else # not required... echo "Please enter LDAP Orginization Unit (ie. ou=eng): \c"; read ou fi #----------------------------------------------------------- # Set access.LDAPAccess.ldapServiceUrl in realm.Sims.properties #----------------------------------------------------------- keyStr="access.LDAPAccess.ldapServiceUrl" keyVal="ldap://${ldapserv}:${ldapport}" rc=$($GREP -c ${keyStr} ${confFile}) if [ "$rc" != "0" ]; then $SED -e 's#^'${keyStr}'=.*#'${keyStr}'='${keyVal}'#g' $confFile > $confFile".tmp" $MV ${confFile}".tmp" ${confFile} fi #----------------------------------------------------------- # Set access.LDAPAccess.ldapSearchBase in realm.Sims.properties #----------------------------------------------------------- keyStr="access.LDAPAccess.ldapSearchBase" if [[ -z $ou ]]; then keyVal="o=${o},c=${c}" else keyVal="ou=${ou},o=${o},c=${c}" fi rc=$($GREP -c ${keyStr} ${confFile}) if [ "$rc" != "0" ]; then $SED -e 's#^'${keyStr}'=.*#'${keyStr}'='${keyVal}'#g' $confFile > $confFile".tmp" $MV ${confFile}".tmp" ${confFile} fi ;; #----------------------------------------------------------- # SCS version #----------------------------------------------------------- 'scs') echo "`$gettext 'Configuring Web Access for SCS'`" 2>&1 | $TEE -a ${INSTALL_LOG} #----------------------------------------------------------- # Check for SCS properties file #----------------------------------------------------------- confFile="/opt/SUNWwa/properties/realm.SCS.properties" if [ ! -w "$confFile" ]; then eval echo `$gettext '==== ERROR === $confFile not found.'` \ | $TEE -a ${INSTALL_LOG} return fi #----------------------------------------------------------- # Nis Type #----------------------------------------------------------- if [ "${INTERACTIVE}" == "false" ]; then typeset -u nistype nistype=`$GREP nis-type= ${SETUP_DATA_FILE} 2>/dev/null | $AWK -F= '{print $2}'` if [ -z $nistype ]; then eval echo `$gettext '==== ERROR ===${NEWLINE}\ Required field: nis-type not found in $SETUP_DATA_FILE.'` \ | $TEE -a ${INSTALL_LOG} return fi if [ "${nistype}" != "NIS" -a "${nistype}" != "NIS+" ]; then eval echo `$gettext '==== ERROR ===${NEWLINE}\ Required field: nis-type invalid in $SETUP_DATA_FILE. NIS${BAR}NIS+'` \ | $TEE -a ${INSTALL_LOG} return fi else # this is a required field w/ no defaults, loop until user inputs something typeset -u nistype nistype= while [ "${nistype}" != "NIS" -a "${nistype}" != "NIS+" ]; do echo "Please enter NIS Type[NIS|NIS+]: \c"; read nistype done fi #----------------------------------------------------------- # Set access.NISAccess.nisType in realm.SCS.properties #----------------------------------------------------------- keyStr="access.NISAccess.nisType" keyVal="${nistype}" rc=$($GREP -c ${keyStr} ${confFile}) if [ "$rc" != "0" ]; then $SED -e 's/^'${keyStr}'=.*/'${keyStr}'='${keyVal}'/g' $confFile > $confFile".tmp" $MV ${confFile}".tmp" ${confFile} fi #----------------------------------------------------------- # Nis Domain #----------------------------------------------------------- if [ "${nistype}" == "NIS" ]; then if [ "${INTERACTIVE}" == "false" ]; then # not required... nisdomain=`$GREP nis-domain= ${SETUP_DATA_FILE} 2>/dev/null | $AWK -F= '{print $2}'` else # not required... echo "Please enter NIS Domain(`${DOMAINNAME}`): \c"; read nisdomain if [[ -z $nisdomain ]]; then nisdomain=`${DOMAINNAME}` fi fi #----------------------------------------------------------- # Set access.NISAccess.nisDomain in realm.SCS.properties #----------------------------------------------------------- keyStr="access.NISAccess.nisDomain" keyVal="${nisdomain}" rc=$($GREP -c ${keyStr} ${confFile}) if [ "$rc" != "0" ]; then $SED -e 's/^'${keyStr}'=.*/'${keyStr}'='${keyVal}'/g' $confFile > $confFile".tmp" $MV ${confFile}".tmp" ${confFile} fi fi #----------------------------------------------------------- # Modify index.html for SCS realm #----------------------------------------------------------- indexFile="/opt/SUNWwa/public_html/WebAccess/index.html" if [ ! -w "$indexFile" ]; then eval echo `$gettext '==== ERROR === $indexFile not found.'` \ | $TEE -a ${INSTALL_LOG} return fi keyStr="realm" keyVal="SCS" rc=$($GREP -c ${keyStr} ${indexFile}) if [ "$rc" != "0" ]; then $SED -e 's/'${keyStr}'=Sims/'${keyStr}'='${keyVal}'/g' $indexFile > $indexFile".tmp" $MV ${indexFile}".tmp" ${indexFile} fi #----------------------------------------------------------- # Comment out Mail and Name in help/main_help.doc.html #----------------------------------------------------------- helpFile="/opt/SUNWwa/public_html/WebAccess/en/help/main_help.doc.html" if [ ! -w "$helpFile" ]; then eval echo `$gettext '==== ERROR === $helpFile not found.'` \ | $TEE -a ${INSTALL_LOG} return fi $SED -e '/mail_help/s/\(.*\)/\<\!--\1--\>/g' \ -e '/name_help/s/\(.*\)/\<\!--\1--\>/g' \ $helpFile > $helpFile".tmp" $MV ${helpFile}".tmp" ${helpFile} ;; #----------------------------------------------------------- # Sun.Net version #----------------------------------------------------------- 'sun.net') # not currently used... echo "`$gettext 'Configuring Web Access for Sun.Net'`" 2>&1 | $TEE -a ${INSTALL_LOG} #----------------------------------------------------------- # Check for Sun.Net properties file #----------------------------------------------------------- confFile="/opt/SUNWwa/properties/realm.SN.properties" if [ ! -w "$confFile" ]; then eval echo `$gettext '==== ERROR === $confFile not found.'` \ | $TEE -a ${INSTALL_LOG} return fi #----------------------------------------------------------- # Modify index.html for Sun.Net realm #----------------------------------------------------------- indexFile="/opt/SUNWwa/public_html/WebAccess/index.html" if [ ! -w "$indexFile" ]; then eval echo `$gettext '==== ERROR === $indexFile not found.'` \ | $TEE -a ${INSTALL_LOG} return fi keyStr="realm" keyVal="SN" rc=$($GREP -c ${keyStr} ${indexFile}) if [ "$rc" != "0" ]; then $SED -e 's/'${keyStr}'=Sims/'${keyStr}'='${keyVal}'/g' $indexFile > $indexFile".tmp" $MV ${indexFile}".tmp" ${indexFile} fi ;; esac chmod 0644 $confFile } #================================================================= # handleWorkAroundListTasks() - handle work around tasks # # the tasks in this function are a temporary workaround for the tasks that are # listed in Martin's list. This function will be pulled out when the final # product is shipping #================================================================= handleWorkAroundListTasks() { return 0 } #================================================================= # removeAllPackages() - remove all packages #================================================================= removeAllPackages() { MUST_REMOVE_PKGS="${WAPACKAGES}" if [ ! -f ${ADMIN_FILE} ]; then echo "instance=nocheck partial=nocheck runlevel=nocheck idepend=nocheck rdepend=nocheck space=nocheck setuid=nocheck conflict=nocheck action=nocheck basedir=default" > ${ADMIN_FILE} fi typeset -l areYouSure areYouSure=`/bin/ckyorn -d n -p "Are you sure you want to remove Sun Web Access(tm) (n): " ` if [ "$areYouSure" != "y" -a "$areYouSure" != "yes" ]; then echo "`$gettext 'Aborting uninstaller...'`" else for pkg in ${MUST_REMOVE_PKGS}; do if [ "`$PKGINFO $pkg 2>/dev/null | $GREP -ci $pkg`" != "0" ]; then eval echo `$gettext 'Removing $pkg...'` echo " " $PKGRM -n -a ${ADMIN_FILE} $pkg echo " " fi done fi } #================================================================= # cleanUpScratchFiles() - clean up the scratch files #================================================================= cleanUpScratchFiles() { if [ -f ${ADMIN_FILE} ]; then $RM -f ${ADMIN_FILE} fi if [ -f ${_waRespFile} ]; then $RM -f ${_waRespFile} fi } #================================================================= # allDone() - all done #================================================================= allDone() { if [ -f ${INSTALL_LOG} ]; then _logDir=`/bin/dirname ${INSTALL_LOG_FINAL_PLACE}` $MKDIR -p ${_logDir} $MV ${INSTALL_LOG} ${INSTALL_LOG_FINAL_PLACE} fi if [ -f ${SETUP_DATA_FILE} ]; then _logDir=`/bin/dirname ${SAVED_DATA_FILE}` $MKDIR -p ${_logDir} $CP ${SETUP_DATA_FILE} ${SAVED_DATA_FILE} fi eval echo `$gettext '${PRODUCT_FULL_NAME} v${WA_VERSION} installed and configured.'` echo "`$gettext 'Please refer to your installation manual for further post-installation\ntasks.\n'`" echo "" if [ "${SILENT}" != "true" ]; then echo "`$gettext 'Press the key to exit'`" read dummy fi } #================================================================= # Main program starts all other components #================================================================= #${CLEAR} #----------------------------------------------------------- # must be root to run this program #----------------------------------------------------------- WHO=`id | $SED "s/uid=[0-9]*(\([^ )]*\)).*/\1/"` if [ "$WHO" != "root" ]; then eval echo `$gettext 'ERROR: You must be \"root\" to run ${0} '` myexit fi #----------------------------------------------------------- # process arguments #----------------------------------------------------------- while getopts :c:v:p:d name do case $name in c) COMMANDARG="$OPTARG" ;; v) VERSIONARG="$OPTARG" ;; d) INTERACTIVE="false" # check for setup file... if [ ! -r "$SETUP_DATA_FILE" ]; then # error, need setup file for non-interactive mode eval echo `$gettext '==== WARNING ==== Non-Interactive Mode: $SETUP_DATA_FILE not found.'` \ | $TEE -a ${INSTALL_LOG} INTERACTIVE="true" fi ;; \?) usage exit 2 ;; 'help') usage exit 2 ;; p) DIST_DIR="$OPTARG" ;; esac done shift `$EXPR $OPTIND - 1` argument=$* #----------------------------------------------------------- # The default command is "install" #----------------------------------------------------------- case "$COMMANDARG" in #----------------------------------------------------------- # Remove packages #----------------------------------------------------------- 'remove') eval echo `$gettext 'Uninstalling ${PRODUCT_FULL_NAME} v${WA_VERSION}...' ` removeAllPackages exit 0 ;; #----------------------------------------------------------- # Install packages #----------------------------------------------------------- 'install') eval echo `$gettext 'Installing ${PRODUCT_FULL_NAME} v${WA_VERSION}...'` initially getInstallInfo setDefaults createAdminFile addPackages collectUserInput configureWebAccess # now that we are all done we should clean up allDone cleanUpScratchFiles installStatus exit 0 ;; #----------------------------------------------------------- # Display usage #----------------------------------------------------------- *) usage ;; esac