#!/bin/ksh # Copyright %G% Sun Microsystems, Inc. All Rights Reserved. # "%W% %E% Sun Microsystems" ################################################################ # # Set up the environment # PATH=/var/sadm/install/bin:/usr/bin:/usr/sbin:/usr/ucb:$PATH export PATH ECHO=/bin/echo AWK=/usr/bin/awk GREP=/usr/bin/grep CHMOD=/usr/bin/chmod MKDIR=/usr/bin/mkdir MV=/usr/bin/mv CP=/usr/bin/cp NOHUP=/usr/bin/nohup IP_REMOVE="./iplanet_remove" MEDIADIR=`pwd` RESPONSEFILE=/tmp/stonerunner_resp_file SRADMIN=/tmp/stonerunner_admin JDKADMIN=/tmp/jdk_admin INSTALL_LOG=/var/opt/SUNWstnr/debug/iplanet_install.log.$$ LOCALPORT=8080 BASEDIR=/opt PRODUCTNAME="i-Planet WebTop" KEYBASE=/etc/opt/SUNWstnr KEYSTORE=$KEYBASE/rp.keystore KEYSTOREPASSFILE=$KEYBASE/.rppass CASTORE=$KEYBASE/rp.CAstore CERTTEMPFILE=/tmp/cert.temp.$$ NES_BASE=$MEDIADIR/nes NES_INSTALL=/tmp/install.inf.$$ NES_SETUP=$NES_BASE/setup START_PLATFORM= failed_install="0" ################################################################ # # packages to install # GW_PKG_SIZE=40000 GW_PKG_LIST="SUNWsnrp" PLAT_PKG_SIZE=50000 PLAT_PKG_LIST="SUNWsnad SUNWsrlg SUNWsrlgs SUNWsrcm SUNWsrdmn SUNWsrjd" APPS_PKG_SIZE=50000 APPS_PKG_LIST="SUNWwa SUNWwasn SUNWsndt SUNWsnps SUNWsnsvs SUNWsnut \ SUNWsrfl SUNWsrnm SUNWsrcm SUNWsrssl SUNWsrtrn \ SUNWsrdoh SUNWsrua SUNWrwin SUNWsrjd" SERVER_PKG_SIZE=50000 SERVER_PKG_LIST="$PLAT_PKG_LIST $APPS_PKG_LIST SUNWsrsin" NETCON_PKG="NetCon-25 NetCon-26" #SOL8 LICENSE_PKG_LIST="SUNWlicsw SUNWlit" ALL_PKG_LIST="$GW_PKG_LIST $PLAT_PKG_LIST $APPS_PKG_LIST" ################################################################ # # trap CRTL-C for password entries to restore shell echo # trap doexit 2 doexit() { stty echo exit } ################################################################ # # display the settings that will be used by install # to setup the gateway server. # display_gateway_settings() { log log log log "settings used by install to setup the gateway server." log log "BASEDIR=$BASEDIR" log "RELBASEDIR=$BASEDIR" log "CHROOTED=$chrooted" log "CHROOTDIR=$chrootdir" log "FQDNHOSTNAME=$GWHOST" log "EPROXYPORT=$GWPORT" log "RPROXYPORT=$RPROXYPORT" log "RELRPPATH=$BASEDIR/SUNWsnrp" log "ABSRPPATH=$BASEDIR/SUNWsnrp" log "NSPROXYHOST_AND_PORT=$nsproxyhost_and_port" log "USENSPROXY=$usensproxy" log "FQDNAUTHSERVER=$AUTHHOST" log "AUTHHOST=$AUTHHOST" log "AUTHPORT=$AUTHPORT" log "PREFHOST=$PREFHOST" log "PREFPORT=$PREFPORT" log "TOPDOMAIN=$TOP_DOMAIN" log "SUBDOMAIN=$SUB_DOMAIN" log "CERTTEMPFILE=$CERTTEMPFILE" log log } ################################################################ # # display the settings that will be used by install to # setup the platform server # display_platform_settings() { log log log log "settings used by install to setup the platform server." log "#" log "Platform Server: $AUTHHOST" log "Platform Server Port: $AUTHPORT" log "Gateway Host: $GWHOST" log "Gateway Port: $GWPORT" log "Application Server: $APPSHOST" log "Application Server Port: $APPSPORT" log "Log Server: $LOGHOST" log "Log Server Port: $LOGPORT" log "Preference Server: $PREFHOST" log "Preference Server Port: $PREFPORT" log "Default URL: $DEFAULT_URL" log "Installation Directory: $BASEDIR" log log } ################################################################ # # build up response files for pkgadd, based on user input & # system defaults # build_response_files() { $ECHO " FQDNAUTHNAME=$AUTHHOST DEFAULTURL=$DEFAULT_URL AUTH_PORT=$AUTHPORT AUTH_HOST=$AUTHHOST FQDNGATEWAYNAME=$GWHOST GATE_PORT=$GWPORT APP_HOST=$APPSHOST APP_PORT=$APPSPORT PREF_HOST=$PREFHOST PREF_PORT=$PREFPORT LOG_PORT=$LOGPORT LOG_HOST=$LOGHOST " > $RESPONSEFILE.SUNWsnad $ECHO " FQDNAUTHHOST=$AUTHHOST AUTH_HOST=$AUTHHOST AUTH_PORT=$AUTHPORT THE_LOGOUT_URL=/logout APP_HOST=$APPSHOST APP_PORT=$APPSPORT PREF_HOST=$PREFHOST PREF_PORT=$PREFPORT PREF_URL=$PREFURL RP_URL=$RPURL AP_URL=$APPURL BASEDIR=$BASEDIR " > $RESPONSEFILE.SUNWsndt $ECHO " BASEDIR=$BASEDIR RELBASEDIR=$BASEDIR CHROOTED=$chrooted CHROOTDIR=$chrootdir FQDNHOSTNAME=$GWHOST EPROXYPORT=$GWPORT RPROXYPORT=$RPROXYPORT AUTHSSLMODE=$SSLMODE RELRPPATH=$BASEDIR/SUNWsnrp ABSRPPATH=$BASEDIR/SUNWsnrp NSPROXYHOST_AND_PORT=$nsproxyhost_and_port USENSPROXY=$usensproxy FQDNAUTHSERVER=$AUTHHOST AUTHHOST=$AUTHHOST AUTHPORT=$AUTHPORT AUTHSSLPORT=$SSLPORT PREFHOST=$PREFHOST PREFPORT=$PREFPORT TOPDOMAIN=$TOP_DOMAIN SUBDOMAIN=$SUB_DOMAIN CERTTEMPFILE=$CERTTEMPFILE " > $RESPONSEFILE.SUNWsnrp $ECHO " BASEDIR=$BASEDIR RELBASEDIR=$BASEDIR ABSRPPATH=$BASEDIR/SUNWsrfw " > $RESPONSEFILE.SUNWsrfw $ECHO " LOG_PATH=/var/opt/SUNWstnr/logs HOSTNAME=$LOGHOST PORT=$LOGPORT URL=/servlet/logserver MAXFS=10000000 NUMHF=3 " > $RESPONSEFILE.SUNWsrlgs $ECHO " AUTH_HOST=$AUTHHOST BASEDIR=$BASEDIR GW_HOST=$GWHOST " > $RESPONSEFILE.SUNWsrsin $ECHO " AUTH_HOST=$AUTHHOST BASEDIR=$BASEDIR " > $RESPONSEFILE.SUNWsnps $ECHO " BASEDIR=$BASEDIR AUTH_HOST=$AUTHHOST PREF_HOST=$PREFHOST PREF_PORT=$PREFPORT " > $RESPONSEFILE.SUNWwasn $ECHO " BASEDIR=$BASEDIR " > $RESPONSEFILE.SUNWwa $ECHO " BASEDIR=$BASEDIR " > $RESPONSEFILE.SUNWsrssl # should allow user to pick trans host/port $ECHO " BASEDIR=$BASEDIR TRANS_HOST=$AUTHHOST TRANS_PORT=10011 " > $RESPONSEFILE.SUNWsrtrn } ################################################################ # # check for previous nes install in BASEDIR # check_for_nes_install() { nes_dir="$BASEDIR/netscape/server4" if [ -d "$nes_dir" ]; then $ECHO $ECHO "A possible existing Netscape webserver install was found at:" $ECHO "$nes_dir." $ECHO "Verify that this is not an existing installation" $ECHO "before continuing. $PRODUCTNAME cannot install the webserver" $ECHO "on top of an existing installation and will fail to install" $ECHO "if there are existing Netscape webserver files in this" $ECHO "directory." $ECHO "If this is an existing installation, please quit and remove it." $ECHO $ECHO "Do you want to continue with the installation? y/[n] \c" read ans if [ "$ans" != "y" ] && [ "$ans" != "Y" ]; then exit 1 fi fi } ################################################################ # # check for running http processes # check_for_http_processes() { tag="http" pids=`/usr/bin/ps -ef | /usr/bin/grep $tag | /usr/bin/grep -v grep | /usr/bin/awk '{print $2}'` if [ "$pids" != "" ]; then $ECHO $ECHO "HTTP processes were found to be running on your system." $ECHO "Such processes may conflict with the $PRODUCTNAME" $ECHO "installation. You may continue, quit and terminate the" $ECHO "processes manually, or have this script terminate them." $ECHO "Suspect processes found included processes IDs:" $ECHO "$pids" $ECHO $ECHO "Continue, quit, or kill? c/[q]/k \c" read ans if [ "$ans" = "k" ] || [ "$ans" = "K" ]; then kill $pids >/dev/null 2>&1 sleep 2 kill -9 $pids >/dev/null 2>&1 elif [ "$ans" != "c" ] && [ "$ans" != "C" ]; then exit 1 fi fi } ################################################################ # # log installation # usage: log # log() { $ECHO $1 >> $INSTALL_LOG 2>&1 } ############################################################## # # # is_license_pkg_installed() { INSTALL_LICENSE_TOOLS=0 pkginfo -q SUNWlicsw if [ $? -eq 0 ]; then $ECHO $ECHO "WARNING: installation has detected the licensing packages required by" $ECHO "$PRODUCTNAME are already installed on this system. Do you want to " $ECHO "use these packages? [y]/n \c" read ANS if [ "$ANS" = "n" ] || [ "$ANS" = "N" ]; then $ECHO $ECHO "You have selected to remove the current license packages and install" $ECHO "the license packages shipped with $PRODUCTNAME. \c" $ECHO "Press return to continue..." read DUMMY else # install will not touch the current license packages INSTALL_LICENSE_TOOLS=1 fi fi } ############################################################## # # cat_line() { file=$1 new=$2 cp $file $file-orig-$$ $ECHO "$new" >> $file } ############################################################## # # replace_line() { file=$1 match=$2 new=$3 cp $file $file-orig-$$ sed -e " /$match/ { c\\ $new }" $file > $file-tmp mv $file-tmp $file } ############################################################## # # insert_line() { file=$1 match=$2 new=$3 cp $file $file-orig-$$ sed -e " /$match/ { i\\ $new }" $file > $file-tmp mv $file-tmp $file } ############################################################## # # delete_line() { file=$1 match=$2 cp $file $file-orig-$$ sed -e " /$match/ { d }" $file > $file-tmp mv $file-tmp $file } ############################################################## # # nes_start() { $ECHO "Starting server ..." IPLANET_SERV="/etc/init.d/iplanet_serv" # make sure we're not in the cdrom dir cd "/" $IPLANET_SERV start } ############################################################## # # adm_start() { $ECHO "Starting server (administration only) ..." IPLANET_SERV="/etc/init.d/iplanet_serv" # make sure we're not in the cdrom dir cd "/" $IPLANET_SERV admstart } ############################################################## # # setup to use local copy of java, not the version netscape # installs # nes_link_jdk() { NES_BASE="$BASEDIR/netscape/server4" cd "$NES_BASE/bin/https" mv jdk jdk-ns ln -s /usr/java ./jdk cd "/" } ############################################################## # # nes_configure() { $ECHO "Configuring webserver ... \c" NES_CONFIG_BASE=$BASEDIR/netscape/server4/https-$AUTHHOST/config cd $NES_CONFIG_BASE # jvm12.conf vars to change JVM_MIN_HEAPSIZE="jvm.minHeapSize=32768000" JVM_MAX_HEAPSIZE="jvm.maxHeapSize=131072000" STNR_BASE="$BASEDIR/SUNWstnr" PLAT_BASE="$STNR_BASE/platform" WA_BASE="$BASEDIR/SUNWwa" JVM_CLASSPATH="jvm.classpath=$PLAT_BASE/classes/srssl.jar:$PLAT_BASE/classes:$PLAT_BASE/servlets:$PLAT_BASE/classes/mail.jar:$PLAT_BASE/classes/logservlet.jar:$PLAT_BASE/classes/authd.jar:$PLAT_BASE/classes/acm.jar:$PLAT_BASE/classes/common.jar:$PLAT_BASE/classes/jndi.jar:$PLAT_BASE/classes/ldap.jar:$BASEDIR/SUNWstnr/lib/log.jar:$PLAT_BASE/classes/preference_servlet.jar:$PLAT_BASE/classes/SNDesktop.jar:$PLAT_BASE/classes/SNServices.jar:$PLAT_BASE/classes/SNUtils.jar:$PLAT_BASE/classes/SNServices.jar:$PLAT_BASE/classes/providerutil.jar:$WA_BASE/classes:$WA_BASE/lib/jaf/activation.jar:$WA_BASE/lib/javacal/calendar.jar:$WA_BASE/lib/javamail/mail.jar:$STNR_BASE/lib/ssl.jar:$STNR_BASE/lib/x509v1.jar" # do jvm12.conf file file=jvm12.conf replace_line "$file" "jvm.minHeapSize" "$JVM_MIN_HEAPSIZE" replace_line "$file" "jvm.maxHeapSize" "$JVM_MAX_HEAPSIZE" cat_line "$file" "$JVM_CLASSPATH" cat_line "$file" "webaccess.root=$BASEDIR/SUNWwa" # magnus.conf vars REQUEST_THROTTLE="RqThrottle 1024" # do magnus.conf config file file="magnus.conf" replace_line "$file" "RqThrottle" "$REQUEST_THROTTLE" # obj.conf vars SERVLET_LOCATION="NameTrans fn=\"pfx2dir\" from=\"\/servlet\" dir=\"$BASEDIR/SUNWstnr/platform/servlets\" name=\"ServletByExt\"" # do obj.conf config file file="obj.conf" delete_line "$file" "fn=flex-init access" delete_line "$file" "AddLog fn=flex-log" replace_line "$file" "NameTrans.*from.*servlet" "$SERVLET_LOCATION" insert_line "$file" "document-root" "NameTrans fn=\"pfx2dir\" from=\"/cgi-bin\" dir=\"$BASEDIR/SUNWstnr/platform/cgi-bin\" name=\"cgi\"" insert_line "$file" "document-root" "NameTrans fn=\"pfx2dir\" from=\"/public_html/images\" dir=\"$BASEDIR/SUNWstnr/platform/images\"" insert_line "$file" "document-root" "NameTrans fn=\"pfx2dir\" from=\"/images\" dir=\"$BASEDIR/SUNWstnr/platform/images\"" insert_line "$file" "document-root" "NameTrans fn=\"pfx2dir\" from=\"/preferences\" dir=\"$BASEDIR/SUNWstnr/platform/preferences\"" insert_line "$file" "document-root" "NameTrans fn=\"pfx2dir\" from=\"/NetMail\" dir=\"$BASEDIR/SUNWstnr/platform/public_html/NetMail\"" insert_line "$file" "document-root" "NameTrans fn=\"pfx2dir\" from=\"/apps\" dir=\"$BASEDIR/SUNWstnr/platform/public_html/apps\"" insert_line "$file" "document-root" "NameTrans fn=\"pfx2dir\" from=\"/content\" dir=\"$BASEDIR/SUNWstnr/platform/public_html/content\"" cd "/" $ECHO "done" } ############################################################## # # nes_create_install() { cat > $NES_INSTALL < $INSTALL_LOG 2>&1 $ECHO "do not remove this file!" > /.wsinstalled $ECHO "done" nes_configure #nes_link_jdk cd "/" } ############################################################## # # install the license manager package # install_license_manager() { if [ "$INSTALL_LICENSE_TOOLS" -eq 1 ]; then return fi RemoveIfPresent SUNWlicsw RemoveIfPresent SUNWlit log "installing FLEX License Manager Software and Utilites" $ECHO " SUNWlicsw..." lic_dir=$MEDIADIR/SUNWlicsw_pkgs/`uname -p`-S2 pkgadd -d $lic_dir -a $SRADMIN SUNWlicsw >> $INSTALL_LOG 2>&1 if [ $? -ne 0 ]; then $ECHO $ECHO "WARNING: install Failed for SUNWlicsw. Do you want" $ECHO "to continue with the installation of $PRODUCTNAME? y/[n] \c" read ANS if [ "$ANS" = "" ] || [ "$ANS" = "n" ] || [ "$ANS" = "N" ] then failed_install="1" cleanup_and_exit fi fi log "license manager installation done." $ECHO " SUNWlit..." lic_dir=$MEDIADIR/SUNWlit_pkgs/`uname -p`-S2 pkgadd -d $lic_dir -a $SRADMIN SUNWlit >> $INSTALL_LOG 2>&1 if [ $? -ne 0 ]; then $ECHO $ECHO "WARNING: install Failed for SUNWlit. Do you want" $ECHO "to continue with the installation of $PRODUCTNAME? y/[n] \c" read ANS if [ "$ANS" = "" ] || [ "$ANS" = "n" ] || [ "$ANS" = "N" ] then failed_install="1" cleanup_and_exit fi fi log "license installation tools installed." } ############################################################## # # remove the license manager package # remove_license_manager() { if [ -f "/.licinstalled" ]; then LICPKGS="SUNWlicsw SUNWlit" for LP in $LICPKGS do pkginfo -q $LP if [ $? -eq 0 ]; then log " $LP..." $ECHO " $LP..." pkgrm -n -a $EMRMADMIN $LP >> $INSTALL_LOG 2>&1 fi done rm -f /.licinstalled fi } ################################################################ # # check if there was a previous installation of stonerunner # on this machine # check_for_prior_install() { PREVIOUS_INSTALL="" /usr/bin/pkginfo > /tmp/pkg_installed.tmp $GREP -w SUNWsnad /tmp/pkg_installed.tmp > /dev/null 2>&1 if [ $? = 0 ] then PREVIOUS_INSTALL=" $PRODUCTNAME Server" fi $GREP -w SUNWsnrp /tmp/pkg_installed.tmp > /dev/null 2>&1 if [ $? = 0 ] then PREVIOUS_INSTALL="$PREVIOUS_INSTALL\n $PRODUCTNAME Gateway" fi REINSTALL=3 if [ "$PREVIOUS_INSTALL" != "" ] then #banner $ECHO $ECHO "$PRODUCTNAME bundles have been detected on this machine." $ECHO "These packages may be left over from a previous installation" $ECHO "and should be removed prior to installing again. Installing" $ECHO "over a previous version is not supported at this time. The " $ECHO "bundles detected are:" $ECHO "$PREVIOUS_INSTALL" $ECHO "You may choose to remove the bundles, continue to install, or" $ECHO "exit the installation. Note if you choose to remove the bundles" $ECHO "all webserver configuration files will be removed as well." $ECHO $ECHO "1) Remove $PRODUCTNAME" $ECHO "2) Continue Installation" $ECHO "3) Exit" $ECHO "-------------------------" $ECHO "choice: [3] \c" read ANS if [ "$ANS" != "" ] then REINSTALL="$ANS" fi if [ "$REINSTALL" = "1" ] then log "removing old installation" $ECHO "Removing old installation ... \c" $IP_REMOVE -a -b >>$INSTALL_LOG 2>&1 $ECHO "done." $ECHO elif [ "$REINSTALL" = "3" ] then failed_install=1 cleanup_and_exit else continue fi fi #banner } ################################################################ # # does the user want the webserver started after the package # are installed... # auto_platform_startup() { if [ "$PROTOCOL" = "https" ]; then $ECHO $ECHO "Before starting the $PRODUCTNAME server, you must configure" $ECHO "the webserver for SSL services. Please refer to the" $ECHO "$PRODUCTNAME documentation for this procedure." $ECHO $ECHO "Only the administration server will be started." return fi $ECHO $ECHO "Do you want to start the $PRODUCTNAME server" $ECHO "when installation is complete? [y]/n \c" read START_PLATFORM if [ "$START_PLATFORM" = "" ]; then START_PLATFORM="y" fi if [ "$START_PLATFORM" = "n" ] || [ "$START_PLATFORM" = "N" ] then log "platform will NOT be started when install completes..." $ECHO "You have selected not to start the $PRODUCTNAME Server. You will need to " $ECHO "start it manually prior to accessing $PRODUCTNAME." else log "platform WILL be started when install completes..." $ECHO "Platform WILL be started when install completes..." fi } ################################################################ # # run in chroot environment # get_chroot() { $ECHO chroot_answer=n $ECHO "Will the reverse proxy be run from a chroot environment? y/[n] \c" goodcha=0 while [ $goodcha -eq 0 ] do read ANS if [ "$ANS" != "" ] then chroot_answer=$ANS fi chaverified="`$ECHO \"$chroot_answer\" | sed 's/^\(.\).*/\1/'`" case "$chaverified" in [Yy]) chrooted=1; goodcha=1;; [Nn]) chrooted=0; goodcha=1;; *) $ECHO "Invalid answer, y or n required.";; esac done if [ "$chrooted" -eq 1 ]; then goodchdir=0 while [ $goodchdir -eq 0 ] do $ECHO "What is the directory of the chroot environment? [] \c" read newchdir chdirverified="`echo \"$newchdir\" | egrep \"^/([-0-9a-zA-Z]+/?)*\"`" if [ -n "$chdirverified" -a -d $newchdir ]; then chrootdir="$newchdir" goodchdir=1 else $ECHO $ECHO "Invalid directory specified." fi done else chrootdir=NA fi } ############################################################## # # Install firewall packages # install_firewall() { if [ "$addfw" = "y" ]; then if [ ! -d "/etc/opt/SUNWsrfw" ] then $MKDIR "/etc/opt/SUNWsrfw" fi PKG_LIST="SUNWicgEF SUNWicgSS" # #firewall packages need to live under '/' # $ECHO "basedir=/" > $SRADMIN $ECHO "action=nocheck" >> $SRADMIN $ECHO "conflict=nocheck" >> $SRADMIN $ECHO "setuid=nocheck" >> $SRADMIN $ECHO "mail=" >> $SRADMIN install_stnr_pkgs # # restore previous pkgadmin file # create_pkg_admin PKG_LIST="SUNWsrfw SUNWsrman" install_stnr_pkgs case $rbnow in y) reboot ;; Y) reboot ;; *) $ECHO "Firewall installed but reboot not performed. You need " $ECHO "to reboot to configure later!" ;; esac else $ECHO $ECHO "Firewall was not installed. Please make sure port $GWPORT" $ECHO "is open on the gateway machine." fi } ############################################################## # # Install packages, using resp file if it has been generated # install_stnr_pkgs() { for PACKNAME in $PKG_LIST do $ECHO " $PACKNAME..." if [ -f $RESPONSEFILE.$PACKNAME ]; then pkgadd -d $MEDIADIR -a $SRADMIN -r $RESPONSEFILE.$PACKNAME $PACKNAME >> $INSTALL_LOG 2>&1 else pkgadd -d $MEDIADIR -a $SRADMIN $PACKNAME >> $INSTALL_LOG 2>&1 fi if [ $? -ne 0 ]; then $ECHO $ECHO "WARNING: install Failed for $PACKNAME. Do you want" $ECHO "to continue with the installation of $PRODUCTNAME? y/[n] \c" read ANS if [ "$ANS" = "" ] || [ "$ANS" = "n" ] || [ "$ANS" = "N" ] then failed_install="1" cleanup_and_exit fi fi done } ############################################################## # # Create pkg admin file # create_pkg_admin() { $ECHO "basedir=$BASEDIR" > $SRADMIN $ECHO "action=nocheck" >> $SRADMIN $ECHO "conflict=nocheck" >> $SRADMIN $ECHO "setuid=nocheck" >> $SRADMIN $ECHO "mail=" >> $SRADMIN } ############################################################## # # get the domain name for the customers network. # # get_domain_name() { if [ "$DOMAIN" != "" ]; then nmtk=`$ECHO "$DOMAIN" | awk -F. '{ print NF }'` if [ $nmtk -lt 3 ]; then TOP_DOMAIN=$DOMAIN else TOP_DOMAIN=`$ECHO $DOMAIN | $AWK -F. '{ for (x = 2; x < NF; ++x) printf("%s.",$x) } { print $NF }'` fi $ECHO $TOP_DOMAIN > /tmp/domain else TOP_DOMAIN="$DOMAIN" fi valid=0 while [ $valid -eq 0 ] do $ECHO $ECHO "What is the domain name for your network? [$TOP_DOMAIN] \c " read ANS if [ "$ANS" != "" ] || [ "$TOP_DOMAIN" = "" ] then TD="$ANS" numtok=`$ECHO "$TD" | awk -F. '{ print NF }'` if [ $numtok -lt 2 ] then $ECHO "Invalid domain name entered..." else # # awk will return 2 as the number of tokens for input # of the form ".com, com., and sun.com". Need to check that # both of the tokens has a value # tmp1=`$ECHO $TD | $AWK -F. '{ print $1 }'` tmp2=`$ECHO $TD | $AWK -F. '{ print $2 }'` if [ "$tmp1" = "" ] || [ "$tmp2" = "" ] then $ECHO "Invalid domain name entered..." else $GREP -i "$TD" /tmp/domain > /dev/null 2>&1 if [ $? -eq 0 ] then TOP_DOMAIN="$TD" valid=1 else rsp=y $ECHO $ECHO "WARNING: $TD does not match the domain name known to " $ECHO "this system. Do you want to continue the installation " $ECHO "using $TD as the domain name? [$rsp]/n/q \c" read ANS if [ "$ANS" != "" ] then rsp="$ANS" fi case "$rsp" in [Yy]) valid=1; TOP_DOMAIN=$TD;; [Nn]) continue;; [Qq]) log "install aborted by user: invalid domain name.";failed_install="1";cleanup_and_exit;; esac fi fi fi else valid=1 fi done TOP_DOMAIN=".""$TOP_DOMAIN" rm -f /tmp/domain } ############################################################## # # # get_subdomain_name() { $ECHO $ECHO "What are the subdomains which reside on your private network" $ECHO "that will be served by the gateway server. Enter the subdomains one" $ECHO "at a time. Press return at the prompt when finished... " SUB_DOMAIN="" goodsubdom=0 while [ $goodsubdom -eq 0 ] do echo "subdomain [] \c" read subd if [ "$subd" != "" ] then if [ "$SUB_DOMAIN" = "" ] then SUB_DOMAIN="$subd" else SUB_DOMAIN="$SUB_DOMAIN""|""$subd" fi else if [ "$SUB_DOMAIN" = "" ] then echo "No subdomain entered" fi goodsubdom=1 fi done } ############################################################## # # # update_install_settings() { set_platform_values set_application_values set_gateway_values } ############################################################## # # these are the three 'main' servers, (platform, apps, and # gateway) These defaults are the basis for the other param's # which could possibly be split off someday # set_default_values() { AUTHHOST=$LOCALHOST AUTHPORT=8080 APPSHOST=$LOCALHOST APPSPORT=8080 SSLMODE="0" SSLPORT=443 GWHOST=$LOCALHOST GWPORT=443 RPROXYPORT=10443 EPROXYPORT=443 PROTOCOL=http AUTH_PORT_SSL=443 } ############################################################## # # currently the logserver runs with the platform so its port # and host name are always set to those values # set_platform_values() { LOGHOST=$AUTHHOST LOGPORT=$AUTHPORT } ############################################################## # # currently the preference server always runs with the application # server so it host and port are set to those values # set_application_values() { # when the apps and platform are on the same machine we need to # set the application values to the platform APPSHOST=$AUTHHOST APPSPORT=$AUTHPORT PREFHOST=$APPSHOST PREFPORT=$APPSPORT PREFURL='/logout' APPURL="http://$APPSHOST:$APPSPORT" DEFAULT_URL="http://$APPSHOST:$APPSPORT/servlet/SNDesktop?template=user_login\&onload=clearCookie()" } ############################################################## # # default settings for the gateway server # set_gateway_values() { chrooted=0 chrootdir=NA #nsproxyhost_and_port="" RPURL="https://$GWHOST:$GWPORT" } ############################################################## # # # get_eproxy_port() { goodport1=0 while [ $goodport1 -eq 0 ] do $ECHO "What port will the encrypting proxy (eproxy) run on? [$GWPORT] \c" read ANS if [ "$ANS" != "" ] then port1verified="`$ECHO \"$ANS\" | egrep \"[0-9]+\"`" if [ -n "$port1verified" ] then GWPORT=$ANS $ECHO "Using $GWPORT as eproxy port." goodport1=1 else $ECHO "Problem with format of port." $ECHO fi else goodport1=1 fi done } ############################################################## # # # get_rproxy_port() { #RPROXYPORT=10443 goodport2=0 while [ $goodport2 -eq 0 ] do $ECHO "What port will the reverse proxy (rproxy) run on? [$RPROXYPORT] \c" read ANS if [ "$ANS" != "" ] then RPROXYPORT="$ANS" fi port2verified="`echo \"$RPROXYPORT\" | egrep \"[0-9]+\"`" if [ -n "$port2verified" ] then if [ "$ANS" = "$GWPORT" ] then $ECHO $ECHO "The reverse proxy port must not be the same as the" $ECHO "encrypting proxy port." else goodport2=1 fi else $ECHO "Problem with format of port." $ECHO fi done } ############################################################## # # # get_webproxy_port() { if [ "$nsproxyhost" != "" ] then goodport3=0 while [ $goodport3 -eq 0 ] do echo "What port does $nsproxyhost run on? [] \c" read port3 port3verified="`echo \"$port3\" | egrep \"[0-9]+\"`" if [ -n "$port3verified" ] then goodport3=1 else echo echo "Problem with format of port." fi done nsproxyhost_and_port="${nsproxyhost}:${port3}" usensproxy="true" else nsproxyhost_and_port="" usensproxy="false" fi } ############################################################## # # # get_webproxy_host() { $ECHO $ECHO "What is the name of the host that will be used as the web proxy host?" $ECHO "If a web proxy is not available, or one is not required press return." goodhost2=0 while [ $goodhost2 -eq 0 ] do $ECHO "web proxy [] \c" read nsproxyhost if [ "$nsproxyhost" != "" ] then hostverified="`echo \"$nsproxyhost\" | \ egrep \"^[a-zA-Z0-9][-a-zA-Z0-9]*\.([a-zA-Z0-9][-a-zA-Z0-9]*\.)*[a-zA-Z0-9][a-zA-Z0-9]*$\"`" if [ -n "$hostverified" ] then goodhost2=1 else echo echo "Problem with format of host." fi else goodhost2=1 fi done } ############################################################## # # # use_default_values() { USE_DEFAULTS=N $ECHO $ECHO "Do you want to use the default settings? [y]/n \c" read ANS if [ "$ANS" = "" ] || [ "$ANS" = "y" ] || [ "$ANS" = "Y" ] then log "install using default values..." USE_DEFAULTS=Y fi } ############################################################## # # # cleanup_and_exit() { rm -f $RESPONSEFILE* rm -f $SRADMIN* rm -f $EMRMADMIN rm -f $JDKADMIN if [ "$failed_install" = "0" ]; then if [ "$START_PLATFORM" = "y" ] || [ "$START_PLATFORM" = "Y" ]; then nes_start elif [ "$installmode" = "1" ]; then adm_start fi fi $ECHO $ECHO "A log of the installation has been saved as $INSTALL_LOG..." exit } ############################################################## # # # netware_support() { answer=y $ECHO "Do you want to support NetWare access? [y]/n \c" read answer if [ "$answer" = "y" ] || [ "$answer" = "Y" ] || [ "$answer" = "" ] then version=`uname -a` $ECHO $version | $GREP " 5.6 " > /dev/null 2>&1 if [ $? = 0 ] then NETWARE_PKG=NetCon-26 else $ECHO $version | $GREP " 5.5." > /dev/null 2>&1 if [ $? = 0 ] then NETWARE_PKG=NetCon-25 else $ECHO "NetWare access are not support on your solaris version. Please use Solaris 2.5.X or 2.6." NETWARE_PKG="" fi fi fi } ############################################################## # # # MakeAdmin() { if [ -f /tmp/admin.$$ ]; then return fi; cat > /tmp/admin.$$ <> $INSTALL_LOG 2>&1 log "removing $1" fi; } ############################################################## # # # forward_packets() { answer=y #$ECHO #$ECHO "Do you want to turn off IP packet forwarding? [y]/n \c" #read answer #if [ "$answer" = "y" ] || [ "$answer" = "Y" ] || [ "$answer" = "" ] #then #/usr/sbin/ndd -set /dev/ip ip_forwarding 0 #fi } ############################################################## # # # check_firewall_support() { version=`uname -a` $ECHO $version | $GREP " 5.7 " > /dev/null 2>&1 if [ $? = 0 ] then $ECHO "Firewall is not supported on Solaris 2.7, skipping firewall installation..." addfw="not_supported" log "running on 2.7, firewall will not be installed." else addfw="y" $ECHO "Do you also want to install the firewall on this system? [$addfw]/n \c" read ANS if [ "$ANS" != "" ]; then addfw=$ANS fi if [ "$addfw" = "y" ]; then rbnow="n" $ECHO $ECHO "After the firewall packages have been installed you will need to" $ECHO "reboot your system and configure the firewall. Do you want the" $ECHO "installation script to reboot the system for you? y/[n] \c" read ANS if [ "$ANS" != "" ]; then rbnow=$ANS fi fi fi } ############################################################## # # # check_jdk_version_11() { $ECHO $ECHO "Checking for previous versions of the jdk ..." } ############################################################## # # # check_jdk_version() { JAVA_PKG_LIST="SUNWj2dem SUNWj2dev SUNWj2man SUNWj2rt" REQUIRED_VERSION="Solaris_JDK_1.2.1_03" install=0 must_install=0 $ECHO $ECHO "Checking which version of Java is currently installed..." jversion="" pkginfo -q SUNWj2rt if [ $? -eq 0 ]; then basedir=`pkginfo -i -l SUNWj2rt | $AWK '/BASEDIR/ { print $2 }'` jversion="1.2" else # java 1.1 check pkginfo -q SUNWjvrt if [ $? -eq 0 ]; then basedir=`pkginfo -i -l SUNWjvrt | $AWK '/BASEDIR/ { print $2 }'` jversion="1.1" fi fi basedir=${basedir:-"unknown"} if [ $basedir = "unknown" ]; then $ECHO "No Java runtime packages were found." install=1 must_install=1 else if [ "$jversion" = "1.1" ]; then if [ "$basedir" = "/" ]; then basedir="$basedir/usr" fi fi JAVA="$basedir/bin/java" if [ ! -x $JAVA ]; then $ECHO "The Java runtime package was found, but the java executable was not" $ECHO "located. It was expected at: $JAVA" must_install=1 else FULLVERSION=`$JAVA -fullversion 2>&1` if [ $? -ne 0 ]; then $ECHO "Error executing \"$JAVA -fullversion\", error was:" $ECHO "$FULLVERSION" must_install=1 elif [ "$FULLVERSION" = "" ]; then mustinstall=1 install=1 else FULLVERSION=`$ECHO $FULLVERSION 2>&1 | $AWK '/^java/ { print $4 }'` FULLVERSION=`$ECHO $FULLVERSION | $AWK -F\" '{ print $2}'` old_ifs=$IFS IFS=_ set $FULLVERSION INSTALLED_VERSION=$3 IFS=. set $INSTALLED_VERSION MAJOR=$1 MINOR=$2 REV=$3 IFS=$old_ifs REQ_MAJOR=1 REQ_MINOR=2 REQ_REV=1 if [ "$MAJOR" -eq "$REQ_MAJOR" -a "$MINOR" -eq "$REQ_MINOR" -a $REV -ge "$REQ_REV" ]; then $ECHO "The correct version of Java is already installed on this machine..." log "The correct version of Java is already installed on this machine..." return else log "The Java runtime package was located but it is the wrong version." $ECHO "The Java runtime package was located but it is the wrong version." $ECHO " required verion: $REQUIRED_VERSION" $ECHO " installed version: $FULLVERSION" $ECHO must_install=1 fi fi fi fi $ECHO "Do you want to continue and install the required version? y/[n] \c" read answer answer=${answer:-"no"} if [ $answer = "no" ] || [ "$answer" = "n" ] || [ "$answer" = "N" ]; then install=0 if [ $must_install -eq 1 ]; then $ECHO $ECHO "You have selected to not install Java on this machine." $ECHO "Java major version \"$REQUIRED_VERSION\" is required to " $ECHO "run the $PRODUCTNAME software, aborting installation..." failed_install=1 cleanup_and_exit fi else install=1 fi } ############################################################## # # # install_jdk_pkgs() { if [ $install -eq 1 ]; then $ECHO "Removing existing jdk packages ... \c" # java 2 RemoveIfPresent SUNWj2dem RemoveIfPresent SUNWj2dev RemoveIfPresent SUNWj2man RemoveIfPresent SUNWj2rt # java 1.1 RemoveIfPresent SUNWsnjdk RemoveIfPresent SUNWjvdem RemoveIfPresent SUNWjvman RemoveIfPresent SUNWjvdev RemoveIfPresent SUNWjvjit RemoveIfPresent SUNWjvrt $ECHO "done." WCL=`pkginfo | grep SUNWjvrt` WCL2=`pkginfo | grep SUNWj2rt` if [ "$WCL" != "" ] || [ "$WCL2" != "" ]; then $ECHO $ECHO "WARNING: extra copies of the Java packages have been detected on" $ECHO "on this system. These packages may prevent the installation of the" $ECHO "Java packages required by $PRODUCTNAME. It is recommended that you" $ECHO "quit this installation and remove the extra packages, then run " $ECHO "iplanet_install again:" $ECHO " $WCL $WCL2" failed_install=1 cleanup_and_exit fi $ECHO "basedir=default" > $JDKADMIN $ECHO "action=nocheck" >> $JDKADMIN $ECHO "conflict=nocheck" >> $JDKADMIN $ECHO "setuid=nocheck" >> $JDKADMIN $ECHO "idepend=nocheck" >> $JDKADMIN $ECHO "mail=" >> $SRADMIN $ECHO "Installing jdk packages ... " for PKGNAME in $JAVA_PKG_LIST do $ECHO " $PKGNAME..." pkgadd -d $MEDIADIR -a $JDKADMIN $PKGNAME >> $INSTALL_LOG 2>&1 if [ $? -ne 0 ]; then $ECHO $ECHO "WARNING: install failed for $PKGNAME. Do you want" $ECHO "to continue with the installation of $PRODUCTNAME? y/[n] \c" read ANS if [ "$ANS" = "" ] || [ "$ANS" = "n" ] || [ "$ANS" = "N" ]; then failed_install="1" cleanup_and_exit fi fi done $ECHO "done." fi } ############################################################## # # # generate_passphrase() { $ECHO $ECHO "creating passphrase to be used for the certificate..." $ECHO "IMPORTANT: Remember this passphrase, it will be needed to start" $ECHO "the gateway after the installation." passpair=0 while [ $passpair -eq 0 ] do goodpass=0 while [ $goodpass -eq 0 ] do $ECHO "Enter passphrase [] \c" stty -echo read passphrase stty echo if [ "$passphrase" != "" ] then passverified=`echo $passphrase | $GREP ' '` if [ "$passverified" = "" ] then goodpass=1 else $ECHO $ECHO "Passphrase cannot contains spaces." $ECHO fi else $ECHO $ECHO "Passphrase cannot be blank." $ECHO fi done $ECHO $ECHO "Verify (re-enter) passphrase [] \c" stty -echo read passp2 stty echo $ECHO if [ "$passphrase" != "$passp2" ] ; then $ECHO "Passphrases did not match. Please Re-enter." $ECHO else passpair=1 fi done $ECHO $ECHO "Passphrase accepted." $ECHO #stuff pasphrase into .rppass if [ ! -d $KEYBASE ] ; then $MKDIR -p $KEYBASE fi $ECHO "$passphrase" > $KEYSTOREPASSFILE $CHMOD 400 $KEYSTOREPASSFILE } ############################################################## # # # create_certificate() { $ECHO log "creating new self-signed certificate..." $ECHO "Creating new self-signed certificate..." okk=0 while [ $okk -eq 0 ] do $ECHO $ECHO "NOTE: Certificate field entries cannot contain an '=' character." $ECHO $ECHO "What is the name of your organization (ex: Company)? [] \c" read orgname if [ "$orgname" = "" ] then orgname="Organization X" fi $ECHO "What is the name of your organizational unit (ex: division)? [] \c" read orgunit if [ "$orgunit" = "" ] then orgunit="Division Y" fi $ECHO "What is the name of your City or Locality? [] \c" read city if [ "$city" = "" ] then city="City" fi $ECHO "What is the name of your State or Province? [] \c" read state if [ "$state" = "" ] then state="State" fi $ECHO "What is the two-letter country code for this unit? [] \c" read country ver=`echo $country | $AWK '{print (substr($0,0,2));}'` if [ "$ver" = "" ] then country="US" else country=$ver fi a=`$ECHO $orgname | $GREP '='` b=`$ECHO $orgunit | $GREP '='` c=`$ECHO $city | $GREP '='` d=`$ECHO $state | $GREP '='` e=`$ECHO $country | $GREP '='` if [ "$a$b$c$d$e" != "" ] ; then $ECHO $ECHO "Certificate Fields cannot contain an '=' character. Please re-enter" $ECHO "certificate information." $ECHO else okk=1 fi done generate_passphrase # order of inputs depends on file situation if [ -f $KEYSTORE ] || [ -f $CASTORE ] ; then $ECHO "$passphrase $GWHOST $orgname $orgunit $city $state $country yes" > $CERTTEMPFILE else $ECHO "$GWHOST $orgname $orgunit $city $state $country yes $passphrase" > $CERTTEMPFILE fi } ############################################################## # # # build_test_cert() { $ECHO $ECHO $ECHO "IMPORTANT: You must have a self-signed certificate for the SSL server." $ECHO $ECHO "This certificate will be used for the SSL connections. You can" $ECHO "generate a request for a certificate from a Certificate Authority (CA)" $ECHO "and install CA certificates after this installation using the" $ECHO "'$BASEDIR/SUNWsnrp/bin/certadmin' script." $ECHO if [ -f $KEYSTORE ] ; then $ECHO "A certificate was found on this server, do you want to use this certificate? [y]/n \c" read ANS if [ "$ANS" = "" ] || [ "$ANS" = "Y" ] || [ "$ANS" = "y" ] ; then if [ -f $KEYSTOREPASSFILE ] ; then return else generate_passphrase fi else # move old keystore/CAstore if [ -f "$KEYSTORE.bak" ] ; then $MV -f $KEYSTORE.bak $KEYSTORE.bak2 fi if [ -f "$KEYSTOREPASSFILE.bak" ] ; then $MV -f $KEYSTOREPASSFILE.bak $KEYSTOREPASSFILE.bak2 fi if [ -f "$CASTORE.bak" ] ; then $MV -f $CASTORE.bak $CASTORE.bak2 fi $ECHO "Moving:" $ECHO " $KEYSTORE to $KEYSTORE.bak" $MV -f $KEYSTORE $KEYSTORE.bak if [ -f $CASTORE ] ; then $ECHO " $CASTORE to $CASTORE.bak" $MV -f $CASTORE $CASTORE.bak fi if [ -f $KEYSTOREPASSFILE ] ; then $MV -f $KEYSTOREPASSFILE $KEYSTOREPASSFILE.bak fi create_certificate fi else $ECHO "No certificate was found on this server. \c" create_certificate fi } ############################################################## # # make sure machine knows what its own domain name is # check_domain_name() { DOMAIN=`domainname` if [ "$DOMAIN" = "" ] then LOCALHOST="`uname -n`" else LOCALHOST="`uname -n`.$DOMAIN" fi } ############################################################## # # install the gateway server # install_gateway() { log "installing the gateway server..." # entire firewall will be bundled with this release (sol 8 bundle) so don't # install our mini-efs # # check_firewall_support check_jdk_version set_gateway_values use_default_values if [ "$USE_DEFAULTS" = "Y" ] then get_install_dir default get_gateway_host get_server_host get_webproxy_host get_webproxy_port get_domain_name get_subdomain_name else get_install_dir gateway get_gateway_host get_eproxy_port get_rproxy_port get_server_host get_server_port get_webproxy_host get_webproxy_port get_domain_name get_subdomain_name gateway_ssl # # no chroot for beta... # get_chroot # fi forward_packets update_install_settings display_gateway_settings create_pkg_admin build_test_cert gateway build_response_files $ECHO install_jdk_pkgs PKG_LIST=$GW_PKG_LIST install_stnr_pkgs # entire firewall will be bundled with this release (sol 8 bundle) so don't # install our mini-efs # # install_firewall $ECHO $ECHO "$PRODUCTNAME Gateway has been successfully installed." log "gateway installation done." } ############################################################## # # Do typical install, asking as few questions of the installer as possible # install_platform() { $ECHO $ECHO $ECHO $ECHO "************************************************************************" $ECHO "********* Install Server Components *********" $ECHO "************************************************************************" $ECHO $ECHO $ECHO "1) $PRODUCTNAME Server" $ECHO "2) Applications Server" $ECHO "3) Both Servers" $ECHO "4) Return to Main Menu" $ECHO "----------------------------" $ECHO "choice: [3] \c" read installmode if [ "$installmode" = "1" ] then log log "installing platform server..." #we are not supporting netware right now. #netware_support #PKG_LIST="$PLAT_PKG_LIST $NETWARE_PKG" PKG_LIST=$PLAT_PKG_LIST install_servers #SOL8-BUNDLE install_license_manager log "platform installation done." elif [ "$installmode" = "2" ] then log log "installing the application server..." PKG_LIST=$APPS_PKG_LIST install_servers log "application installation done." elif [ "$installmode" = "3" ] then log log "installing both servers..." local_install #SOL8-BUNDLE install_license_manager log "local installation done." else continue fi # need to create /opt/SUNWwa if it doesn't exists so the # webserver will startup. if [ ! -d "/opt/SUNWwa" ] then log "creating $BASEDIR/SUNWwa" $MKDIR "/opt/SUNWwa" fi } ############################################################## # # find out where to install everything # arg = gateway | server | default | new_location # get_install_dir() { INSTALL_TYPE=$1 VALID_DIR=0 while [ $VALID_DIR -eq 0 ] do if [ "$INSTALL_TYPE" != "default" ] then if [ "$INSTALL_TYPE" = "new_location" ]; then $ECHO $ECHO "What is the new directory to use for installation? [] \c" else $ECHO $ECHO "What directory do you want to use for installation? [$BASEDIR] \c" fi read ANS if [ "$ANS" = "" ] then VALID_DIR=1 else if [ -d "$ANS" ] then VALID_DIR=1 BASEDIR="$ANS" else $ECHO $ECHO "The directory you entered, $ANS, does not exist. This program can" $ECHO "create it for you, or you can enter a new directory. Would you" $ECHO "like to create this directory? [y]/n \c" read CREATE if [ "$CREATE" = "y" ] || [ "$CREATE" = "Y" ] || [ "$CREATE" = "" ] then $MKDIR -p $ANS >> /dev/null 2>&1 if [ $? -eq 0 ] then VALID_DIR=1 BASEDIR="$ANS" log "creating $ANS for installation" else $ECHO $ECHO "A problem was encountered while trying to create \"$ANS\"." $ECHO "Please enter a new directory." fi fi fi fi else VALID_DIR=1 fi # check disk space requirements if we have a valid dir if [ $VALID_DIR -eq 1 ] then if [ "$INSTALL_TYPE" = "gateway" ] then check_disk_space $GW_PKG_SIZE else check_disk_space $SERVER_PKG_SIZE fi if [ $? -ne 0 ] then VALID_DIR=0 fi fi done } ############################################################## # # verify_host() { ping $1 2 > /dev/null 2>&1 if [ ! $? -eq 0 ] then $ECHO $ECHO $ECHO "WARNING: $1 is invalid or not responding. Do you still" $ECHO "want to use this as the host name? y/[n] \c" read ANS if [ "$ANS" != "y" ] && [ "$ANS" != "Y" ] then return 1 fi fi TOKENS=`$ECHO $1 | $AWK -F. '{ print NF }'` if [ "$TOKENS" -lt 3 ] then $ECHO $ECHO "The value entered, $1, is not valid. You must use a fully" $ECHO "qualified host name. Press return to continue... \c" read nothing return 1 fi return 0 } ############################################################## # # # get_gateway_host() { while [ 1 ] do $ECHO $ECHO "What is the fully qualified host name of the external " $ECHO "interface to the internet for the machine where the gateway " $ECHO "server will run? [$GWHOST] \c" read ANS if [ "$ANS" != "" ]; then GWHOST="$ANS" fi verify_host "$GWHOST" if [ $? -eq 0 ] then return fi done } ############################################################## # # # get_gateway_port() { $ECHO "What is the gateway port? [$GWPORT] \c" read ANS if [ "$ANS" != "" ]; then GWPORT="$ANS" fi } ############################################################## # # # get_server_host() { while [ 1 ] do $ECHO $ECHO "What is the fully qualified host name of the machine where" $ECHO "the platform server will run? [$LOCALHOST] \c" read ANS if [ "$ANS" != "" ]; then AUTHHOST="$ANS" fi LOCALHOST=$AUTHHOST verify_host "$AUTHHOST" if [ $? -eq 0 ] then return fi done } ############################################################## # # # get_server_port() { if [ "$PROTOCOL" = "https" ]; then AUTHPORT=8080 return fi $ECHO "What is the platform server port? [$AUTHPORT] \c" read ANS if [ "$ANS" != "" ]; then AUTHPORT="$ANS" fi } ############################################################## # # # get_apps_host() { while [ 1 ] do APPSHOST=$LOCALHOST $ECHO $ECHO "What is the fully qualified host name of the machine where" $ECHO "the applications will run? [$LOCALHOST] \c" read ANS if [ "$ANS" != "" ]; then APPSHOST="$ANS" fi verify_host "$APPSHOST" if [ $? -eq 0 ] then return fi done } ############################################################## # # # get_apps_port() { $ECHO "What is the applications port? [$LOCALPORT] \c" read ANS if [ "$ANS" != "" ]; then APPSPORT="$ANS" fi } ############################################################## # # # get_log_host() { while [ 1 ] do LOGHOST=$LOCALHOST $ECHO $ECHO "What is the fully qualified host name of the machine where" $ECHO "the log server will run? [$LOCALHOST] \c" read ANS if [ "$ANS" != "" ]; then LOGHOST="$ANS" fi verify_host "$LOG_HOST" if [ $? -eq 0 ] then return fi done } ############################################################## # # # get_log_port() { $ECHO "What is the log server port? [$LOCALPORT] \c" read ANS if [ "$ANS" != "" ]; then LOGPORT="$ANS" fi } ################################################### # # this will get the name of the local machine and # use it as the DEFAULTHOST value # get_local_host() { while [ 1 ] do LOCALHOST=$LOCALHOST $ECHO $ECHO "What is the fully qualified host name of this machine? [$LOCALHOST] \c" read ANS if [ "$ANS" != "" ]; then LOCALHOST="$ANS" fi verify_host "$LOCALHOST" if [ $? -eq 0 ] then return fi done } ############################################################## # # # get_local_port() { $ECHO "What port will the services listen on? [$LOCALPORT] \c" read ANS if [ "$ANS" != "" ]; then LOCALPORT="$ANS" fi } ############################################################## # # # get_default_url() { DEFAULT_URL="http://$APPSHOST:$APPSPORT/servlet/SNDesktop?template=user_login" $ECHO $ECHO "What is the default URL for authenticated users: [$DEFAULT_URL] \c" read ANS if [ "$ANS" != "" ]; then DEFAULT_URL="$ANS" fi } ############################################################## # # gateway_ssl() { $ECHO $ECHO "Do you want use SSL to communicate with the $PRODUCTNAME Server? y/[n] \c" read ANS # # default for PROTOCOL and SSL_PORT already set in default_values # if [ "$ANS" = "y" ] || [ "$ANS" = "Y" ] then SSLMODE="1" $ECHO "What port will be used for the SSL communication? [443] \c" read ANS if [ "$ANS" != "" ] then SSLPORT="$ANS" fi fi } ############################################################## # # use_ssl() { $ECHO $ECHO "Do you want use SSL to communicate with the Gateway Server? y/[n] \c" read ANS # # default for PROTOCOL and SSL_PORT already set in default_values # if [ "$ANS" = "y" ] || [ "$ANS" = "Y" ] then PROTOCOL=https $ECHO "What port will be used for the SSL communcation? [443] \c" read ANS if [ "$ANS" != "" ] then AUTH_PORT_SSL="$ANS" fi fi } ############################################################## # # local installation, apps and platform services on the same machine. # user has the option to accept the default port values(8080 and 443) # local_install() { log "installing the platform server..." check_for_http_processes check_jdk_version use_default_values if [ "$USE_DEFAULTS" = "Y" ] then check_disk_space $SERVER_PKG_SIZE get_server_host get_gateway_host else get_install_dir server use_ssl get_server_host get_server_port get_gateway_host get_gateway_port fi check_for_nes_install update_install_settings display_platform_settings create_pkg_admin build_response_files auto_platform_startup #SOL8-BUNDLE is_license_pkg_installed $ECHO install_jdk_pkgs nes_install PKG_LIST=$SERVER_PKG_LIST $ECHO "Installing Core $PRODUCTNAME Software ..." install_stnr_pkgs #SOL8-BUNDLE install_license_manager } ################################################### # # install the platform or apps servers # # install_servers() { use_default_values if [ "$USE_DEFAULTS" = "Y" ] then get_server_host get_gateway_host get_apps_host else get_install_dir get_server_host get_server_port set_default_values get_gateway_host get_gateway_port get_apps_host get_apps_port fi update_install_settings display_platform_settings create_pkg_admin build_response_files auto_platform_startup $ECHO install_stnr_pkgs } ############################################### # # just tell the user if they want samba to insert the # other CD # display_samba_message() { $ECHO $ECHO "$PRODUCTNAME has been successfully installed. If you would like to use the" $ECHO "Netfile application to access PC's running Win95, Win98 or NT (via SAMBA)," $ECHO "insert the CD entitled \"3rd party software\", and run the \"install_3ps\" script." } ############################################### # # display the welcome sign # banner() { $ECHO $ECHO $ECHO "************************************************************************" $ECHO " Welcome to the $PRODUCTNAME installation" $ECHO "************************************************************************" } ############################################### # # startup message # start_message() { $ECHO $ECHO $ECHO "Installation of the $PRODUCTNAME software involves installing the " $ECHO "$PRODUCTNAME Server and the $PRODUCTNAME Gateway. They do not need" $ECHO "to be installed on the same machine. A log of the installation can" $ECHO "be found at $INSTALL_LOG." } ############################################### # # test for root user # check_root_user() { if test `id | /usr/bin/awk '{print $1}'` != "uid=0(root)" then $ECHO "You must be root user to run $0." exit 1 fi } ############################################### # # check if the install log dir exists and create it if # it's missing # create_install_log() { if [ ! -d /var/opt/SUNWstnr/debug ] then $MKDIR -p /var/opt/SUNWstnr/debug fi $ECHO "beginning installation of $PRODUCTNAME on `date`..." > $INSTALL_LOG 2>&1 } ############################################### # # check_os() { os=`uname -s` release=`uname -r` old_ifs=$IFS IFS=. set $release IFS=$old_ifs major=$1 minor=$2 patch=$3 if [ "$os" != "SunOS" -o $major -ne 5 -o $minor -lt 6 ] then $ECHO "Sorry, you need to be running SunOS 5.6 or better." exit 2 fi } ############################################### # # check if there is enough diskspace # arg = required space # check_disk_space() { $ECHO $ECHO "verifying disk space requirements..." DISK_SPACE_OK=FALSE while [ $DISK_SPACE_OK != TRUE ] do BASE_BASEDIR=$BASEDIR /usr/bin/df -k $BASEDIR >/dev/null 2>&1 EX_STAT=$? while [ $EX_STAT -ne 0 ] do BASE_BASEDIR=`/bin/dirname $BASE_BASEDIR` /usr/bin/df -k $BASE_BASEDIR >/dev/null 2>&1 EX_STAT=$? done DISK_AVAIL=`/usr/bin/df -k $BASE_BASEDIR| /usr/bin/grep -v Filesystem| /usr/bin/awk '{print $4}'` if [ $1 -gt "$DISK_AVAIL" ]; then $ECHO $ECHO $ECHO "WARNING: $BASEDIR does not have enough space available for " $ECHO "installation. $1 kilobytes of disk space are required and" $ECHO "only $DISK_AVAIL kilobytes are available." $ECHO $ECHO "Do you want to continue the installation in $BASEDIR? y/[n] \c" read ANS if [ "$ANS" = "y" ] || [ "$ANS" = "Y" ]; then $ECHO "Installation will attempt to continue." DISK_SPACE_OK=TRUE else get_install_dir new_location fi else DISK_SPACE_OK=TRUE fi done } ############################################### # # check the patches that are installed # check_patches_installed() { log "-checking for required patches" version=`uname -a` OS_VERSION=`$ECHO $version | $AWK '{ print $3 }'` log "running solaris $OS_VERSION" if [ "$OS_VERSION" = "5.6" ]; then patches="105181-11 105210-17 105490-05 105568-13 105633-21 105669-04 106040-10 106409-01" elif [ "$OS_VERSION" = "5.7" ]; then patches="106980-04 107078-08" else patches="" log "no patches required for SunOS $OS_VERSION" fi DD=0 for patch in $patches; do old_ifs=$IFS IFS="-" set $patch major_req=$1 minor_req=$2 IFS=$old_ifs ipatch=`showrev -p | awk '{ print $2 }' | grep $major_req` if [ "$ipatch" = "" ]; then msg="WARNING: patch $patch is recommended/required for JDK 1.2.1" msg="$msg\non SunOS $OS_VERSION" log "$msg" $ECHO $ECHO "$msg" DD=1 else DD=1 for spatch in $ipatch; do old_ifs=$IFS IFS="-" set $spatch major_inst=$1 minor_inst=$2 IFS=$old_ifs if [ $minor_inst -ge $minor_req ]; then DD=0 fi done if [ "$DD" = "1" ]; then msg="WARNING: patch $patch is recommended/required for JDK 1.2.1" msg="$msg\non SunOS $OS_VERSION, you the following patches installed:" msg="$msg\n$ipatch" log "$msg" $ECHO $ECHO "$msg" fi fi done if [ "$DD" = "1" ]; then $ECHO $ECHO "Required/recommended patche(s) not found. Said patches may" $ECHO "or may not apply to your system. Only continue if you are" $ECHO "sure they do not apply. Test this by attempting to install" $ECHO "them." $ECHO $ECHO "Abort installation? [y]/n \c" read ans if [ "$ans" = "n" ] || [ "$ans" = "N" ]; then $ECHO "Continuing ... " else exit 1 fi fi } ############################################################################## ssl_setup() { SSL_INSTANCE="$BASEDIR/SUNWstnr/bin/ssl-instance" $SSL_INSTANCE -z -c -p "$AUTH_PORT_SSL" -o "https" } ###### # # Print out license text since we've removed license enforcement for # Solaris 8 bundle (RevB) # license_accept() { $ECHO "BY INSTALLING THIS SOFTWARE YOU ARE CONSENTING TO BE BOUND BY" $ECHO "AND ARE BECOMING A PARTY TO THE AGREEMENT FOUND IN THE" $ECHO "LICENSE.txt FILE. IF YOU DO NOT AGREE TO ALL OF THE TERMS" $ECHO "OF THIS AGREEMENT, PLEASE DO NOT INSTALL OR USE THIS SOFTWARE." $ECHO "" $ECHO "Do you accept the terms of this license [No]?" read ans if [ "$ans" != "Yes" ] && [ "$ans" != "YES" ] && [ "$ans" != "yes" ]; then exit 1 fi } # ############################################################################## # # starting main routine, don't put any functions from here down # check_os check_root_user banner license_accept check_domain_name create_install_log check_patches_installed check_for_prior_install start_message set_default_values # cd out of cdrom dir, so as to make sure no process gets started with # cwd = the cdrom, otherwise cdrom can't eject cd "/" $ECHO $ECHO "1) Server" $ECHO "2) Gateway" $ECHO "3) Exit" $ECHO "------------------" $ECHO "choice: [3] \c" read installmode if [ "$installmode" = "1" ] then local_install elif [ "$installmode" = "2" ] then install_gateway else failed_install=1 fi # copy the version file from the CD onto the machine if [ -f "$MEDIADIR/.version" ] then $CP -p $MEDIADIR/.version /etc/opt/SUNWstnr/.version log "copying version file into /etc/opt/SUNWstnr" fi if [ "$PROTOCOL" = "https" ]; then $ECHO "Configuring for SSL ... " ssl_setup $ECHO "done." fi cleanup_and_exit