Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/ksh
- # *****************************************************************************
- # Copyright (c) 1989-2008
- # UGS. All rights reserved
- # SCCS: @(#) link_stamp ug_install V6.0.0.24 06/18/08 18:39:54
- # *****************************************************************************
- # Title: ug_install
- # Purpose: To install NX on Unix workstations.
- # *****************************************************************************
- # Rev History:
- # 6.0.0.7 Ric Baxter 31JUL07 Initial NX 6.0 version taken directly from NX 5.0.
- # 6.0.0.12 Ric Baxter 02OCT07 Phase 12. no changes.
- # 6.0.0.14 Ric Baxter 30OCT07 Tweaks to Select_products for Linux problem.
- # 6.0.0.16 Ric Baxter 11DEC07 Added NXASSEMBLY kit dependency logic.
- # 6.0.0.16 Ric Baxter 11DEC07 Change .ugii_env file to ugii_env.dat.
- # 6.0.0.19 Ric Baxter 21FEB08 Changes to support standalone license file.
- # 6.0.0.21 Ric Baxter 25MAR08 More chngs for Standalone license file support.
- # 6.0.0.24 Ric Baxter 20MAY08 Final NX6 version.
- # *****************************************************************************
- # *****************************************************************************
- # GLOBAL VARIABLES ************************************************************
- # *****************************************************************************
- # Unset any aliases to preclued colisions.
- unalias $(alias | cut -d= -f1 | grep ^[0-z]) 2>&- # Add grep for AIX V160P18
- print "initializing ...\c" # Put out a simple startup message.
- CMD_LINE_ARGS=$* # Immediately save any cmd line args.
- PRODNAME="NX" # The product this script installs.
- NX_VER="V6.0" # New NX style Alpha-numeric version.
- UG_VER="V24.0" # Old UG style Alpha-numeric version.
- VNUM="060" # Numeric-only version.
- FNUM="6" # Simple Numeric version for filenames.
- SCRIPTNAME=`basename $0` # Script name without the directory.
- SCRIPTDIR=$(cd $(dirname $0) ; pwd) # Get an absolute path to the script.
- CWD=`pwd` # Preserve current directory name.
- HOST=$(uname -n 2>&- || hostname 2>&-) # Try 'hostname' if uname -n fails.
- NULL=/dev/null # Global for Linux cuz cant use 1>&-
- # Standardized text message and screen variables.
- NOTE="\n NOTE: " ; ERR="\nERROR: " ; WARN="\nWARNING: "
- MSG="\n " ; QUE="\n* " ; TAB=" "
- FILL_TXT="______________________________________" # Forms inter-field filler.
- REENTER=" *****> " # Forms re-enter flag.
- SELECTED="-->" # Product selected flag
- UNSELECTED="no" # Product unselected flag
- # Set machine dependant variables.
- MACHINE=`uname` # Save machine var. for future use.
- REV=`uname -r` # Save the revision of the OS.
- case $MACHINE in
- AIX) # Machine type AIX.
- PATH=/usr/bin:/etc:/etc/yp:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/etc:.
- export PATH # Set the PATH
- UGS_TMP=/tmp/ugs_tmp # Define tmp dir for old files.
- X11_DIR=/usr/lib/X11 # X11 directory for this system.
- PS_CMD="ps -ef" # ps command for this system.
- AWK_CMD=awk # awk command for this system.
- DF_CMD="df -I" # df command for this system.
- RC_DIR=/etc # Dir for real rc scripts.
- RC_LNK_DIR="" # Not used on IBM.
- TMP_DIR=/tmp # Tmp directory.
- LPATH_VAR_NAME=LIBPATH # Library path var name. V160P14
- RC_PATH_VAR=/usr/bin:/etc:/usr/sbin:/usr/ucb:/sbin:/usr/etc
- ;;
- HP-UX) # Machine type is HP
- # Check if the HP-UX is at least V11. test w/o leading letters or decimal.
- [ "${REV#*${REV%%[0-9]*}}" -lt 11 ] && { # Pre V11 no longer supported.
- print "${ERR} $MACHINE $REV is not supported." >&2 ; exit 1
- }
- PATH=.:/usr/sbin:/sbin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin
- RC_DIR=/sbin/init.d # Dir for real rc files
- RC_LNK_DIR="/sbin/rc3.d" # Dir links to rc files. Chngd V120P10
- RC_PATH_VAR=/usr/sbin:/sbin:/usr/bin
- UGS_TMP=/tmp/ugs_tmp # Define a tmp area for old files.
- X11_DIR=/usr/lib/X11 # X11 directory for this system.
- AWK_CMD=awk # awk command for this system.
- DF_CMD=bdf # df command for this system.
- PS_CMD="ps -ef" # ps command for this system.
- TMP_DIR=/tmp # Tmp directory.
- LPATH_VAR_NAME=SHLIB_PATH # Library path var name. V160P14
- ;;
- Linux) # Machine type Linux
- PATH=.:/sbin:/usr/sbin:/usr/bin:/bin:/etc ; export PATH # Set the PATH
- UGS_TMP=/tmp/ugs_tmp # Define a stash area for old files.
- X11_DIR=/usr/lib/X11 # X11 directory for this system.
- PS_CMD="ps -ef" # ps command for this system.
- DF_CMD="df -k" # df command for this system.
- AWK_CMD=awk # awk command for this system.
- RC_DIR=/etc/rc.d # Dir for real rc scripts
- RC_LNK_DIR=/etc/rc.d/rc5.d # Dir for links to rc scripts
- TMP_DIR=/tmp # Tmp directory.
- LPATH_VAR_NAME=LD_LIBRARY_PATH # Library path var name. V160P14
- RC_PATH_VAR=/sbin:/usr/sbin:/usr/bin:/bin:/etc
- alias -x pwd='pwd -L' # Tweak Linux pwd to give logical pwd.
- alias -x uncompress=gunzip # On SuSE 10 must use gunzip. NX050P24
- ;;
- SunOS) # Machine type SUN.
- case $REV in
- 5*) # OS is Solaris.
- PATH=.:/sbin:/usr/sbin:/usr/bin:/bin:/etc ; export PATH # Set the PATH
- UGS_TMP=/var/tmp/ugs_tmp # Define a stash area for old files.
- X11_DIR=/usr/openwin/lib # X11 directory for this system.
- PS_CMD="ps -ef" # ps command for this system.
- DF_CMD="df -k" # df command for this system.
- AWK_CMD=nawk # awk command for this system.
- RC_DIR=/etc/init.d # Dir for real rc scripts
- RC_LNK_DIR="/etc/rc3.d" # Dir for links to rc scripts
- TMP_DIR=/var/tmp # Tmp directory.
- LPATH_VAR_NAME=LD_LIBRARY_PATH # Library path var name. V160P14
- RC_PATH_VAR=/sbin:/usr/sbin:/usr/bin:/bin:/etc
- ;;
- *) print "${ERR} $MACHINE $REV is not supported." >&2 ; exit 1
- ;;
- esac
- ;;
- *) print "${ERR} $MACHINE is not supported." >&2 ; exit 1
- ;;
- esac
- # ****************************************************************************
- # FUNCTION DEFINITIONS ********************************************************
- # ****************************************************************************
- Ask_base_dir() # Ask where the base directory is, or where to put it.
- { # RKB Apr 16 12:22:54 1993 V10
- # RKB updtd: Nov 9 22:11 1993 Chnged to allow use of link for base dir.
- # RKB updtd: Mar 14 07 Add preemptive ck for subdirs of /usr/ugs$VUM.
- [ "$BASE_PMT" = "n/a" ] && return 1
- unset BASE_DIR BASE_MSG BASE_FLAG # If we ask the question, unset em.
- # If /usr/ugs$VNUM is a mount point we'll have trouble renaming it.
- [ $BASE_PMT != /usr/ugs$VNUM ] && {
- [ `Get_fs_info -mnt /usr/ugs$VNUM` = /usr/ugs$VNUM ] && {
- print "${NOTE}/usr/ugs$VNUM is a mount point,
- \r\tit cannot be renamed or removed."
- }
- }
- # Do all checking on the user's answer ANS then make it BASE_DIR.
- while true ; do # base dir question loop.
- print "${QUE}Enter full pathname for UG BASE
- \r\tdirectory. [$BASE_PMT]: \c"
- read ANS
- case ${ANS:=$BASE_PMT} in
- h|he|hel|help|H|HE|HEL|HELP|"?") Help_install Ask_base ; continue ;;
- !) print "Use ^d to return to $SCRIPTNAME" ; $SHELL ; continue ;;
- q|qu|qui|quit|Q|QU|QUI|QUIT) return 1 ;;
- /usr/ugs$VNUM/*) # Preemptive check for subdirs of /usr/$VNUM. NX5P25a.
- print "${NOTE}Cannot enter a subdirectory of /usr/ugs$VNUM
- \r\tThat directory name is a reserved pathname with an expected
- \r\ttree structure used by other programs and scripts.
- \n\tYou may use /usr/ugs$VNUM or another directory, but not a
- \r\tsubdirectory of /usr/ugs$VNUM."
- continue 1
- ;;
- esac
- # Make sure full path was entered.
- print "$ANS" |grep "^/" >$NULL 2>&- || {
- print "\n\tPlease enter a full pathname, starting at the root."
- continue 1
- }
- #
- # If ans is different from prompt unset flags, cuz user made a change.
- [ "$ANS" = "$BASE_PMT" ] || {
- unset OVERWRITE_OK OVER_FLAG BASE_FLAG BASE_MSG ;}
- #
- # If answer is a link, check that it points to a valid directory.
- [ -h $ANS ] && { # If answer is a link make sure it's valid.
- if [ -d $ANS ] ; then
- REAL_BASE=`cd $ANS 2>&- ; echo pwd | csh -fs 2>&-`
- print "${MSG}NOTE: $ANS is a symbolic link to: $REAL_BASE \c"
- # Next line disabled V10.2ph2d. to stop switching to real dir.
- # ANS=$REAL_BASE # This line switches the action of the script.
- sleep 3
- else
- print "${ERR}${ANS} does NOT point to a real directory." >&2
- continue # Directory was bogus, continue.
- fi
- }
- #
- # Passed the easy tests, set the var & leave.
- BASE_PMT=$ANS
- return 0
- done # end question loop.
- } # End Ask_base_dir
- Ask_install_type() # Ask the install type question and set defaults accordingly.
- { # RKB Wed Apr 7 11:25 1993
- # RKB rewrite: Aug 6 14:07 1993 V10.1p2 submenu to main screen.
- # RKB updtd: Apr 20 12:16 94 V103P4B no default reset; ck interdependencies.
- # RKB Jul 22 00:10 98 V150P07 Add dependency ck for UGFT_PMT.
- # RKB Sep 23 17:25 99 V160P18 Partial re-write for license-only install type.
- # RKB Nov 2 11:34 99 V160P20 Add License Server install type.
- # RKB Jan 12 07 NX5P24 Rm license server only option.
- while true ; do # question loop.
- print "${MSG}1) Load files AND configure system.
- \r\t2) Load files only. Do NOT configure system.
- \r\t3) Configure only. Do NOT load any files. "
- # Now ask the question.
- print "${QUE}Enter type of UG installation to perform: [1] \c"
- read ANS
- case ${ANS:=1} in
- 1) INS_TYPE="load+configure"
- # Re-store these to last value or default, if not set.
- [ "$SRC_PMT" = "n/a" ] && SRC_PMT=$SRC_PMT_OLD
- [ "$SRC_PMT" = "n/a" ] && SRC_PMT=$SRC_PMT_DEF
- [ "$SRC_FLAG" ] && unset SRC_FLAG SRC_MSG SOURCE
- #
- [ "$BASE_PMT" = "n/a" ] && BASE_PMT=$BASE_PMT_OLD
- [ "$BASE_PMT" = "n/a" ] && BASE_PMT=$BASE_PMT_DEF
- [ "$BASE_FLAG" ] && unset BASE_FLAG BASE_MSG BASE
- #
- [ "$MOD_PMT" = "n/a" ] && MOD_PMT=$MOD_PMT_OLD
- [ "$MOD_PMT" = "n/a" ] && MOD_PMT=$MOD_PMT_DEF
- [ "$MOD_FLAG" ] && unset MOD_FLAG MOD_MSG MODIFY_OK
- #
- [ "$UGFT_PMT" = "n/a" ] && UGFT_PMT=$UGFT_PMT_OLD # V150P03
- [ "$UGFT_PMT" = "n/a" ] && UGFT_PMT=$UGFT_PMT_DEF # V150P03
- [ "$UGFT_FLAG" ] && unset UGFT_FLAG UGFT_MSG UGF_TYPE # V150P03
- #
- break
- ;;
- 2) INS_TYPE="load_only"
- # Force these to n/a & unset err flags.
- MOD_PMT_OLD=$MOD_PMT # Save the old value.
- MOD_PMT=n/a ; unset MOD_FLAG MOD_MSG
- #
- UGFT_PMT_OLD=$UGFT_PMT # Save the old value. # V150P03
- UGFT_PMT=n/a ; unset UGFT_FLAG UGFT_MSG # V150P03
- #
- UGFS_PMT_OLD=$UGFS_PMT # Save the old value. # V150P03
- UGFS_PMT=n/a ; unset UGFS_FLAG UGFS_MSG # V150P03
- #
- UGFF_PMT_OLD=$UGFF_PMT # Save the old value. # V150P03
- UGFF_PMT=n/a ; unset UGFF_FLAG UGFF_MSG # V150P03
- #
- # Re-store these prompts if necessary
- [ "$BASE_PMT" = "n/a" ] && BASE_PMT=$BASE_PMT_OLD
- [ "$BASE_PMT" = "n/a" ] && BASE_PMT=$BASE_PMT_DEF
- [ "$BASE_FLAG" ] && unset BASE_FLAG BASE_MSG BASE
- #
- [ "$SRC_PMT" = "n/a" ] && SRC_PMT=$SRC_PMT_OLD
- [ "$SRC_PMT" = "n/a" ] && SRC_PMT=$SRC_PMT_DEF
- [ "$SRC_FLAG" ] && unset SRC_FLAG SRC_MSG SOURCE
- break
- ;;
- 3) INS_TYPE="configure_only"
- # Re-store these to last value or default, if not set.
- #
- [ "$BASE_PMT" = "n/a" ] && BASE_PMT=$BASE_PMT_OLD
- [ "$BASE_PMT" = "n/a" ] && BASE_PMT=$BASE_PMT_DEF
- [ "$BASE_FLAG" ] && unset BASE_FLAG BASE_MSG BASE
- #
- [ "$MOD_PMT" = "n/a" ] && MOD_PMT=$MOD_PMT_OLD
- [ "$MOD_PMT" = "n/a" ] && MOD_PMT=$MOD_PMT_DEF
- [ "$MOD_FLAG" ] && unset MOD_FLAG MOD_MSG MODIFY_OK
- #
- [ "$UGFT_PMT" = "n/a" ] && UGFT_PMT=$UGFT_PMT_OLD # V150P03
- [ "$UGFT_PMT" = "n/a" ] && UGFT_PMT=$UGFT_PMT_DEF # V150P03
- [ "$UGFT_FLAG" ] && unset UGFT_FLAG UGFT_MSG UGF_TYPE # V150P03
- #
- # Set this to n/a.
- SRC_PMT_OLD=$SRC_PMT # Save the old value.
- SRC_PMT="n/a" # No src on conf-only.
- unset SRC_FLAG SRC_MSG SOURCE # unset err & msg.
- break
- ;;
- h|he|hel|help|H|HE|HEL|HELP|"?") Help_install Ask_install_type ;;
- !) print "Use ^d to return to $SCRIPTNAME" ; $SHELL ;;
- q|qu|qui|quit|Q|QU|QUI|QUIT) return 1 ;;
- esac
- done # end question loop
- #
- # Now restore UGFF_PMT & UGFS_PMT but ONLY IF appropriate for on UGFT_PMT.
- case $UGFT_PMT in # If UGFT_PMT is n/a then we do nothing. # V150P07
- server)
- [ "$UGFF_PMT" = "n/a" ] && UGFF_PMT=$UGFF_PMT_OLD # V150P03
- [ "$UGFF_PMT" = "n/a" ] && UGFF_PMT=$UGFF_PMT_DEF # V150P03
- [ "$UGFF_FLAG" ] && unset UGFF_FLAG UGFF_MSG UGF_FILE # V150P03
- ;;
- client)
- [ "$UGFS_PMT" = "n/a" ] && UGFS_PMT=$UGFS_PMT_OLD # V150P03
- [ "$UGFS_PMT" = "n/a" ] && UGFS_PMT=$UGFS_PMT_DEF # V150P03
- [ "$UGFS_FLAG" ] && unset UGFS_FLAG UGFS_MSG UGF_SERVERS # V150P03
- ;;
- both)
- [ "$UGFF_PMT" = "n/a" ] && UGFF_PMT=$UGFF_PMT_OLD # V150P03
- [ "$UGFF_PMT" = "n/a" ] && UGFF_PMT=$UGFF_PMT_DEF # V150P03
- [ "$UGFF_FLAG" ] && unset UGFF_FLAG UGFF_MSG UGF_FILE # V150P03
- #
- [ "$UGFS_PMT" = "n/a" ] && UGFS_PMT=$UGFS_PMT_OLD # V150P03
- [ "$UGFS_PMT" = "n/a" ] && UGFS_PMT=$UGFS_PMT_DEF # V150P03
- [ "$UGFS_FLAG" ] && unset UGFS_FLAG UGFS_MSG UGF_SERVERS # V150P03
- ;;
- esac
- return 0
- } # End Ask_install_type.
- Ask_main_screen() # Ask and process all the questions on screen2.
- { # RKB Jul 7 22:05 93 NEW for V10.1
- # RKB Sep 24 15:54 93 Merge in old Check_dependencies function.
- # RKB Apr 20 13:25 94 V103P4B add logic to save old prompts.
- # RKB Oct 30 01:00 95 V110P13 Added more interdependency logic.
- # RKB May 21 16:45 98 V150P03 Added logic for UGFLEXlm.
- # RKB Feb 20 08 NX6P19 Chg to allow standalone license file or server names.
- #
- # Save the old answers
- SRC_PMT_OLD=$SRC_PMT # Save the old source dir prompt.
- BASE_PMT_OLD=$BASE_PMT # Save the old base dir prompt.
- MOD_PMT_OLD=$MOD_PMT # Save the old Mod O.K. prompt.
- UGFT_PMT_OLD=$UGFT_PMT # Save the old UGF licensing Type prompt.
- UGFS_PMT_OLD=$UGFS_PMT # Save the old UGF licensing Servers prompt.
- UGFF_PMT_OLD=$UGFF_PMT # Save the old UGF licensing File prompt.
- #
- while true ; do # Ask_main_screen question loop.
- Display_main_screen # Display the screen.
- # Ask the question IF we're not using the -f or -d switch.
- if [ "$SKIP_MAIN_QUE" ] ; then
- CHOICES=continue
- else
- print "${QUE}Enter item(s) to query or change: [continue] \c"
- read CHOICES ; : ${CHOICES:=continue}
- # Sort choices in menu order to lessen interdependencies.
- CHOICES=`echo $CHOICES | tr "," " " | tr " " "\012" | sort -n -t:`
- fi
- # Parse thru the choices.
- for CHOICE in $CHOICES ; do
- case ${CHOICE} in
- q|qu|qui|quit|Q|QU|QUI|QUIT) exit 0 ;;
- "?"|h|he|hel|help|H|HE|HEL|HELP) Help_install Ask_main_screen ;;
- !) print "Use ^d to return to $SCRIPTNAME" ; $SHELL ; continue ;;
- 1) Ask_install_type ;;
- 2) Ask_source ;;
- 3) Ask_base_dir ;;
- 4) Ask_modify_ok ;;
- 5) Ask_ugs_servers ;;
- c*) unset SKIP_MAIN_QUE # Can only skip it the first time thru.
- return 0
- ;;
- esac
- #
- # Now check and handle interdependencies each time thru for loop.
- #
- done # End CHOICES for loop.
- done # End Screen2 question loop
- unset SKIP_MAIN_QUE # Can only skip it the first time thru.
- } # End Ask_main_screen.
- Ask_modify_ok() # Ask the installer if is O.K. to modify the system files.
- { # RKB Jun 29 13:04 93
- # RKB Nov 1 13:59 94 rm ANS ck, that compared old/new ans for MOD_PMT.
- # RKB Apr 15 23:20 02 V190P16 Take out 'tr' for MOD_PMT - HPUX 11i bug.
- [ "$MOD_PMT" = "n/a" ] && return 0
- unset MODIFY_OK MOD_MSG MOD_FLAG
- while true ; do # Ask modify ok question loop.
- $VECHO "${MSG}System file(s) must be modified to run Unigraphics.
- \r\tOriginals will be saved in: $UGS_TMP with the extension: '$$'"
- $VECHO "\n\tNOTE: If you answer 'no' to this prompt, this node will NOT
- \r\tbe configured to run $PRODNAME or the UGFLEXlm daemon processes."
- print "${QUE}O.K. to modify system files: [$MOD_PMT] ? \c"
- read MODIFY_SYSTEM_FILES_OK
- ANS=$MODIFY_SYSTEM_FILES_OK
- [ "${ANS:=$MOD_PMT}" = $MOD_PMT ] || unset MOD_MSG MOD_FLAG
- case ${ANS:=$MOD_PMT} in
- !) print "Use ^d to return to $SCRIPTNAME" ; $SHELL ; continue ;;
- h|he|hel|help|H|HE|HEL|HELP|"?") Help_install Ask_modify_ok ; continue ;;
- q|qu|qui|quit|Q|QU|QUI|QUIT) return 1 ;;
- y*|Y*) MOD_PMT=yes ; break ;;
- n*|N*) MOD_PMT=no ; break ;;
- esac
- done
- [ -d $UGS_TMP ] || mkdir -p $UGS_TMP
- return 0
- } # End of Ask_modify_ok.
- Ask_source() # Ask where to get the files from for loading
- { # RKB Apr 14 11:50:48 1993 V10
- # RKB updtd: Sep 16 23:20 1993 streamlining & cosmetics. V10.1p3h
- [ "$SRC_PMT" = "n/a" ] && return 1
- unset SOURCE SRC_MSG SRC_FLAG
- while true ; do # Do this loop til you get a good source directory.
- print "${QUE}Enter the $PRODNAME $NX_VER source directory [$SRC_PMT]: \c"
- read ANS
- case ${ANS:=$SRC_PMT} in
- h|he|hel|help|H|HE|HEL|HELP|"?") Help_install Ask_source ;;
- !) echo Use ^d to return to $SCRIPTNAME ; $SHELL ;;
- q|qu|qui|quit|Q|QU|QUI|QUIT) return 1 ;;
- ".") SRC_PMT=`pwd` ; return 0 ;; # Wants to load from pwd.
- "..") SRC_PMT=`cd .. ; pwd` ; return 0 ;; # load from parent.
- *) # Now do a little massaging and checking of the answer.
- # If ANS is NOT a remote tape. Make absolute path if necessary.
- echo $ANS | grep ":" >$NULL || {
- echo $ANS | grep "^/" >$NULL 2>&- || \
- ANS=`pwd`/$ANS
- } # Make absolute path from the pwd.
- SRC_PMT=$ANS
- return 0
- ;;
- esac
- done
- } # End Ask_source
- Ask_source2() # Ask for a second source directory for loading files.
- { # RKB Jun 23 04 NX3P18 First iteration. Taken from original Ask_source.
- # RKB Jul 29 04 NX3P20 Add logic for SRC_PMT2 for env or ans file.
- # RKB Aug 30 04 NX3P21a Add check for an "." or ".." entered.
- #
- while true ; do # Do this loop til you get a good source directory.
- case $1 in
- -initial*) # We are on the first pass so ask for source2 in advance.
- : ${SRC_PMT2:=$SOURCE} # SRC_PMT2 set in Set_main_defaults.
- unset SOURCE2
- print "\n\tYou may enter an additional source location now, such
- \r\tas a second CD reader or another disk or NFS location.
- \n\tYou may also reuse the current source location. If so, you
- \r\twill later be prompted to insert the next CD."
- print "${QUE}Enter a new source for remaining kits or reuse the current
- \r\tdirectory [${SRC_PMT2}]: \c"
- ;;
- -next*) # We weren't on FIRST_PASS so ask a different question.
- # Calculate a reasonable source prompt.
- N=${SOURCE##${SOURCE%[0-9]}} # Get the last number of the SOURCE dir.
- : ${N:=1} ; ((N+=1)) # Make sure its at least 1 then bump it.
- SRC_PMT2=${SOURCE%[0-9]}$N # Construct a new source prompt.
- print "${QUE}Enter new source directory or enter CR when the next
- \r\tCD is ready [${SRC_PMT2}]: \c"
- ;;
- esac
- # We've displayed the appropriate prompt now check the answer.
- read ANS
- case ${ANS:=$SRC_PMT2} in
- h|he|hel|help|H|HE|HEL|HELP|"?") Help_install Ask_source2 ;;
- !) print "Use ^d to return to $SCRIPTNAME" ; $SHELL ;;
- q|qu|qui|quit|Q|QU|QUI|QUIT) return 1 ;;
- "."|"..") print "${MSG}Please enter an absolute path" ; continue ;;
- *) # Now do a little massaging and checking of the answer.
- # If ANS is NOT a remote tape. Make absolute path if necessary.
- echo $ANS | grep ":" >$NULL || {
- echo $ANS | grep "^/" >$NULL 2>&- || \
- ANS=`pwd`/$ANS
- } # Make absolute path from the pwd.
- # Only if answer is different from prompt do we have a new source.
- [ "$ANS" = "$SOURCE" ] || {
- SOURCE2=$ANS
- }
- SRC_PMT2=$ANS
- return 0
- ;;
- esac
- done
- #
- } # End Ask_source2
- Ask_ugf_file() # Ask for a valid path to the UGFLEXlm license file.
- { # RKB Mar 4 23:40 98 V150P01 Initial version from Ask_acs_dat_file.
- #
- [ "$UGFF_PMT" = "n/a" ] && return 1 # Ck if we should be here.
- # Set a default if not already set.
- : ${UGFF_PMT:=${UGII_BASE_DIR:=${BASE_DIR}/ugflexlm/ugnx4.lic}}
- # Initialize flags and message vars.
- unset UGF_FILE UGFF_FLAG UGFF_MSG
- # Now ask for the license file name.
- while true ; do # Question loop for pathname to dat file.
- print "${QUE}Enter filename of the UGNX FLEXlm license
- \r\tfile [${UGFF_PMT}]: \c"
- read ANS
- case ${ANS:=$UGFF_PMT} in
- h|he|hel|help|H|HE|HEL|HELP|"?") Help_install Ask_ugf_file ;;
- !) print "Use ^d to return to $SCRIPTNAME" ; $SHELL ;;
- q|qu|qui|quit|Q|QU|QUI|QUIT) return 1 ;;
- /*) UGFF_PMT=$ANS ; return 0 ;;
- [!/]*) UGFF_PMT=`pwd`/$ANS ; return 0 ;;
- esac
- done # End license file question loop.
- } # Ask_ugf_file.
- Ask_ugs_servers() # Ask the nodename of the acs master server.
- { # RKB Apr 29 1998 Initial version. Taken from old Ask_acs_master.
- # RKB Feb 20 08 NX6P19 Chg to allow standalone license file or server names.
- # RKB Mar 24 08 NX6P21 More chngs for Standalone license.
- # RKB Mar 24 08 NX6P21 Renamed from Ask_ugf_servers to Ask_ugs_servers.
- #
- [ "$UGFS_PMT" = "n/a" ] && return 1 # Ck if we should be here.
- # Initialize flags and message vars.
- unset UGF_SERVERS UGFS_FLAG UGFS_MSG
- # Now ask for the server names.
- print "${MSG}Enter server name(s) that supply licenses TO this node: $HOST
- \r\tOR enter a full path to a standalone license file."
- #
- while true ; do # @Nodename question loop.
- print "${QUE}Enter server name(s) OR a license
- \r\tfile.[${UGFS_PMT[*]}]: \c"
- read ANS
- case ${ANS:=${UGFS_PMT[*]}} in
- q|qu|qui|quit|Q|QU|QUI|QUIT) return 1 ;;
- h|he|hel|help|H|HE|HEL|HELP|"?") Help_install Ask_ugs_servers ;;
- !) print "Use ^d to return to $SCRIPTNAME" ; $SHELL ;;
- "."*|".."*) print "${MSG}Please enter an absolute path" ; continue ;;
- /*) UGFS_PMT=$ANS ; return 0 # Ans checked in Check_license_file.
- ;;
- */*) # If it has a slash in it, it must be a filename.
- echo $ANS | grep "^/" >$NULL 2>&- || UGFS_PMT=`pwd`/$ANS # Make abs.
- return 0 # Ans checked in Check_license_file.
- ;;
- *) # Must be a nodename. Convert to proper format, using Nodename_filter.
- UGFS_PMT=$( print " $ANS" | Nodename_filter )
- return 0
- ;;
- esac
- done
- } # End of Ask_ugs_servers
- Change_prod_dir() # Change the directory & file system for individual products.
- { # RKB Tue Jan 29 15:51:01 PST 1991
- # Requires two args. The PRODUCT name and new directory for the PRODUCT.
- PRODUCT=$1 ; : ${PRODUCT:?} # Required arg internal check.
- NEW_DIR=$2 ; : ${NEW_DIR:?} # Required arg internal check.
- PROD_SIZE=`eval echo \\${${PRODUCT}[3]}`
- # Get file system name & index number for new directory.
- NEW_FS=`Get_fs_info -mnt $NEW_DIR` || return 1
- NEW_INDEX=`Get_fsindex $NEW_FS`
- OLD_DIR=`eval echo \\${${PRODUCT}[4]}` # Get old directory for product.
- OLD_FS=`Get_fs_info -mnt $OLD_DIR` # Get old file system name.
- OLD_INDEX=`Get_fsindex $OLD_FS` # Get old index into FS_NAME array.
- # Move the kit space from old to new file system.
- let FS_FREE[$NEW_INDEX]=${FS_FREE[$NEW_INDEX]}-$PROD_SIZE
- let FS_FREE[$OLD_INDEX]=${FS_FREE[$OLD_INDEX]}+$PROD_SIZE
- let FS_NEEDED[$NEW_INDEX]=${FS_NEEDED[$NEW_INDEX]}+$PROD_SIZE
- let FS_NEEDED[$OLD_INDEX]=${FS_NEEDED[$OLD_INDEX]}-$PROD_SIZE
- eval `echo ${PRODUCT}[4]=\\$NEW_DIR` # Switch PRODUCT[4] to new directory.
- eval `echo ${PRODUCT}[5]=\\$NEW_INDEX` # Switch PRODUCT[5] to new index.
- } # End of Change_prod_dir.
- Check_base() # Ck the answer for the Unigraphics base dir on config_only.
- { # RKB Apr 16 14:09 93
- # RKB updtd: Aug 4 23:54 93 V101p2 change checks when doing config only.
- # RKB updtd: Aug 11 16:14 93 V101p2 more changes for config only.
- # RKB updtd: Oct 26 08:53 93 V101p1f rm ck for ugraf for SGI.
- # RKB updtd: Nov 9 17:13 93 V102p2d change to allow use of link for base dir.
- # RKB updtd: Nov 10 19:52 93 V102p2d further changes for automounter support.
- # RKB updtd: Feb 17 17:12 94 V103P2B rm ck for .ugii_env on config_only.
- # RKB updtd: Mar 17 01:08 94 V103P3B add message for occupied base dir.
- # RKB updtd: Apr 26 16:35 94 V103P4D add chmod 555 for created dirs.
- # RKB updtd: Mar 18 14:56 98 V150P01 chng to ck for ugflexlm files not acs.
- # RKB updtd: Nov 3 15:00 99 V160P20 add ck for license_server install type.
- # RKB updtd: Aug 28 06 NX050P16 Changes for new universal flexlm i.e. ugslmd.
- #
- [ "$BASE_PMT" = "n/a" ] && return 0 # No point in cking if n/a.
- [ "$BASE_DIR" ] && return 0 # If already set, no need to check.
- print "${MSG}Checking base directory ${BASE_PMT} ... \c"
- unset BASE_DIR BASE_FLAG BASE_MSG # Init these vars to be safe.
- #
- # Now check the answer.
- ( cd $BASE_PMT >$NULL 2>&- ; ) # Do a cd just in case its automounted.
- # If answer is a link, check that it points to a valid directory.
- [ -h $BASE_PMT ] && { # If answer is a link make sure it's valid.
- if [ -d $BASE_PMT ] ; then
- REAL_BASE=`cd $BASE_PMT 2>&- ; echo pwd | csh -fs 2>&-`
- print "${NOTE}$BASE_PMT is a symbolic link to: $REAL_BASE "
- # Next line commented out for V10.2ph2d to allow use of links for base.
- # BASE_PMT=$REAL_BASE # This line switches the action of the script.
- else
- print "${ERR}${BASE_PMT} does NOT point to a real directory." >&2
- BASE_MSG="${BASE_PMT} does NOT point to a real directory."
- BASE_FLAG=$REENTER
- return 1 # Directory was bogus, return.
- fi
- }
- #
- # If /usr/ugs$VNUM is a mount point we'd have trouble renaming it.
- [ $BASE_PMT != /usr/ugs$VNUM -a `Get_fs_info -mnt /usr/ugs$VNUM` = /usr/ugs$VNUM ] && {
- print "${ERR}/usr/ugs$VNUM is a mount point, it cannot be moved or removed.
- \r\tumount /usr/ugs$VNUM or use /usr/ugs$VNUM for base dir"
- BASE_MSG="/usr/ugs$VNUM is a mount point, cannot be moved or removed."
- BASE_FLAG=$REENTER
- sleep 3 ; return 1
- } # Must use /usr/ugs$VNUM if it's a mount point.
- #
- # Now do checks based on the type of installation.
- case ${INS_TYPE} in
- load+c*|load_o*|license_serv*) # Checks if doing a load op.
- # Make sure we don't try to load on top of ourselves.
- # Make sure REAL_BASE is set for next comparison.
- : ${REAL_BASE:=$BASE_PMT}
- [ "$BASE_PMT" = "$SOURCE" -o "$REAL_BASE" = "$SOURCE" ] && {
- print "${ERR}base and source can't be the same" >&2
- BASE_MSG="base and source can't be the same"
- BASE_FLAG=$REENTER
- sleep 3 ; return 1
- }
- #
- # If BASE_PMT is NFS mounted we need root access for load operations.
- Get_fs_info -nfs $BASE_PMT && { # True if BASE_PMT is NFS mounted.
- BASE_MOUNT=`Get_fs_info -mnt $BASE_PMT`
- print "${NOTE}$BASE_PMT is NFS mounted on: $BASE_MOUNT"
- Check_root_access "$BASE_MOUNT" || { # No root access.
- NFS_PATH=`Get_fs_info -fsname $BASE_PMT` # Get NFS pathname.
- print "${WARN}$BASE_PMT is NFS mounted without root access.
- \r\tThis node: $HOST does not have root access in: $NFS_PATH
- \n\tExport $NFS_PATH with root access (if available) OR,
- \r\tUse the 'load & configure option' on the NFS server first then
- \r\tuse the 'configure only' option on NFS client(s). " >&2
- BASE_MSG="NFS mounted without root access: $BASE_PMT"
- BASE_FLAG=$REENTER
- sleep 3 ; return 1
- } # Root access check.
- } # NFS check.
- # Check if BASE_PMT is an empty dir and supports long filenames.
- if [ -d $BASE_PMT ] ; then
- [ `ls -a $BASE_PMT | wc -w` = 2 ] || {
- BASE_EMPTY=no
- print "\n${NOTE}$BASE_PMT is NOT empty, this installation
- \r\twill OVERWRITE existing UG files in that directory."
- sleep 3
- }
- Check_longnames $BASE_PMT || {
- BASE_MSG="$BASE_PMT does not support long filenames."
- BASE_FLAG=$REENTER
- return 1
- }
- else # there was no directory so create it.
- $VECHO "${MSG}Creating directory ${BASE_PMT} ..."
- mkdir -p $BASE_PMT || return 1
- chmod 555 $BASE_PMT >$NULL 2>&-
- BASE_EMPTY=yes
- Check_longnames $BASE_PMT || {
- BASE_MSG="$BASE_PMT does not support long filenames."
- BASE_FLAG=$REENTER
- rmdir $BASE_PMT 2>&-
- return 1
- }
- fi
- ;;
- config*) # Checks if doing a config_only op.
- # Check if NFS, for info only.
- Get_fs_info -nfs $BASE_PMT && {
- print "${NOTE}$BASE_PMT is NFS mounted."
- }
- # Make sure it already exists on config_only.
- [ -d $BASE_PMT ] || {
- print "${WARN}the directory $BASE_PMT does not exist
- \r\tcannot use 'configure_only' option, with this directory." >&2
- BASE_MSG="$BASE_PMT does not exist. cannot use 'configure only'."
- BASE_FLAG=$REENTER
- sleep 3 ; return 1
- }
- # Now check it has some basic files.
- for FILENAME in ugflexlm/lmgrd ugflexlm/ugslmd ugii/ugii
- do
- [ -f $BASE_PMT/$FILENAME ] || {
- print "${WARN}not a UG base directory, required files are missing.
- \r\tcannot use 'configure_only' option." >&2
- BASE_MSG="$BASE_PMT is missing files, cannot 'configure_only'"
- BASE_FLAG=$REENTER
- sleep 3 ; return 1
- }
- done
- ;;
- esac
- #
- # If we got this far, should be a good directory.
- # Set the vars and return.
- BASE=$BASE_PMT # Set BASE used by Init_product_arrays.
- BASE_DIR=$BASE_PMT # Set BASE_DIR to BASE_PMT.
- ROOT_DIR=${BASE_DIR}/bin/ # Set ROOT_DIR for compatability.
- UGII_BASE_DIR_ANSWER=$BASE_PMT
- Log_var UGII_BASE_DIR_ANSWER "UG base directory answer."
- return 0
- } # End of Check_base
- Check_kit_dependencies() # Define & check kit selections dependent on arg1.
- { # RKB Oct 15 97 Initial version written to handle UGROUTING.
- # RKB Nov 17 97 Change to use CR to continue method.
- # RKB Aug 19 98 V150P09 Add check for UGOPENPP & partial re-write.
- # RKB Tue 2 99 V160P20 Add check for UGHARNESS.
- # RKB 05 May 03 V020P17 Rm kit dependencies for UGROUTING.
- # RKB Feb 17 04 NX3P09 Add check for NXTOOLING_COMMON
- # RKB Mar 18 04 NX3P11 Change NXTOOLING_COMMON to TOOLING_BASE.
- # RKB Jun 17 04 NX3P18 Chng FSETS logic in prep for multi CD installs.
- # RKB Aug 30 05 NX4P20 Add check for NXJRE.
- # RKB Sep 29 05 NX4P22 Fix missing "|" in DEPENDANTS definition for NXJRE.
- # RKB May 15 06 NX5P08 Add CATIAV5,DXFDWG,IGES,STEP203UG,STEP214UG.
- # RKB Dec 11 07 NX6P16 Add NXASSEMBLY.
- #
- : ${FSETS:?} # Required variable check. List of currently selected kits.
- #
- unset DEPENDANTS_FLAG
- #
- set -f # Turn off filename expansion.
- for PARENT in UGOPEN TOOLING_BASE NXJRE
- do
- # If parent kit IS already in FSETS then we dont care about the dependants.
- echo $FSETS | tr ' ' '\012' | egrep "${PARENT}" >$NULL && continue 1
- #
- # The parent kit is NOT in FSETS, so define the dependants to check.
- # For multiple dependants, define the var like an egrep 'OR' expression.
- case $PARENT in
- NXJRE)
- DEPENDANTS="
- UGOPEN|PSTUDIO|CATIAV5|DXFDWG|IGES|STEP203UG|STEP214UG|NXASSEMBLY" ;;
- UGOPEN) DEPENDANTS="UGOPENPP" ;;
- TOOLING_BASE) DEPENDANTS="MOLDWIZARD|PDIEWIZARD" ;;
- esac
- #
- # See if any of the dependants of $KIT are in FSETS. if so, it's a problem.
- #
- echo $FSETS | tr ' ' '\012' | egrep $DEPENDANTS >$NULL 2>$NULL && {
- # True if FSETS contained one or more of the dependants.
- print "${NOTE}The $PARENT kit must ALSO be selected with kit(s):"
- print "\r\t$DEPENDANTS" | sed 's!|!, !g'
- DEPENDANTS_FLAG=1
- }
- #
- done
- #
- set +f # Turn filename expansion back on.
- # Now see if there were any errors.
- [ "$DEPENDANTS_FLAG" ] && {
- print "\n*\tEnter CR after reading message. \c" ; read CR
- return 1
- }
- return 0 # There were no orphaned dependants so we are O.K.
- #
- } # End of Check_kit_dependencies.
- Check_hostname() # Short function to see if arg1 is a valid hostname.
- { # RKB written: Aug 5 22:17 1993 V10.1p2
- # RKB updtd: Oct 13 00:14 94 V104P09 switch to egrep & ck for $1 EOL.
- # RKB updtd: Apr 29 00:44 96 V111P12 Added logic for DNS check.
- # RKB updtd: Oct 26 05 NX4P24 Tweak nslookup grep pattern for Linux.
- #
- # Check local hosts file then YP hosts file.
- if egrep "[ , ]$1[ , ]|[ , ]$1$" /etc/hosts >$NULL 2>&- ; then
- return 0
- elif ypcat hosts 2>&- | egrep "[ , ]$1[ , ]|[ , ]$1$" >$NULL 2>&- ; then
- return 0
- elif [ -f /etc/resolv.conf ] && \
- nslookup $1 2>&1 | egrep "^Name:[ , ]*$1" >$NULL 2>&-
- then
- return 0
- else
- print "${ERR}could not find $1 in '/etc/hosts' or NIS or DNS.\c" >&2
- sleep 3 ; return 1
- fi
- } # End Check_hostname.
- Check_license_file() # Check the license file supplied by the user.
- { # RKB 21Feb08 NX6P19 Initial version taken from Check_license_servers.
- # RKB 24Mar08 NX6P21 More chngs for Standalone license.
- #
- # Preliminary checks & messages.
- [ "$UGFS_PMT" = "n/a" ] && return 0 # No point in cking if n/a.
- [ "$UGF_SERVERS" ] && return 0 # Already checked & set, don't check again.
- #
- : ${BASE_DIR:?} # Required variable check.
- #
- # Initialize the flags and message variables.
- unset UGFS_FLAG UGFS_MSG
- unset UGF_LOCAL_SERVER
- #
- print "${MSG}Checking user supplied license file... \c"
- #
- # Checked for mixed server-filename entry.
- [[ "$UGFS_PMT" = *"/"* ]] && [[ "$UGFS_PMT" = *"@"* ]] && {
- UGFS_MSG="Mixed filename and server name(s) not supported."
- print "${ERR}$UGFS_MSG
- \r\tEnter a full path to a filename OR server name(s).
- \n\tEntering both server(s) and a filename is not
- \r\tsupported by the install."
- UGFS_FLAG=$REENTER # Now we have to force user to re-enter.
- sleep 3 ; return 1
- }
- # Now check if we can find the file.
- [ -f "$UGFS_PMT" ] || { # Nope couldn't find the file.
- UGFS_MSG="The license file entered was not found."
- print "${ERR}$UGFS_MSG
- \r\tEnter a full path to a NX standalone license file.
- \n\tThe environment variable UGS_LICENSE_SERVER must be set to
- \r\ta license filename or valid servers(s) before running NX."
- UGFS_FLAG=$REENTER # Now we have to force user to re-enter.
- sleep 3 ; return 1
- }
- #
- # Check the filename is NOT a server type of license.
- grep "^SERVER" $UGFS_PMT >$NULL 2>&- && {
- UGFS_MSG="The specified license file is a server license file."
- print "${ERR}$UGFS_MSG
- \n\tThe specified license file can ONLY be used with a license
- \r\tserver installation. Install the ugs_licensing product."
- UGFS_FLAG=$REENTER # Now we have to force user to re-enter.
- sleep 3 ; return 1
- }
- # Looks like we passed ALL the tests, so set the permanent variables.
- FLEX_LIC_SERVERS=$UGFS_PMT # Used in answer file.
- Log_var FLEX_LIC_SERVERS "NX license file" # Log the answer.
- # As of NX6P21 we force the filename to a standard name & location so
- # that support folks can always find it and customer doesn't delete it.
- # UGS_LICENSE_SERVER=$UGFS_PMT # This is what gets set in the environment.
- # NX6P21 hard code these for now.
- UGS_LICENSE_SERVER=$BASE_DIR/ugflexlm/nx_license.lic # hard coded for now.
- UGF_SERVERS=$BASE_DIR/ugflexlm/nx_license.lic # hard coded for now.
- #
- return 0
- #
- } # End Check_license_file
- Check_license_servers() # Check the server names supplied by the user.
- { # RKB 29Apr98 Initial version taken from Check_acs_master.
- # RKB 06May98 Add for loop for multiple nodes, and all check logic.
- # RKB 13Jul98 V150P06 Add ck for UGF_LOCAL_SERVER & client only.
- # RKB Aug 28 06 NX5P16 Changes for new universal flexlm i.e. ugslmd.
- # RKB Aug 28 06 NX5P16 Allow install to continue of servers fail validation.
- # RKB Dec 11 06 NX5P22 Tmp tweak to allow local server on client-only install.
- # RKB Feb 20 08 NX6P19 Chg to allow standalone license file or server names.
- # RKB Feb 21 08 NX6P19 Renamed Check_ugf_servers to Check_license_servers.
- #
- # Preliminary checks & messages.
- [ "$UGFS_PMT" = "n/a" ] && return 0 # No point in cking if n/a.
- [ "$UGF_SERVERS" ] && return 0 # Already checked & set, don't check again.
- #
- # Initialize the flags and message variables.
- unset UGFS_FLAG UGFS_MSG BAD_NAMES BAD_PINGS BAD_TESTS SERVERS
- unset UGF_LOCAL_SERVER
- #
- print "${MSG}Checking user supplied server name(s) ... \c"
- #
- # Test user supplied nodenames and see if any are local..
- # Check each node in UGFS_PMT. First convert the commas and
- # semi-colons into spaces so they can be passed as separate args.
- #
- Test_ugf_nodenames $(echo $UGFS_PMT | sed -e 's![;|:|,]! !g')
- #
- # Final check for ANY error flags.
- [ -n "$BAD_NAMES$BAD_PINGS$BAD_TESTS" ] && {
- print "${WARN}one or more servers failed validation tests"
- sleep 2
- }
- # Now check if there were ANY good nodes.
- [ "$GOOD_SERVERS" -lt 1 ] && { # Nope there were NO good ones.
- UGFS_MSG="no useable servers were entered. all failed validation tests."
- # print "${ERR}$UGFS_MSG \c"
- print "${ERR}$UGFS_MSG
- \r\tThe servers entered were not valid or not up and running.
- \r\tThe environment variable UGS_LICENSE_SERVER must be set to
- \r\tvalid server(s) OR a license filename before running NX."
- # Severity of check downgraded to warning. Allow install to continue NX5P16.
- # UGFS_FLAG=$REENTER # Now we have to force user to re-enter.
- # sleep 3 ; return 1
- sleep 3
- }
- #
- # Check if listed local host as a server but designated it client only.
- # Cant serve licenses unless configured as a license server ALSO.
- [ "$UGF_LOCAL_SERVER" = "TRUE" -a "$UGF_TYPE" = "client" ] && {
- # Disabled NX050P22 Just give a notice but allow continue.
- # UGFS_MSG="$HOST is designated client ONLY - it cannot serve licenses"
- # print "${ERR}$UGFS_MSG
- # \r\tchange UG Licensing option to BOTH - OR -
- # \r\tremove $HOST from list of license servers. \c"
- # UGFS_FLAG=$REENTER # Now we have to force user to re-enter.
- # sleep 3 ; return 1
- # Do quick ck if ugslmd is already running if so, we don't need a message.
- $PS_CMD | grep -v grep | grep ugslmd >$NULL 2>&- || {
- print "${WARN}$HOST is currently designated client ONLY.
- \r\tPlease be sure to:
- \r\tinstall licensing on this node with the ugslicensing install
- \r\t- OR -
- \r\tremove $HOST from the list of license servers. \c"
- sleep 6 # Just give the message and continue.
- }
- }
- #
- # Looks like we passed ALL the tests, so set the permanent variables.
- UGF_SERVERS="$UGFS_PMT" # Tested variable
- FLEX_LIC_SERVERS=$UGFS_PMT # Used in answer file.
- Log_var FLEX_LIC_SERVERS "UGS license servers" # Log the answer.
- UGS_LICENSE_SERVER=$UGF_SERVERS # This is what gets set in the environment.
- #
- return 0
- #
- } # End Check_license_servers
- Check_longnames() # Check that this system can support long filenames.
- { # RKB Fri Jul 13 15:05:41 PDT 1990
- TEST_FSYS=${1} ; : ${TEST_FSYS:?} # Internal check.
- TEST_FNAME="ugs_test9012345678901234567890123456789012345678901234567890"
- touch ${TEST_FSYS}/$TEST_FNAME 2>&-
- ACTUAL_FNAME=`ls -l ${TEST_FSYS}/ugs_test901234* 2>&- |$AWK_CMD '{print $NF}'`
- ACTUAL_FNAME=`basename $ACTUAL_FNAME`
- rm -f ${TEST_FSYS}/$TEST_FNAME 2>&-
- [ "$ACTUAL_FNAME" = $TEST_FNAME ] || { # Make sure they match.
- print "${ERR}This file system does not support long filenames
- \r\tFilename lengths greater than 14 characters is required for
- \r\tinstallation of $PRODNAME ${NX_VER}." >&2
- return 1
- }
- return 0 # We're ok, they matched.
- } # End of Check_longnames.
- Check_modify_ok() # Ck the answer for permission to modify system files.
- { # RKB Apr 28 18:58:39 1993
- # RKB Aug 4 23:43 1993 change to use yes/no case statement.
- # RKB Feb 26 15:16 2002 V190P12 Take out 'tr' for MOD_PMT - HPUX 11i bug.
- [ "$MOD_PMT" = "n/a" ] && return 0 # No point in cking if n/a.
- [ "$MODIFY_OK" ] && return 0 # If already set, no need to check.
- print "${MSG}Checking ok to modify system files ...\c"
- unset MODIFY_OK
- # Got the question answered now check the answer.
- case $MOD_PMT in
- Y*|y*) # User said yes.
- MODIFY_OK=yes # Nothing to ck, just set the var.
- ;;
- N*|n*) # user said no.
- MODIFY_OK=no
- print "${NOTE}This node will not be configured to run $PRODNAME \c" >&2
- sleep 2
- ;;
- esac
- unset MOD_FLAG MOD_MSG
- MODIFY_SYSTEM_FILES_OK=$MODIFY_OK
- Log_var MODIFY_SYSTEM_FILES_OK "O.K. to modify system files"
- # Passed the tests, and the var is set so leave.
- return 0
- } # End of Check_modify_ok
- Check_openfiles() # Check for files left open which prevents updates.
- { # RKB Sep 14 21:45:37 1992
- # RKB Updated: Sep 23 22:19:10 1992 ck FSETS & save backup before rm.
- # RKB updtd: Mar 18 14:56 98 V150P01 chng to ck for ugflexlm files not acs.
- # RKB Apr 15 23:20 02 V190P16 Take out 'tr' for OPEN_FILES_OK - HPUX 11i bug.
- # RKB Jun 17 04 NX3P18 Chng FSETS logic in prep for multi CD installs.
- # RKB Jun 17 04 NX3P18 Rm check for plot/ugiipqd.
- # RKB updtd: Aug 28 06 NX050P16 Changes for new universal flexlm i.e. ugslmd.
- #
- : ${BASE_DIR:?} # Required variable internal check.
- $VECHO "${MSG}Checking for open files ..."
- OLDPWD=`pwd` ; cd $BASE_DIR
- while true ; do # Outer control loop.
- unset OPEN_FILES
- for FILENAME in ugflexlm/lmgrd ugflexlm/ugslmd ; do
- [ -f "$FILENAME" ] || continue 1 # If file is not there, it's not open.
- KITNAME=`echo $FILENAME | cut -d/ -f1` # Get the kitname (directory).
- # Check if this kit is a selected kit.
- echo $FSETS | tr " " "\012" | grep -i "^${KITNAME}$" >$NULL || continue
- cp -p $FILENAME ${FILENAME}.$$ 2>&- # Save it first.
- if rm -f ${FILENAME} >$NULL 2>&- ; then # Now try to remove it.
- mv -f ${FILENAME}.$$ ${FILENAME} 2>&- # Could rm it, now restore it.
- else
- OPEN_FILES="$OPEN_FILES $FILENAME"
- rm -f ${FILENAME}.$$ 2>&-
- fi
- done
- [ "$OPEN_FILES" ] || return 0 # There weren't any, so we're done.
- #
- print "${ERR}These files are still open, and cannot be updated:\n" >&2
- echo $OPEN_FILES | tr " " "\012" | pr -ato8 -3 >&2
- [ "$Q_SWT" ] && {
- print "\n\tcannot continue in 'quiet' mode." >&2 ; exit 1 ;}
- while true ; do # Question loop.
- print "${MSG}Do you want to:
- \r\t1) Continue anyway, update manually, later.
- \r\t2) No. Do not continue. Return to previous question.
- \r\t!) Escape to the shell to close file(s).
- \r\tq) Quit $SCRIPTNAME
- \r\t?) Help"
- print "${QUE}Continue $SCRIPTNAME anyway [yes]: \c"
- read OPEN_FILES_OK
- case ${OPEN_FILES_OK:=yes} in
- y*|Y*|1) print "${MSG}The files listed MUST be updated manually
- \r\tbefore attempting to run $PRODNAME" ; return 0 ;;
- h*|"?") print "${MSG}The file(s) listed above could not be removed.
- \r\tThis script will NOT be able to correctly update the old file(s).
- \n\tThese files may have been opened by a 'cnode' or an NFS client.
- \r\tTerminate UGII background process on any remote node that may be
- \r\taccessing files in ${BASE_DIR}. Use 'ugs_reset -h'.
- \n\tAvailable options:
- \n\tContinue anyway, and update manually BEFORE running ${PRODNAME}.
- \n\tEscape to shell and shutdown the processes accessing the file(s).
- \n\tQuit $SCRIPTNAME and re-run after the files have been closed."
- continue 1 ;;
- !) echo Use ^d to return to $SCRIPTNAME ; $SHELL
- $VECHO "${MSG}Re-checking open files ..." ; continue 2 ;;
- n*|N*|2) return 1 ;;
- q*) return 1 ;;
- esac
- done # end OPEN_FILES_OK question loop.
- done # end control loop.
- } # End Check_openfiles
- Check_root_access() # Simple function to test full root access to a dir.
- { # RKB Wed Oct 2 22:02:10 PDT 1991
- # Requires 1 switch & 1 arg, or just 1 arg; the directory to check.
- case $1 in
- -cr*) # -cr switch says create the dir in arg 2.
- TARGET_DIR=$2 ; : ${TARGET_DIR:?} # Internal check.
- mkdir -p $TARGET_DIR 2>&- || return 1 ;;
- *) TARGET_DIR=$1 ; : ${TARGET_DIR:?} # Internal check. ;;
- esac
- OLDCWD=`pwd` ; cd $TARGET_DIR 2>&- || return 1
- touch ugs_testfile.$$ 2>&- || { rm -f ugs_testfile.$$ 2>&- ; return 1 ;}
- chgrp 100 ugs_testfile.$$ 2>&- || { rm -f ugs_testfile.$$ 2>&- ; return 1 ;}
- chown 100 ugs_testfile.$$ 2>&- || { rm -f ugs_testfile.$$ 2>&- ; return 1 ;}
- rm -f ugs_testfile.$$ 2>&- || return 1
- cd $OLDCWD
- return 0 # If we can do all these things we probably have access.
- } # End Check_root_access.
- Check_runpath() # Check path used to run this script. Cannot have pound sign.
- { # RKB May 08 97 V130P13 Temporary special workaround to trap '#' in path.
- #
- # 1 Required variable: SCRIPTDIR
- echo # Cosmetic newline.
- #
- echo ${SCRIPTDIR:?} | grep '#' >$NULL && {
- print "${ERR}a '#' symbol has been detected in the directory path containing
- \r\tthis script: $SCRIPTDIR/$SCRIPTNAME
- \n\tSome external programs invoked by this script CANNOT tolerate this
- \r\tspecial character, and MAY cause a failure later in the install.
- \n\tIf $SCRIPTDIR is a disk directory, rename the directory
- \r\tor create a symbolic link to it using another name.
- \n\tIf $SCRIPTDIR is a DVD/CDROM directory, remount the DVD/CDROM using
- \r\tanother mount point or create a symbolic link to it using another name.
- \r\te.g. mkdir /tmp/cdrom
- \r\t ln -s $SCRIPTDIR /tmp/cdrom "
- [ ${MACHINE} = "SunOS" ] && {
- print "\n\tNOTE: DVD/CDROM's mounted by the SunOS Volume Management Daemon
- \r\t(vold) may already contain a useable symbolic link.
- \r\te.g. /cdrom/cdrom0 "
- }
- echo # Cosmetic echo
- return 1 # Can't use this path.
- }
- return 0 # Passed the simple test.
- } # End Check_runpath.
- Check_space() # Check if there's enough free disk space to load.
- { # RKB Mon Feb 04 22:23:55 PST 1991
- # RKB Oct 1 00:53 93 Fixes to option 3 - reselect base dir.
- # RKB Nov 10 23:53 93 V10.2ph2d major changes to make menu return to Main.
- # RKB Mar 7 18:12 94 V103P2E do df cmd inside main loop instead of Resize_fs.
- # This function cycles thru the known filesystems to check free space.
- #
- print "\n\tChecking disk space, selections require $SPACE_REQUIRED_MB Mb ..."
- #
- # Loop thru the list useable filesystems, ck each one for space requirement.
- I=0 # Initialize the index.
- while [ ${I} -lt ${#FS_NAME[*]} ] ; do # Outer control loop.
- #
- # If we don't need any space on this filesystem then skip it.
- [ "${FS_NEEDED[$I]}" = 0 ] && { # True if no space needed.
- ((I+=1)) ; continue 1 # bump index, skip to next file system.
- }
- # Get the amount of free space on this filesystem in 1024 byte blks.
- FS_FREE[$I]=`$DF_CMD ${FS_NAME[$I]} | tail -1 \
- | $AWK_CMD '{printf"%d",$(NF-2)}'`
- #
- # Now check if we do have enough free space.
- if (( ${FS_FREE[$I]} >= ${FS_NEEDED[$I]} )) ; then
- # True if we had enough free space.
- ((I+=1)) ; continue 1 # Bump index, skip to next file system.
- else # Oh oh, we did NOT have enough free space.
- #
- # Put name of this filesystem into a simple var.
- DNAME=${FS_NAME[$I]}
- [ $DNAME = "/" ] && DNAME="/ (root)" # Change it for cosmetics.
- #
- [ "$Q_SWT" ] && { # This is fatal in quiet mode.
- print "${ERR}not enough space on filesystem '$DNAME' to load files.
- \r\tCannot continue in 'quiet' mode. " >&2 ; exit 1
- }
- # Now ask the user what they want to do.
- while true ; do # Inner question loop.
- print "${WARN}not enough space on filesystem '$DNAME' to load files.
- \n\tFree Kbytes required: ${FS_NEEDED[$I]}
- \r\tFree Kbytes available: ${FS_FREE[$I]}
- \n\tDo you want to:
- \r\t1) Continue anyway (Overwrite existing files)
- \r\t2) Return to product selection menu to re-select products or dirs.
- \r\t3) Return to main screen to select new base directory.
- ${QUE}Enter your selection: [1] \c"
- read ANS
- case ${ANS:=1} in
- 1) ((I+=1)) ; break 2 ;; # Continue the outer loop to next disk.
- 2) return 1 ;; # Go back to Select_products.
- 3) unset FSETS ; return 2 ;; # Go back to main screen.
- !)
- print "${MSG}Use ^d to return to $SCRIPTNAME"
- $SHELL
- print "${MSG}Re-checking disk space ... "
- I=0 ; continue 2 # Reset index, retest all the disks.
- ;;
- "?"|h*|H*) Help_install Check_space ;;
- q*|Q*) return 1 ;;
- esac
- done # End of inner question loop.
- fi # end of space ck conditional.
- done # End of outer control loop.
- return 0
- } # End of Check_space
- Check_source() # Check the answer given for the source of the files.
- { # RKB Apr 15 17:04:09 1993
- # RKB updtd: Aug 4 22:26 93 Take out tape support.
- # RKB updtd: Sep 17 00:12 93 V10.1ph3h Add case for set prompt to help.
- # RKB updtd: Mar 7 00:34 95 V105P01 rm ADMIN from reqd list.
- # RKB updtd: Apr 15 23:20 02 V190P16 Take out use of 'tr' - HPUX 11i bug.
- # RKB Apr 15 23:20 02 V190P16 Take out use of 'tr' - HPUX 11i bug.
- # RKB updtd: Mar 10 13:29 03 V020P13 Add logic to check for tar.Z files.
- # This function sets the variable: SOURCE
- [ "$SOURCE" ] && return 0 # If set, it's already been checked.
- [ "$SRC_PMT" = "n/a" ] && return 0 # No point in cking if n/a.
- print "${MSG}Checking source directory ${SRC_PMT} ...\c"
- unset SOURCE SRC_FLAG SRC_MSG # Init these vars to be safe.
- # Now check SRC_PMT
- if [ $SRC_PMT = "help" ] ; then # True if prompt is set to 'help'.
- print "${WARN}source directory required for '$INS_TYPE'." >&2
- SRC_MSG="enter source directory for '$INS_TYPE' "
- SRC_FLAG=$REENTER ; return 1
- elif [ -d "$SRC_PMT" ] ; then # True if directory.
- typeset -l DIR_LC
- for DIR in INSTALL UGII UGFLEXLM ; do # Ck for Base products.
- DIR_LC=$DIR
- DIR_TAR=${DIR}.tar.Z
- [ -d ${SRC_PMT}/$DIR ] && continue # found it, continue
- [ -d ${SRC_PMT}/$DIR_LC ] && continue # found it, continue
- [ -f ${SRC_PMT}/$DIR_TAR ] && continue # found it, continue
- # If none found, fall through to this error.
- print "${ERR}$DIR not found in $SRC_PMT" >&2
- SRC_MSG="$DIR not found in $SRC_PMT"
- SRC_FLAG=$REENTER ; return 1
- done # End test.
- SOURCE=$SRC_PMT # Passed the test set the SOURCE var.
- elif [ -c $SRC_PMT ] ; then # True if local tape.
- print "${WARN}tape devices not supported." >&2
- SRC_MSG="tape devices not supported."
- SRC_FLAG=$REENTER ; return 1
- elif echo $SRC_PMT | grep ":" >$NULL ; then # True if remote tape.
- print "${WARN}remote tapes/directories not supported." >&2
- SRC_MSG="remote tapes/directories not supported."
- SRC_FLAG=$REENTER ; return 1
- else # None of the above, we can't use it.
- print "${WARN}$SRC_PMT is not a valid source directory." >&2
- SRC_MSG="$SRC_PMT is not a valid source directory."
- SRC_FLAG=$REENTER ; return 1
- fi # end of dir/tape conditional.
- UGII_SOURCE=$SOURCE
- Log_var UGII_SOURCE "Source dir for UG files"
- return 0
- } # End Check_source.
- Check_switches() # Check and process the legal switches into a switch word.
- { # RKB created Mon Aug 3 13:05:23 PDT 1992
- # RKB updated: Aug 18 1992
- # RKB updated: 27 Jan 07 Chng VECHO to use print instead of echo.
- # This function works on 1 global variable, CMD_LINE_ARGS which may be empty.
- unset C_SWT D_SWT F_SWT L_SWT Q_SWT V_SWT # unset switch vars just to be safe.
- # Put the command line args (saved earlier) into positional parameters.
- getopt cdfhlv ${CMD_LINE_ARGS} >$NULL 2>&- || { # Check for legal switches.
- print "\nusage:\t$SCRIPTNAME [-c] [-v] [-d|-f [filename]] [-l [filename]]
- \r\talso, use $SCRIPTNAME -h for help."
- exit 2 ;}
- set -- `getopt cdfhlv ${CMD_LINE_ARGS} | sed s/--//p` # Looked OK, use 'em.
- # Process all the switches as positional parameters.
- while [ "$#" -gt 0 ] ; do # Loop until they're all done.
- case $1 in
- -c) C_SWT=c ;; # Configure only.
- -d) D_SWT=d # Take the defaults
- SKIP_MAIN_QUE=0 # Skip the question for the main screen.
- SKIP_MAIN_QUE2=0 # Skip the question for the product select screen.
- ;;
- -f) F_SWT=f # Use an answer File
- SKIP_MAIN_QUE=0 # Skip the question for the main screen.
- SKIP_MAIN_QUE2=0 # Skip the question for the product select screen.
- # Now check if there's an arg for -f other than another switch.
- if [ `print "$2" | sed s/-.//g` ] ; then
- READFILE=$2 # If there's a legitimate arg use it.
- elif [ -f ${SCRIPTNAME}.ans ] ; then
- READFILE=${SCRIPTNAME}.ans # If no arg, use the default.
- else
- print "${ERR}no filename supplied with the '-f' switch. And,
- \r\tcould not find the default file: ${SCRIPTNAME}.ans" >&2
- exit 1
- fi
- ;;
- -l) L_SWT=l # Log the answers
- # Now check if there's an arg for -l other than another switch.
- if [ `print "$2" | sed s/-.//g` ] ; then
- LOGFILE=$2 # If there's a legitimate arg use it.
- else
- LOGFILE=${SCRIPTNAME}.ans # If no arg, use the default.
- fi
- if [ -f "$LOGFILE" ] ; then
- echo >> $LOGFILE 2>&- || LOGFILE=$UGS_TMP/$LOGFILE # Ck write.
- print "# answers appended `date` by $SCRIPTNAME" >> $LOGFILE
- else
- echo > $LOGFILE 2>&- || LOGFILE=$UGS_TMP/$LOGFILE # Write test.
- cat > $LOGFILE <<-END_OF_CAT
- # $LOGFILE created by $SCRIPTNAME
- # on `date`
- #
- # Data in this file can be used to provide
- # answers for installation questions.
- # Answer rules:
- # 1. bourne shell environment variable format.
- # 2. answers must begin in the first column.
- # 3. commented answers are ignored.
- # 4. in line comments are allowed.
- # 5. answers can be in any order
- # 6. duplicates are allowed.
- # 7. ONLY the last answer is used.
- #
- END_OF_CAT
- [ $? = 0 ] || {
- print "${ERR}could not create the logfile: $LOGFILE" >&2
- exit ;}
- fi
- ;;
- -q) Q_SWT=q ;; # Do it quietly
- -v) V_SWT=v ;; # Do it verbose
- -h) print "\n\t$SCRIPTNAME optional switch usage:
- \n\t[-c ] configure only. (do not load files).
- \n\t[-d ] take supplied defaults. cannot be used with '-f'.
- \n\t[-f [filename]] take answers from supplied filename or
- \r\t ${SCRIPTNAME}.ans if no filname given.
- \r\t NOTE: answers in this file can be overidden
- \r\t by environment variables.
- \n\t[-l [filename]] save answers in supplied filename or
- \r\t ${SCRIPTNAME}.ans if no filname given.
- \n\t[-v ] verbose output messages. (overides quiet). \n"
- # \n\t[-q ] quiet, no output messages and no questions asked.
- # \r\t (must also use a '-f' or '-d' switch).
- exit 1 ;;
- esac
- shift
- done
- #
- # Now check/eliminate some switch combinations.
- # The V switch superceeds the Q switch
- [ "$V_SWT" ] && VECHO=print || VECHO=":" # Use print instead of echo NX5P24.
- [ "$V_SWT" ] && unset Q_SWT
- #
- # Can't use -d and -f together.
- [ -n "$D_SWT" -a -n "$F_SWT" ] && {
- print "${ERR}cannot use the '-d' and '-f' switches together." >&2
- exit 2
- }
- #
- # If using the Q switch you must also have the D or F switch.
- [ "$Q_SWT" ] && [ -z "$D_SWT" -a -z "$F_SWT" ] && { # Q AND D & F not set.
- print "${ERR}to use '-q' you must also use '-d' OR '-f'." >&2 ; exit 2 ;}
- #
- # Concatenate the individual switches into a switch control word.
- READ_CONTROL_SWITCHES="$D_SWT$F_SWT$Q_SWT"
- # If in quiet mode just shut off std.out
- [ "$Q_SWT" ] && exec 1>/dev/null
- :
- } # End Check_switches.
- Copy_kits() # Copies kit files from source dir to base dir. Uses cpio or tar.
- { # RKB Jun 23 04 NX3P19 Taken from original Cpio_from_disk.
- # RKB updtd: Wed Apr 20 2005 Added Linux support. NX4P11.
- #
- COPY_ERRORS=0 # Init the error counter.
- unset FAILED_KITS # Init the failed kit list.
- typeset -l KIT_LC # Typeset a lowercase kit name.
- #
- # Display the loading message.
- $VECHO "\n\n\tLOADING FILES from: ${SOURCE}" # Do the file loading.
- #
- # Cpio or tar extract all the kit names passed as arguments.
- for KIT in $* ; do # Kit names passed as args.
- KIT_LC=$KIT # Lowercase kit name.
- # Directories are cpio'ed from SOURCE to BASE_DIR/KIT_LC
- if [ -d $SOURCE/$KIT -o -d $SOURCE/$KIT_LC ] ; then
- [ -d ${BASE_DIR}/${KIT_LC} ] || \
- mkdir -p ${BASE_DIR}/${KIT_LC} 2>&- || {
- print "${ERR}could not find or mkdir ${BASE_DIR}/$KIT_LC" >&2
- continue ; }
- chmod 555 ${BASE_DIR}/${KIT_LC} >$NULL 2>&- # in case weird umask.
- print "${MSG}Copying $KIT files to $BASE_DIR/${KIT_LC} ... \c"
- $VECHO ; $VECHO # Cosmetic line feeds for verbose mode.
- # This method uses the cpio command.
- cd $SOURCE/$KIT 2>&- || cd $SOURCE/$KIT_LC
- # Now do the actual copy.
- # Linux cpio always outputs to std.err so have to do special cases.
- if [ "${MACHINE}" = "Linux" -a -n "$V_SWT" ] ; then # Linux only.
- if [ -n "$V_SWT" ] ; then # Verbose mode - output filenames.
- find . -print | cpio -pudmv ${BASE_DIR}/$KIT_LC 2>&1 ; STAT=$?
- else # Non verbose mode - no output.
- find . -print | cpio -pudm ${BASE_DIR}/$KIT_LC 2>&- ; STAT=$?
- fi
- else # All other unixes can do it this way.
- find . -print | cpio -pudm${V_SWT} ${BASE_DIR}/$KIT_LC 2>&- ; STAT=$?
- fi
- [ "$STAT" != 0 ] && { # Do this block only if the cpio cmd failed.
- # Old method obsoleted by Linux cpio problems.
- # find . -print | cpio -pudm${V_SWT} ${BASE_DIR}/$KIT_LC 2>&- || {
- print "${ERR}cpio failed copying $KIT to $BASE_DIR/$KIT_LC
- \n\tOne or more files in $KIT failed to copy. Existing file(s)
- \r\tin the $BASE_DIR/$KIT_LC directory may currently be open.
- \r\tThese file(s) may be open by NFS clients using this directory.
- \r\tRe-run $SCRIPTNAME when these file(s) have been closed. " >&2
- FAILED_KITS="$FAILED_KITS $KIT" # Add this kit to failed list.
- (( COPY_ERRORS+=1 )) # Increment the error count.
- continue
- }
- # No directory, look for a tarset. Tarsets are extracted into base dir.
- elif [ -f $SOURCE/${KIT}.tar.Z ] ; then # Compressed Tar file. V190P11.
- chmod 555 ${BASE_DIR}/${KIT_LC} >$NULL 2>&- # in case weird umask.
- print "${MSG}Extracting $KIT to $BASE_DIR/${KIT_LC} ... \c"
- $VECHO ; $VECHO # Cosmetic line feeds for verbose mode.
- # This method uses tar & uncompress.
- cd $BASE_DIR
- uncompress -c $SOURCE/${KIT}.tar.Z | tar -x${V_SWT}f - || {
- print "${ERR}Could not extract compressed tar file: ${KIT}.tar.Z
- \n\tOne or more files in $KIT failed to copy. Existing file(s)
- \r\tin the $BASE_DIR/$KIT_LC directory may currently be open.
- \r\tThese file(s) may be open by NFS clients using this directory.
- \r\tRe-run $SCRIPTNAME when these file(s) have been closed. " >&2
- FAILED_KITS="$FAILED_KITS $KIT" # Add this kit to failed list.
- (( COPY_ERRORS+=1 )) # Increment the error count.
- continue
- }
- else # Couldn't find either one so log it as an error. This shouldnt happen
- # cuz this function is passed a pre-qualified list, but just in case.
- print "${WARN}No product directory, or tarset found in $SOURCE
- \r\tfor $KIT " >&2
- FAILED_KITS="$FAILED_KITS $KIT" # Add this kit to failed list.
- (( COPY_ERRORS+=1 )) # Increment the error count.
- fi
- done
- cd $OLDCWD
- [ "$COPY_ERRORS" -gt 0 -o -n "$FAILED_KITS" ] && {
- FAILED_KITS=${FAILED_KITS#[ ]} # Cosmetics strip leading space.
- print "${ERR}The following kits failed to copy correctly:
- \r\t$FAILED_KITS
- \n\tNumber of errors = $COPY_ERRORS \c"
- }
- echo # Cosmetic echo.
- } # End of Copy_kits
- Copy_license_file() # Copies the user supplied license file to ugflexlm.
- { # RKB 26Mar08 NX6P21 Initial version.
- #
- : ${BASE_DIR:?} # Reqd var ck.
- : ${UGFS_PMT:?} # Reqd var ck.
- #
- # Check this is a file, not server names(s).
- [[ "$UGFS_PMT" = *"/"* ]] || return 0 # Not a file name so just return.
- #
- # Now copy the license file. if we can. As of NX6P21 we do this cp
- # during config part of install.
- #
- # First check we're not trying to copy the same file.
- [ "$UGFS_PMT" = "$UGS_LICENSE_SERVER" ] && return 0 # cant copy same file.
- #
- # Next make sure we can find it then try the copy.
- if [ -f "$UGFS_PMT" ] ; then # Make sure we can find it else give error.
- # Make ugflexlm dir if needed and copy the file to the dir.
- [ -d ${BASE_DIR}/ugflexlm ] || mkdir -p ${BASE_DIR}/ugflexlm 2>&-
- chmod 555 ${BASE_DIR}/ugflexlm >$NULL 2>&-
- $VECHO "${MSG}Copying license file: $UGFS_PMT
- \r\tto: $UGS_LICENSE_SERVER ... "
- cp $UGFS_PMT $UGS_LICENSE_SERVER 2>1 || {
- print "${ERR}Could not copy the license file: $UGFS_PMT
- \r\tto $UGS_LICENSE_SERVER
- \n\tCopy the license file to $UGS_LICENSE_SERVER
- \r\tbefore attempting to run NX."
- }
- else # Couldn't find the file.
- print "${ERR}The license file entered was not found: $UGFS_PMT
- \n\tCopy the license file to $UGS_LICENSE_SERVER
- \r\tbefore attempting to run NX."
- fi
- #
- } # End Copy_license_file
- Create_dt_xsession() # Creates an Xsession.d environment file for CDE.
- { # RKB Created: Apr 17 23:11 95 V105P07
- # RKB 03MAR98 V150P01 Rm ACS specific logic.
- # RKB May 21 1998 V150P03 Add logic for UGFLEXlm.
- # RKB Aug 28 06 NX050P16 Changes for new universal flexlm i.e. ugslmd.
- #
- [ -d "$1" ] || return 1 # Reqd arg ck. Must be an Xsession.d directory.
- : ${2:?} # Reqd arg ck. Scriptname to create.
- #
- # Set FILENAME based on MODIFY_OK.
- if [ "$MODIFY_OK" = yes ] ; then # Ck that we have permission to mod files.
- FILENAME=$1/$2 # Create supplied filename in supplied dir.
- else # Did not want to modify system files. Do it in UGS_TMP.
- FILENAME=$UGS_TMP/$2 # Create supplied filename in ugs tmp.
- fi
- #
- $VECHO "${MSG}Creating CDE environment file: \n\t$FILENAME ..."
- #
- # Now create the actual file.
- cat > $FILENAME <<-END_OF_CAT1
- # Unigraphics Solutions Inc. environment (for CDE).
- # File name: $FILENAME
- # Created by ${SCRIPTNAME} on: `date`
- #
- # NOTE: This script is NOT intended to be customizable.
- # It is always replaced by ${SCRIPTNAME}.
- #
- # $PRODNAME $NX_VER Base directory, as entered during ug_install.
- UGII_BASE_DIR=$BASE_DIR ; export UGII_BASE_DIR
- #
- # $PRODNAME $NX_VER Root directory, as entered during ug_install.
- UGII_ROOT_DIR=\${UGII_BASE_DIR}/bin/ ; export UGII_ROOT_DIR
- #
- END_OF_CAT1
- #
- [ "$UGF_SERVERS" ] && {
- cat >> $FILENAME <<-END_OF_CAT2
- # Unigraphics - FLEXlm license variable, as entered during ug_install.
- UGS_LICENSE_SERVER="$UGF_SERVERS"
- export UGS_LICENSE_SERVER
- #
- END_OF_CAT2
- }
- print "# End $FILENAME " >> $FILENAME
- chmod 555 $FILENAME
- return 0
- #
- } # End of Create_dt_xsession
- Create_prod_link() # Create make a symbolic link for the product (arg1).
- { # RKB Sun Feb 03 19:16:29 PST 1991
- TARGET_DIR=$1 ; : ${TARGET_DIR:?} # Required arg, internal check.
- LINK_DIR=$2 ; : ${LINK_DIR:?} # Required arg, internal check.
- $VECHO "\r\tCreating link: $LINK_DIR to ${TARGET_DIR} ..."
- # If a link dir already exist, remove it.
- [ -h ${LINK_DIR} ] && rm -f ${LINK_DIR} 2>&-
- # If a real dir exists, rename it with pid extension.
- if [ -d ${LINK_DIR} -a ! -h ${LINK_DIR} ] ; then
- $VECHO "\r\texisting real directory saved as ${LINK_DIR}.$$"
- mv ${LINK_DIR} ${LINK_DIR}.$$ 2>&- || {
- print "${ERR}could not rename existing directory: ${LINK_DIR}" >&2
- sleep 3 ; return 1 ;}
- sleep 3
- fi
- # Now create the link for the product.
- ln -sf $TARGET_DIR ${LINK_DIR} || {
- print "${ERR}was not able to create a symbolic link for $PRODUCT" >&2
- return 1
- }
- return 0
- } # End of Create_prod_link.
- Detect_missing_kits_list() # Scan arg list for kits in source dir. Make lists.
- { # RKB Jun 23 04 NX3P19 First iteration.
- # RKB Jul 21 04 NX3P20 Add testonly feature.
- # RKB Jul 29 04 NX3P20 Split Detect function into test and list function.
- #
- # This function makes the MISSING_KITS & FOUND_KITS lists.
- # Arg1 must be the source directory to check. Remaining args will be the
- # kit name to look for in source directory.
- #
- TEST_SRC=$1 ; : ${TEST_SRC:?} # Arg1 is test src. Ck arg1 was set.
- shift 1 # Remaining args are the kits to ck.
- unset MISSING_KITS FOUND_KITS # Clear the kit lists.
- typeset -l KIT_LC # Lowercase version of KIT var.
- for KIT in $* ; do # Ck all the kits on arg list.
- KIT_LC=$KIT # Lowercase version of KIT name.
- # For each kit, check all the possible packaging formats.
- if [ -d $TEST_SRC/$KIT -o \
- -d $TEST_SRC/$KIT_LC -o \
- -f $TEST_SRC/${KIT}.tar* -o \
- -f $TEST_SRC/${KIT_LC}.tar* ]
- then
- FOUND_KITS="$FOUND_KITS $KIT" # Found one form of kit, add to list.
- else # We couldn't find the kit in any known form.
- MISSING_KITS="$MISSING_KITS $KIT" # Missing kit so add it to list.
- fi
- done
- # If there are missing kits return 0 else return 1.
- [ "$MISSING_KITS" ] && return 0 || return 1
- #
- } # End Detect_missing_kits_list.
- Detect_missing_kits_test() # Scan arg list for kits in source dir. Test only.
- { # RKB Jun 23 04 NX3P19 First iteration.
- # RKB Jul 21 04 NX3P20 Add testonly feature.
- # RKB Jul 29 04 NX3P20 Split Detect function into test and list function.
- #
- # This function does a test only, returns 1 if any kits are missing.
- # Arg1 must be the source directory to check. Remaining args will be the
- # kit name to look for in source directory.
- #
- TEST_SRC=$1 ; : ${TEST_SRC:?} # Arg1 is test src. Ck arg1 was set.
- shift 1 # Remaining args are the kits to ck.
- typeset -l KIT_LC # Lowercase version of KIT var.
- for KIT in $* ; do # Ck kits on remaining arg list.
- KIT_LC=$KIT # Lowercase version of each KIT name.
- # For each kit, check all the possible packaging formats. If any test
- # returns true, we will continue to the next kit name.
- [ -d $TEST_SRC/$KIT ] ||
- [ -d $TEST_SRC/$KIT_LC ] ||
- [ -f $TEST_SRC/${KIT}.tar* ] ||
- [ -f $TEST_SRC/${KIT_LC}.tar* ] || return 1 # Return 1 on first missing kit.
- # If none of above tests passed we couldn't find the kit in any known form.
- done
- return 0 # Finished list with no kits missing.
- #
- } # End Detect_missing_kits_test.
- Display_main_screen() # Display the second screen. i.e. the main menu.
- { # RKB Apr 6 10:48 93
- # RKB Feb 28 17:41 95 V105P01. Chng awk to use substr so it works on AIX.
- # RKB May 8 17:05 98 V150P03. Multiple changes for UGFLEXlm.
- # RKB Jun 30 16:00 05 NX4P16. Add quotes to echoes with [ for HP 11i bug.
- # RKB Jan 26 07 NX5P24 Rm FLEXlm server logic.
- # RKB Feb 20 08 NX6P19 Chg to allow standalone license file or server names.
- clear
- # Display the header for this menu.
- print "\r\t$PRODNAME $NX_VER Installation `date`"
- print "\r\tEnter '?' for help, '!' for shell, or 'q' to quit at any prompt."
- print "\r\tMain Menu. 'n/a' indicates item is not applicable"
- # Display the main body of this menu. Double quotes added in NX4P16.
- ( # Do all these echoes in a subshell to use the awk same formating.
- print "\n${INS_FLAG:=$TAB}1. UG Installation type."% "[${INS_TYPE}]"
- print "\n${SRC_FLAG:=$TAB}2. SOURCE directory."% "[${SRC_PMT}]"
- print "\n${BASE_FLAG:=$TAB}3. BASE directory."% "[$BASE_PMT]"
- print "\n${MOD_FLAG:=$TAB}4. O.K. to MODIFY system files."% "[$MOD_PMT]"
- print "\n${UGFS_FLAG:=$TAB}5. License server(s) or a filename."% "[$UGFS_PMT]"
- ) | awk -F% '{
- if ( NF < 2 ) { print $0 ; next ;} # Print header lines.
- size=79-length($1)-length($2)-7 # Calculate size of fill txt.
- if ( size <= 1 ) size=1 # Must be at least 1 .
- printf("%s%s%s",$1,substr(" '$FILL_TXT' ",0,size),$2) # Now printf it.
- }' # End of the awk formatting.
- #
- echo # Cosmetic line feed.
- #
- # If there's any error flags spit out reenter message.
- print "$INS_FLAG $SRC_FLAG $BASE_FLAG $MOD_FLAG
- $UGFT_FLAG $UGFF_FLAG $UGFS_FLAG " \
- | grep "\*" >$NULL && {
- print "\n\tItem(s) marked '${REENTER}' must be corrected:"
- [ "$INS_MSG" ] && print "\tItem 1: $INS_MSG"
- [ "$SRC_MSG" ] && print "\tItem 2: $SRC_MSG"
- [ "$BASE_MSG" ] && print "\tItem 3: $BASE_MSG"
- [ "$MOD_MSG" ] && print "\tItem 4: $MOD_MSG"
- [ "$UGFS_MSG" ] && print "\tItem 5: $UGFS_MSG"
- } # End flag check.
- return 0
- } # End Display_main_screen
- Display_screen3() # Displays screen 3 i.e. the product menu.
- { # RKB Tue Apr 6 18:25:00 PDT 1993
- # RKB rewrite Jul 12 15:47 1993 NEW V10.1 use PRODUCTS to display arrays.
- # RKB updt: Nov 9 15:08 93 Add "load" word to screen display.
- # RKB updt: Mar 7 14:56 94 V103P2E Add display for Kb & Mb total space.
- # RKB updt: Mar 7 00:30 95 V105P01. Rm reqd logic for ADMIN & Sun LIB.
- # RKB updt: May 19 12:59 99 V160P09. Rm reqd logic for UGFLEXLM & UGII.
- # RKB updt: Jul 25 03 V020P21 Chng SPACE_REQUIRED_MB to 4 digits.
- # RKB updt: Jun 04 04 NX3P17 Chng Kit field to 14 chars & other adjustments.
- # RKB updt: Apr 29 05 NX4P11 Chng some awk syntax for Linux.
- clear
- # Display the header for this menu.
- print "\r\t $PRODNAME $NX_VER Installation `date`"
- print "\r\t Product Selection Menu. '-->' = selected, '**' = required. "
- print "\n\t # Name Kbytes Directory" # Titles
- # Display the main body of this menu i.e. the available products.
- ( # Do the following section in the same subshell, to pipe to awk.
- # Loop thru the list of kits in PRODUCTS. except item 0.
- unset PRODUCTS[0]
- for KIT in ${PRODUCTS[*]} ; do
- eval echo "\${${KIT}[*]}"
- done
- ) | $AWK_CMD ' $3!~/[A-Z|a-z].*/ {next} { # Skip lines w/o letters in Field3.
- if( $3 == "UGFLEXLM" ) { $3=$3"**"} # Put required flag on UGFLEXLM
- if( $3 == "UGII" ) { $3=$3"**"} # Put required flag on UGII
- # If Field1 shows selected, print Fields 1-5, else print Fields 2-5.
- if( $1 == "'$SELECTED'" )
- # Sp Sel Num Kit Size Directory
- { printf(" %-3s %2s %-14s %6s %-26s\n",$1,$2,$3,$4,$5)}
- else
- # Spaces Num Kit Size Directory
- { printf(" %2s %-14s %6s %-26s\n",$2,$3,$4,$5)}
- }'
- typeset -R8 SPACE_REQUIRED_KB=$SPACE_REQUIRED_KB
- typeset -L4 SPACE_REQUIRED_MB=$SPACE_REQUIRED_MB
- print "\tTotal Disk space: $SPACE_REQUIRED_KB (${SPACE_REQUIRED_MB} Mb)"
- print "\n\t95) Change dirs. 96) Select required 97) All 98) None 99) Load"
- } # End of Display_screen3
- Display_selected() # Display the selected products and their filesystem.
- { # RKB Mon Jan 28 21:53:50 PST 1991
- # RKB updtd: Aug 24 16:22 1993 V10ph3c change to open ended product list.
- clear
- echo
- ( print " X KIT KIT CURRENT FILE"
- print " X NAME SIZE DIRECTORY SYSTEM "
- ) | $AWK_CMD '{ printf("\t%-12s %-8s %-25s %-10s\n",$2,$3,$4,$5)} '
- echo
- ( # Do the following section in the same shell, to pass to awk.
- # Fixed directory products are not listed.
- # Loop thru the list of kits in PRODUCTS. except item 0.
- unset PRODUCTS[0]
- for KIT in ${PRODUCTS[*]} ; do
- [ $KIT = UGFLEXLM ] && continue # cant move acs
- I=`eval echo \\${$KIT[5]}`
- eval print "\${${KIT}[*]} \${FS_NAME[$I]}"
- done
- ) | $AWK_CMD '{ if( $1 == "'$SELECTED'" )
- { printf("\t%-12s %-8d %-25s %-10s\n",$3,$4,$5,$7)}
- }'
- echo # Cosmetic line feed.
- (
- print "SPACE left after load:"
- COUNT=0
- while [ ${COUNT} -lt ${#FS_NAME[*]} ] ; do
- print "${FS_NAME[$COUNT]} = ${FS_FREE[$COUNT]}"
- let COUNT=COUNT+1
- done
- ) | pr -ato8 -3
- } # End of Display_selected.
- Deselect() # RKB unselects a product, requires 1 arg.
- { # RKB Updated for ksh arrays: Thu May 10 14:02:10 PDT 1990
- # RKB updtd Jul 8 00:51 1993 rm swap space logic
- # RKB updtd Jul 8 19:41 1993 NEW for V10.1 use faster ksh arithmetic.
- # RKB updtd Feb 1 17:03 1994 removed 'p' switch from the sed command.
- # RKB Jun 17 04 NX3P18 Chng FSETS logic in prep for multi CD installs.
- #
- : ${1:?} # Required product name arg check.
- [ "`eval echo \\${${1}[0]}`" = "$SELECTED" ] || return 0
- PROD_SIZE=`eval echo \\${${1}[3]}` ; : ${PROD_SIZE:=0}
- PROD_INDEX=`eval echo \\${${1}[5]}` ; : ${PROD_INDEX:=0}
- # Subract product size from space required var.
- let SPACE_REQUIRED_KB=$SPACE_REQUIRED_KB-$PROD_SIZE
- # Add product size to free space array.
- let FS_FREE[$PROD_INDEX]=${FS_FREE[$PROD_INDEX]}+$PROD_SIZE
- # Subract product size from the needed space array.
- let FS_NEEDED[$PROD_INDEX]=${FS_NEEDED[$PROD_INDEX]}-$PROD_SIZE
- set -f
- FSETS=`echo $FSETS | sed "s!$1!!"` # Rm prod name from FSETS var.
- set +f
- eval `echo ${1}[0]=\\$UNSELECTED` # Mark this product unselected.
- return 0
- } # End of Deselect
- Get_fsindex() # Get the index number to supplied file system name.
- { # RKB Mon Jan 21 21:00 91
- # RKB Mar 8 23:59 94 V103P2E chg to use while loop not grep -n. faster.
- : ${FS_NAME[*]:?} # Required variable internal check.
- : ${1:?} # Required arg internal check.
- I=0 # Init the index counter
- # Loop thru the FS_NAME array to get index number for filesystem in arg 1.
- while [ $I -le ${#FS_NAME[*]} ] ; do
- [ $1 = "${FS_NAME[$I]}" ] && { echo $I ; return 0 ;}
- ((I+=1)) # Increment the index.
- done
- unset FS_INDEX ; return 1 # Didn't find the file system.
- } # End of Get_fsindex
- Get_fs_info() # Returns filesystem info for the directory argument.
- { # RKB Mon Sep 30 15:21:11 PDT 1991
- # RKB updtd: Jul 6 13:20 1993 V10.1.1 make generic, add Solaris.
- # RKB updtd: Aug 10 23:41 1993 V10.1p2 switch to 1024 byte blocks.
- # RKB updtd: Oct 13 13:21 1993 Add IRIX specific stuff.
- # Requires 2 global variables.
- : ${DF_CMD:?cmd var must be set to use this function.}
- : ${AWK_CMD:?cmd var must be set to use this function.}
- # Requires 2 args; a switch and a target directory.
- TARGET=$2 ; : ${TARGET:?} # Internal check
- #
- # If dir doesn't exist, check parent.
- while [ ! -d $TARGET ] ; do
- [ -f $TARGET ] && { # error if a file exists.
- print "${ERR}directory name expected. file exists: $TARGET" >&2
- return 1 ;}
- TARGET=`dirname $TARGET`
- done
- #
- # Do appropriate action based on the switch. The options are:
- # use -sp to get free space, -fs for real filesystem name, -mnt returns
- # the mount point and -nfs returns true if the filesystem is NFS mounted,
- # and false if it's not.
- #
- # Set machine specific number for the df field containing filesystem.
- [ $MACHINE = IRIX -o $MACHINE = IRIX64 ] && N=6 || N=5
- case $1 in
- -fs*) $DF_CMD $TARGET | tr "\012" " " | $AWK_CMD '{print $(NF-'$N')}' ;;
- -mnt*) $DF_CMD $TARGET | tr "\012" " " | $AWK_CMD '{print $NF}' ;;
- -nfs) $DF_CMD $TARGET | tr "\012" " " | $AWK_CMD '{print $(NF-'$N')}' | grep ":/" >$NULL || return 1 ;;
- -sp*) $DF_CMD $TARGET | tail -1 | $AWK_CMD '{printf("%d",$(NF-2))}' ;;
- esac
- return 0
- } # Get_fs_info
- Help_install() # Display a range of the help file, indexed by arg 1.
- { # RKB Mar 25 23:41:23 1993 V10p11.
- # RKB Apr 21 11:23:23 1993 Take out the reformatting stuff for speed.
- # RKB Mar 9 23:26 94 V103P2E add search for help file.
- # RKB Mar 16 23:59 94 V103P3B mv inline comments out of sed script for OSF.
- # RKB Nov 1 15:21 94 V104P12 add CR to continue at end of help screen.
- # Requires 1 argument, the help code.
- : ${1:?} # Internal check.
- # Requires 2 variables.
- : ${SCRIPTNAME:?'not defined for use with help.'} # Internal check
- : ${SCRIPTDIR:?'not defined for use with help.'} # Internal check
- # If not already set, look for the file.
- [ "$HELPFILE" ] || {
- # Make sure we can find the help file, either here or in SOURCE directory.
- for DIR in $SCRIPTDIR $SOURCE $SOURCE/INSTALL $SOURCE/install \
- $SRC_PMT $SRC_PMT/INSTALL $SRC_PMT/install
- do
- [ -f $DIR/${SCRIPTNAME}.hlp ] && {
- HELPFILE=$DIR/${SCRIPTNAME}.hlp
- break # found it, we're done.
- }
- done
- }
- # Ck the helpfile exists.
- [ -f "$HELPFILE" ] || {
- print "${WARN}could not find ${SCRIPTNAME}.hlp
- \r\thelp is not available. "
- return 1
- }
- echo # Cosmetic line feed.
- #
- # The following sed script uses a range of lines from Arg 1 thru "END_"Arg 1.
- # It then deletes those lines, and prints the rest. In other words,
- # it prints an inclusive range without the 1st and last lines.
- sed -n "/^\($1\)/,/^END_$1/ {
- /^[$1,END_$1]/d
- p
- }" $HELPFILE | more
- print "\n\n\tEnter <CR> after reading help. \c" ; read CR
- return 0
- } # End Help_install
- Init_fs_arrays() # Initializes the File System array.
- { # RKB Thu Jan 31 22:39:57 PST 1991
- # RKB Updated: Sep 28 15:26:28 PDT 1992
- # RKB updtd: Jul 6 22:51 93 V10.1.1 make generic.
- # RKB updtd: Mar 7 18:34 94 V103P2E streamline, rm "set --".
- # RKB updtd: Mar 9 22:34 94 V103P2E rm test -s for FS_FILE, just wait for it.
- # This function initializes the FS_NAME & FS_FREE
- # arrays based on the contents of $FS_FILE
- FS_FILE="$UGS_TMP/filesystem_info" # File name to read the results from.
- $VECHO "${MSG}Initializing File System array ..."
- wait $SIZE_FS_PID # in case the file is not ready, wait for the bg job.
- I=0 # Initialize the index
- cat $FS_FILE | while read NAME SPACE ; do
- FS_NAME[$I]=$NAME ; FS_FREE[$I]=${SPACE:=0} ; FS_NEEDED[$I]=0
- ((I+=1)) # Increment the index.
- done
- return 0
- } # End of Init_fs_arrays
- Init_fs_arrays() # Initializes the File System array.
- { # RKB Thu Jan 31 22:39:57 PST 1991
- # RKB Updated: Sep 28 15:26:28 PDT 1992
- # RKB updtd: Jul 6 22:51 93 V10.1.1 make generic.
- # RKB updtd: Mar 7 18:34 94 V103P2E streamline, rm "set --".
- # RKB updtd: Mar 9 22:34 94 V103P2E rm test -s for FS_FILE, just wait for it.
- # RKB updtd: Wed Apr 20 2005 NX4P11 Added Linux support.
- # This function initializes the FS_NAME & FS_FREE
- # arrays based on the contents of $FS_FILE
- FS_FILE="$UGS_TMP/filesystem_info" # File name to read the results from.
- $VECHO "${MSG}Initializing File System array ..."
- wait $SIZE_FS_PID # in case the file is not ready, wait for the bg job.
- I=0 # Initialize the index
- # Linux
- # cat $FS_FILE | while read NAME SPACE ; do
- # Linux cant do "cat file | while read" "must use while read done < file"
- while read NAME SPACE ; do
- FS_NAME[$I]=$NAME ; FS_FREE[$I]=${SPACE:=0} ; FS_NEEDED[$I]=0
- ((I+=1)) # Increment the index.
- done < $FS_FILE
- return 0
- } # End of Init_fs_arrays
- Init_prod_arrays() # Initialize the product arrays
- { # RKB Mon May 14 16:32:01 PDT 1990
- # RKB Updated Jan 23 1991
- # RKB Updated Feb 05 11:12 1991
- # RKB Updated Jun 7 22:51 1993 V10ph13g. Add ughelp kit.
- # RKB re-write Jul 10 23:55 1993 NEW for V10.1 source the dat file.
- # RKB updtd: Mar 9 00:28 94 V103P2E added double cks for FS_INDEX.
- # RKB updtd: Mar 9 23:01 94 V103P2E add cks in SOURCE dir for SCRIPTNAME.dat
- $VECHO "${MSG}Initializing Product arrays ..."
- SPACE_REQUIRED_KB=0
- # Get the mount point for BASE_DIR.
- BASE_MNT_PT=`Get_fs_info -mnt $BASE_DIR` || {
- print "${WARN}could not determine mount point for $BASE_DIR
- \r\tFilesystem information may be incorrect. "
- } # Shouldn't be any problem, but just to be safe.
- FS_INDEX=`Get_fsindex $BASE_MNT_PT` || {
- print "${WARN}could not determine filesystem containing $BASE_DIR
- \r\tspace calculations may be incorrect. "
- } # Shouldn't be any problem, but just to be safe.
- #
- # Make sure we can find the dat file, either here or in SOURCE directory.
- for DIR in $SCRIPTDIR $SOURCE $SOURCE/INSTALL $SOURCE/install ; do
- [ -f $DIR/${SCRIPTNAME}.dat ] && {
- DAT_FILENAME=$DIR/${SCRIPTNAME}.dat
- break # found it, we're done.
- }
- done
- # Now double check that we found it.
- [ -f $DAT_FILENAME ] || {
- print "${ERR}Could not find ${SCRIPTNAME}.dat
- \r\tthe install cannot be completed without it." >&2
- return 1
- }
- #
- # Now initialize the arrays by sourcing (dot-spacing) the dat file.
- . $DAT_FILENAME || {
- print "${ERR}Could not 'source' the ${SCRIPTNAME}.dat file.
- \r\tthe install cannot complete without the data in this file." >&2
- return 1
- }
- #
- # The PRODUCT array is a list of all the available kits, each element
- # contains the name of a kit. Each element number MUST match the number
- # in element 1 of the kit arrays - this becomes the menu number.
- # i.e. PRODUCT[2]=ADMIN so must ADMIN[1]=2
- #
- # Each kit array is initially defined as follows.
- # PROD[0]=$UNSELECTED flag. PROD[1]=Product Selection Menu number.
- # PROD[2]=product name. PROD[3]=product size. PROD[4]=product directory
- # PROD[5]=initial index into FS_NAME array.
- # Element 4 & 5 are defined as variables which are expanded at run time.
- #
- return 0
- } # End of Init_prod_arrays.
- Kill_ug() # RKB Kills all known UGII processes.
- { # RKB Jun 11 98 V150P03 updated for UG FLEXlm processes.
- # RKB updtd: Aug 28 06 NX050P16 Changes for new universal flexlm i.e. ugslmd.
- # RKB Feb 15 07 NX5P25 Rm lmgrd & ugslmd. Now done in ugslicensing_install.
- $VECHO "${MSG}Terminating UNIGRAPHICS processes ..."
- for PROC in pqmgr ugii906 ugii925 ugiigrb ugiihp ugiips uglpplot ugnetplot \
- ugplot ugiipqd pfk_daemon sballd_ugx ugraf
- do
- $PS_CMD | grep -v grep | grep "$PROC" > /dev/null && {
- set -- `$PS_CMD | grep -v grep | grep "${PROC}"`
- kill $2 >$NULL 2>&- || kill -9 $2 >$NULL 2>&-
- }
- done
- # AIX ONLY
- [ "$MACHINE" = "AIX" ] && slibclean
- } # End of Kill_ug
- Link_all_products() # RKB Create the symbolic links from bin to prod dirs.
- { # Created: Wed May 16 15:41:38 PDT 1990
- # Updated: Thu Oct 3 00:33:12 PDT 1991 V9 ph 4.
- # RKB updtd: Aug 23 22:19 93 V10.1p3c change to catch .ugii_env on Sun.
- # RKB updtd: Aug 23 22:19 93 V10.1p3c use PRODUCTS for list for links.
- # RKB updtd: Nov 9 17:05 93 V10.2ph2d add special links for shading stuff.
- # RKB updtd: Dec 9 14:34 93 V10.2ph2j change ugshading to ugrender.
- # RKB updtd: Feb 17 17:57 94 V10.3P2B rm logic for eds_reset.
- # RKB updtd: Mar 22 22:33 94 V103P3b add search logic for .dat file.
- # RKB updtd: Apr 6 16:53 94 V103P3D Chng .dat file test for SGI.
- # RKB updtd: Oct 12 23:50 94 V104P09 Chng ugrender to ugphoto.
- # RKB updtd: Mar 25 13:30 96 V111P07 Added 2 uai files for GFEM.
- # RKB updtd: May 5 01:06 99 V160P08 Ck for $BASE_DIR/ugii may not be there.
- # RKB updtd: May 18 11:38 99 V160P09 Rm links for GFEM kit - obsolete.
- # RKB updtd: Jun 15 17:08 99 V160P11 Add case for kits that do NOT need links.
- # RKB updtd: Jun 29 01:31 99 V160P12 Rm util directory.
- # RKB updtd: Jul 12 13:52 99 V160P13 Shorten list for sym links.
- # RKB updtd: Jul 27 16:02 99 V160P14 Add UGMANAGER back to list for links.
- # RKB updtd: Aug 19 17:44 99 V160P16 Rm MACH kit from list for links.
- # RKB Jun 17 04 NX3P18 Chng FSETS logic in prep for multi CD installs.
- # RKB Jun 17 04 NX3P18 Chng PLOT to NXPLOT.
- # RKB May 09 05 NX4P12 Added custom links for TOLSTACKUP.
- # RKB Dec 11 07 NX6P16 Change .ugii_env to ugii_env.dat.
- #
- Check_root_access ${BASE_DIR}/bin || return 0 # Can't do this without root.
- OLD_PWD=`pwd` # Save wherever we are.
- # Create links from list of selected products or product list in dat file.
- if [ "$FSETS" ] ; then # Use FSETS if it's set.
- PRODUCT_LIST=$FSETS # Set PRODUCT_LIST to FSETS.
- elif [ "${PRODUCTS[*]}" ] ; then # If PRODUCTS array is set use that.
- PRODUCT_LIST=${PRODUCTS[*]}
- else # Array wasn't set so search for then source the dat file.
- # Make sure we can find the dat file, in likely directories.
- unset DAT_FILENAME
- for DIR in $SCRIPTDIR $SCRIPTDIR/INSTALL $SCRIPTDIR/install \
- ${BASE_DIR}/INSTALL ${BASE_DIR}/install ${BASE_DIR}/bin \
- $SOURCE $SOURCE/INSTALL $SOURCE/install
- do
- [ -f $DIR/${SCRIPTNAME}.dat ] || continue 1 # Not found, try next.
- DAT_FILENAME=$DIR/${SCRIPTNAME}.dat
- break 1 # found it, we're done.
- done
- # Double check that we found it.
- if [ -f "$DAT_FILENAME" ] ; then
- # Initialize PRODUCTS array by sourcing (dot-spacing) the dat file.
- . "$DAT_FILENAME" || { # Ck we can sucessfully source it.
- print "${ERR}Could not 'source' the ${SCRIPTNAME}.dat file.
- \r\tNo product links created. " >&2
- return 1
- }
- PRODUCT_LIST=${PRODUCTS[*]}
- else
- print "${ERR}Could not find ${SCRIPTNAME}.dat
- \r\tNo product links created. " >&2
- return 1
- fi
- fi
- #
- # Should now have a list of products, create the file links.
- typeset -l PRODUCT_DIR # Make a var for lowercase directory name.
- for PRODUCT_NAME in $PRODUCT_LIST ; do
- #
- # Parse the kit list and make file level links for the kits that need it.
- case $PRODUCT_NAME in # Check the product name. NX3P18 Ren PLOT to NXPLOT.
- ADMIN|MECH|NXPLOT|UGMANAGER|UGII|UGPHOTO) : # LINKS REQD for these.
- ;;
- *) continue 1 # Anything else we skip - they don't need links. V160P13.
- ;;
- esac
- #
- # Now process the rest on the list.
- #
- PRODUCT_DIR=$PRODUCT_NAME # Make it lowercase.
- # See if this kit is actually installed.
- [ -d ${BASE_DIR}/${PRODUCT_DIR} ] || continue # If not, Just skip it.
- #
- # Now go in the kit directory and make a list.
- cd ${BASE_DIR}/${PRODUCT_DIR} || { # Check dir is accessible.
- print "${ERR}could not change directory to $BASE_DIR/${PRODUCT_DIR}
- \r\tNo symbolic links can be created for ${PRODUCT_NAME}." >&2
- continue ; } # Couldn't even get into the directory so skip this one.
- FILELIST=`ls` # Old method - gets every file in the directory.
- cd ${BASE_DIR}/bin # Should be in 'bin' to create relative soft links.
- $VECHO "\r\tCreating symbolic links for $PRODUCT_NAME files in `pwd` ..."
- # Now make the links.
- for FILENAME in $FILELIST ; do
- # Remove the old links.
- [ -f ./$FILENAME -o -h ./$FILENAME ] && rm -rf ./$FILENAME 2>&-
- ln -sf ../${PRODUCT_DIR}/$FILENAME ./$FILENAME || {
- print "${ERR}could not create symbolic link:
- \r\t`pwd`/$FILENAME to ../${PRODUCT_DIR}/$FILENAME" >&2
- }
- done # Done with all the files in this directory.
- #
- #
- # Some special links.
- [ $PRODUCT_NAME = "UGII" -a -d $BASE_DIR/ugii ] && { # links for ugii files.
- cd $BASE_DIR/bin
- rm -rf ugii_env.dat ; ln -sf ../ugii/ugii_env.dat ./ugii_env.dat
- # Create link to textures dir if it exists in ugphoto.
- cd $BASE_DIR/ugii
- [ -d $BASE_DIR/ugphoto/textures -a ! -d ./textures ] && {
- rm -f ./textures 2>&- ; ln -sf ../ugphoto/textures ./textures 2>&-
- }
- }
- #
- # Special cross link for ugphoto.
- [ $PRODUCT_NAME = "UGPHOTO" -a -d $BASE_DIR/ugphoto ] && { # for ugphoto.
- # Create link to materials dir if exists in ugii but not in ugphoto.
- cd $BASE_DIR/ugphoto
- [ -d $BASE_DIR/ugii/materials -a ! -d ./materials ] && {
- rm -f materials 2>&- ; ln -sf ../ugii/materials ./materials 2>&-
- }
- }
- #
- # Custom logic for TOLSTACKUP (a.k.a TSV) sym links. Added 040P12.
- # Check if it is installed then create sym links for eai libs in ugii.
- TSV_LIBS=tolstackup/eailib # TOLSTACKUP library dir.
- [ -d $BASE/$TSV_LIBS ] && ( # Do this in a subshell so we revert to $OLDCWD
- FILELIST=$(ls $BASE/$TSV_LIBS )
- cd $BASE/ugii
- for FILE in $FILELIST ; do
- rm -rf $FILE 1>&- 2>&- # Rm old one first cuz SunOS cant do a ln -sf.
- ln -s ../$TSV_LIBS/$FILE $FILE >$NULL 2>&- || { # Create the link.
- print "${WARN}could not create symbolic link:
- \r\t`pwd`/$FILE to ../$TSV_LIBS/$FILE" >&2
- }
- done
- ) # End TOLSTACKUP stuff.
- #
- done # Done with the PRODUCT_LIST.
- cd $OLD_PWD
- } # End of Link_all_products
- Load_selected_kits() # Controls loading of kits from multiple sources (CD's.)
- { # RKB Jul 8 04 NX030P19 First iteration.
- # RKB Jul 21 04 NX030P20 Chngs to call Detect function in current shell.
- # RKB Jul 29 04 NX030P20 Chng to use Detect_missing_kits[list|test] functions.
- # RKB Aug 30 04 NX030P21a Add the Checking for selected kits message.
- #
- # Initialize flag and control variables.
- KIT_CKLIST=$FSETS # Initially set KIT_CKLIST to $FSETS.
- : ${KIT_CKLIST:?} # Internal var ck.
- unset SOURCE2 # Make sure SOURCE2 is not set yet.
- FIRST_PASS=true # Flag to control message of Ask_source2
- NO_FURTHER_MSG="No further user input required ..." # Message and flag.
- FURTHER_MSG="Further user input will be required ..." # Message.
- #
- # Control loop to copy kits from multiple sources. On the first pass, the
- # SOURCE directory will be the initial value set by Check_source.
- # The KIT_CKLIST is the kits selected by the user (FSETS) in Select_products.
- # If all the kits in KIT_CKLIST are found in SOURCE we proceed to load them
- # all with no further user input. If ANY kits are missing in the SOURCE dir
- # we prompt for a second source (SOURCE2) to look for MISSING_KITS. On the
- # first pass we can ask for SOURCE2 in advance of loading any kits so that
- # the user can walk away. If we don't get a SOURCE2 we have to ask for it
- # again after we load the first batch of kits that we found. The loop will
- # continue until all the MISSING_KITS are found and copied.
- $VECHO "${MSG}Checking for selected kits ..."
- while true ; do # Loop until all the kits are copied.
- # Call Detect_missing_kits_list to see if there are any missing kits. This
- # sets FOUND_KITS and MISSING_KITS. If none missing goto else.
- Detect_missing_kits_list $SOURCE $KIT_CKLIST
- # Test for missing kit. This is set if any kits are missing in SOURCE.
- if [ "$MISSING_KITS" ] ; then # There were some missing kits.
- # We do have some MISSING kits so display missing kits message.
- print "${NOTE}The following selected kits are not located in the source
- \r\tdirectory: $SOURCE
- \r\tkit(s): $MISSING_KITS"
- # On very 1st pass ask for 2nd source in advance of any loading kits.
- [ "$FIRST_PASS" ] && { # This is the first pass thru loop.
- if [ "$SRC_PMT2" ] ; then # 2nd src already set in env/ans file.
- print "${MSG}Using the alternate source directory specified in
- \r\tanswer file or env: $SRC_PMT2"
- SOURCE2=$SRC_PMT2 # Just use 2nd src prompt.
- else # It wasn't set so ask for it.
- Ask_source2 -initial # Ask for another source in advance.
- fi
- # We either asked for 2nd source or it was set in env or ans file.
- if [ "$SOURCE2" ] ; then # Now ck if user entered 2nd source
- # Do a quick go/no go test to see SOURCE2 has the missing kits.
- if Detect_missing_kits_test $SOURCE2 $MISSING_KITS ; then
- print "${MSG}${NO_FURTHER_MSG}"
- unset NO_FURTHER_MSG # Only want to display this msg once.
- else
- print "${MSG}${FURTHER_MSG}"
- fi
- else # We didn't get a second source, inform user it's still needed.
- print "${MSG}${FURTHER_MSG}"
- fi
- } # End of FIRST_PASS ck.
- # We do the rest on ALL passes of the loop.
- # If we have some FOUND_KITS, so copy them from SOURCE dir.
- [ "$FOUND_KITS" ] && Copy_kits $FOUND_KITS
- unset FIRST_PASS # Unset the flag after the 1st copy pass.
- # If we haven't got a 2nd source yet we must ask for it now.
- [ "$SOURCE2" ] || Ask_source2 -next || { # Returns 1 only if user quits.
- print "${WARN}The following kits were not copied: $MISSING_KITS"
- break # Break out of the while loop.
- }
- # If we didn't get a good SOURCE2 we'll keep looping back and
- # failing until a good SOURCE2 is entered. Or user quits.
- SOURCE=$SOURCE2 # Set the source dir to the new source.
- unset SOURCE2 # Unset so we ask again on next pass.
- KIT_CKLIST=$MISSING_KITS # Set kit cklist to the missing kits.
- continue # Loop back and check for MISSING_KITS.
- else # There were NO missing kits, so just do it on 1st pass like normal.
- [ "${NO_FURTHER_MSG}" ] && print "${MSG}${NO_FURTHER_MSG}"
- [ "$FOUND_KITS" ] && Copy_kits $FOUND_KITS && break
- fi
- done
- #
- [ "$MISSING_KITS" ] || print "${MSG}The selected products have been copied. "
- return 0
- #
- } # End Load_selected_kits.
- Log_var() # Simple function to log answers to an answer file.
- { # RKB created Sep 15 16:37:23 1992 for ug_install.
- [ "$L_SWT" ] || return 0 # If logging is not turned on, do nothing.
- # Require 1 global, the log file LOGFILE, Requires 1 arg, the var to log.
- : ${1:?} ; LOGVAR=$1 ; : ${LOGFILE:?}
- [ "`eval echo \\$$1`" ] || return 0 # If nothing in it, don't log it.
- print "${1}=`eval echo \\$$1` # "$2"" >> $LOGFILE
- } # End Log_var
- Make_base() # Create the base directory & some sub directories.
- { # RKB Apr 28 17:20:05 1993
- # RKB Sep 28 23:33 93 V10.1ph3L add ck for load only.
- # RKB Apr 26 16:26 94 V103P4D add chmod 555 for created dirs.
- # RKB Jan 21 02:22 96 V110P22 chng to ck REAL_BASE for /usr/$VNUM.
- # RKB May 22 00:13 98 V150P03 Updated for ugflexlm.
- # RKB Jun 29 00:11 99 V160P12 Rm cgmdef.txt, xhatch, xhatch2 & util dir.
- # RKB Nov 3 15:12 99 NX6P20 Tweaks for license_server install type.
- # RKB Mar 26 08 NX6P21 More chngs for Standalone license.
- #
- # 1 required variable
- : ${BASE_DIR:?} # Internal ck.
- [ "$INS_TYPE" = "load_only" ] && return 0 # Don't do this on load only.
- $VECHO "${MSG}$PRODNAME $NX_VER files will be installed
- \r\tinto subdirectories of: $BASE_DIR "
- # BASE_DIR could be a link name, get the real dir.
- REAL_BASE=`cd $BASE_DIR 2>&- ; echo pwd | csh -fs 2>&-`
- if [ "$REAL_BASE" != "/usr/ugs$VNUM" ] ; then
- [ -h /usr/ugs$VNUM ] && rm -f /usr/ugs$VNUM 2>&- # Delete the old link.
- [ -d /usr/ugs$VNUM ] && { # It's a real dir so rename it.
- $VECHO "${MSG}Saving /usr/ugs$VNUM directory
- \r\tas /usr/ugs${VNUM}.$$"
- mv -f /usr/ugs$VNUM /usr/ugs${VNUM}.$$ 2>&- ;}
- # Can't just delete it.
- ln -sf $REAL_BASE /usr/ugs$VNUM && { # Create the new ugsXXX link.
- $VECHO "${MSG}A symbolic link has been created
- \r\tfrom: /usr/ugs$VNUM
- \r\tto: $REAL_BASE" ;}
- fi
- # O.K. now check and/or create the required subdirectories.
- [ "$INS_TYPE" = "license_server" ] || { # license_servers don't need a 'bin'.
- [ -d ${BASE_DIR}/bin ] || mkdir -p ${BASE_DIR}/bin 2>&-
- chmod 555 ${BASE_DIR}/bin >$NULL 2>&-
- }
- #
- # Make ugflexlm dir if needed and copy the license file to the ugflex dir.
- [ -d ${BASE_DIR}/ugflexlm ] || mkdir -p ${BASE_DIR}/ugflexlm 2>&-
- chmod 555 ${BASE_DIR}/ugflexlm >$NULL 2>&-
- # As of NX6P21 Can't do this cp anymore cuz we're now doing standalone licenses
- # which can't be copied until after customer enters it.
- # This old cp was for the nx install license server install.
- # cp $UGF_FILE $BASE_DIR/ugflexlm >$NULL 2>&-
- #
- return 0
- } # End Make_base.
- Mod_environment_files() # Modify files that set the environment.
- { # RKB Mon Aug 13 22:20:41 PDT 1990
- # Updated Wed Oct 10 21:46:58 PDT 1990
- # RKB updated: May 12 23:45 1993 mv .ugii_env logic to new function. V10ph12g.
- # RKB May 13 23:45 1993 add ck for MODIFY_OK. V10ph12g. rm IGNORE_FPE
- # RKB May 25 23:26 1993 add IGNORE_FPE back in.
- # RKB Jun 2 14:11 1993 rm IGNORE_FPE again, and leave SB_DISPLAY_ADDR for V9.
- # RKB Jul 13 20:39 1993 V10.1 make generic
- # RKB updated: Aug 11 00:53 1993 V10.1p2 fix for variables.
- # RKB updtd: Oct 13 15:31 1993 Add SGI stuff for csh login.
- # RKB updtd: Mar 10 01:06 94 V103P2E Add ck for OSF's lack of csh.login.
- # RKB updtd: Mar 10 01:06 94 V103P2E Rm UGII_FILE_SYSTEM
- # RKB updtd: Mar 23 22:50 94 V103P3B add logic to make sample files in tmp.
- # RKB updtd: Jun 1 13:00 94 V103P6B rm UGII_TERMMOD left from Solaris 9.1S.
- # RKB updtd: Apr 17 23:40 95 V105P07 Add logic for CDE. Create_dt_xsession.
- # RKB Mar 3 17:23 98 V150P01 Rm ACS specific logic. Rm VUE logic.
- # RKB Aug 28 06 NX050P16 Changes for new universal flexlm i.e. ugslmd.
- # RKB Jan 11 07 NX050P23 Changes for Linux profile/login mechanism.
- # RKB Jan 30 07 NX050P24 Rename nx_profile.csh to nx_login.csh.
- #
- [ -d $UGS_TMP ] || mkdir -p $UGS_TMP # Make sure ugs_tmp is there.
- #
- # Do etc profile.
- if [ -f /etc/profile ] ; then # Make sure we can find it, then save it.
- # Found the file now ck mod ok.
- if [ "$MODIFY_OK" = yes ] ; then # OK to modify system files.
- # Do the real etc profile file.
- FILENAME=/etc/profile # simple var to ease programming.
- $VECHO "${MSG}Saving $FILENAME \n\tas $UGS_TMP/profile.$$ ..."
- cp $FILENAME $UGS_TMP/profile.$$
- $VECHO "\r\tModifying ${FILENAME} ..."
- else
- # Do the sample file in tmp.
- FILENAME=$UGS_TMP/profile # simple var to ease programming.
- cp /etc/profile $FILENAME
- $VECHO "\r\tModifying profile file in $UGS_TMP ..."
- fi
- # Build the edit command file to do the actual modifications
- # 1st three are old legacy vars.
- # Next three are current vars.
- Mod_rm_old USER_ $FILENAME # delete lines with USER_ in it.
- Mod_rm_old IGNORE_FPE $FILENAME # delete IGNORE_FPE line.
- Mod_rm_old UGII_TERMMOD $FILENAME # delete UGII_TERMMOD line. (SUN)
- # Next three are current vars.
- Mod_rm_old UGII_BASE $FILENAME # delete any line with UGII_ in it.
- Mod_rm_old UGII_ROOT $FILENAME # delete any line with UGII_ in it.
- Mod_rm_old UGS_LICENSE_SERVER $FILENAME
- # Linux had to do it differently, of course! Added NX050P23
- [[ `uname` = Linux ]] && [ -d /etc/profile.d ] && {
- FILENAME=/etc/profile.d/nx_profile.sh
- [ -f $FILENAME ] || { # If not there already just create it.
- # If it exists just edit, in case it was customer customized.
- print "# UGS NX sh/bash/ksh shell profile." > $FILENAME
- }
- $VECHO "\r\tModifying ${FILENAME} ..."
- }
- Mod_etc_profile UGII_BASE_DIR $BASE_DIR $FILENAME
- Mod_etc_profile UGII_ROOT_DIR $BASE_DIR/bin/ $FILENAME
- [ "$UGF_SERVERS" ] && {
- Mod_etc_profile UGS_LICENSE_SERVER $UGF_SERVERS $FILENAME
- }
- # Now do the actual edit. If we have all the pieces.
- [ -f $FILENAME -a -f $UGS_TMP/ED.$$ ] && {
- ed - $FILENAME < $UGS_TMP/ED.$$ > /dev/null || { # Check ed worked.
- print "${ERR}unable to correctly modify ${FILENAME}. Status $?
- \r\tRestoring original ${FILENAME}." >&2
- mv -f $UGS_TMP/`basename ${FILENAME}`.$$ ${FILENAME}
- }
- rm -f $UGS_TMP/ED.$$ 2>&-
- }
- else
- print "${WARN}could not find ${FILENAME}, it must be edited manually." >&2
- fi
- #
- # Do the csh.login file.
- unset FILENAME # unset from profile.
- [ -f /etc/cshrc ] && FILENAME=/etc/cshrc # IRIX
- [ -f /etc/.login ] && FILENAME=/etc/.login # SVR4
- [ -f /etc/csh.login ] && FILENAME=/etc/csh.login # HP
- if [ -f "$FILENAME" ] ; then # Make sure we can find it, then save it.
- # Found one of the files now ck mod ok.
- if [ "$MODIFY_OK" = yes ] ; then # OK to modify system files.
- # Do the real csh file.
- $VECHO "${MSG}Saving ${FILENAME}
- \r\tas $UGS_TMP/`basename ${FILENAME}`.$$ ..."
- cp ${FILENAME} $UGS_TMP/`basename ${FILENAME}`.$$
- $VECHO "\r\tModifying ${FILENAME} ..."
- else
- # Do the sample file in tmp.
- cp $FILENAME $UGS_TMP/`basename $FILENAME`
- FILENAME=$UGS_TMP/`basename $FILENAME`
- $VECHO "\r\tModifying `basename $FILENAME` file in $UGS_TMP ..."
- fi
- # Build the edit command file to do the actual modifications
- # 1st three are old legacy vars.
- Mod_rm_old USER_ $FILENAME # delete any line with USER_ in it.
- Mod_rm_old IGNORE_FPE $FILENAME # delete any IGNORE_FPE line.
- Mod_rm_old UGII_TERMMOD $FILENAME # delete any UGII_TERMMOD line.
- # Next three are current vars.
- Mod_rm_old UGII_BASE $FILENAME # delete any line with UGII_ in it.
- Mod_rm_old UGII_ROOT $FILENAME # delete any line with UGII_ in it.
- Mod_rm_old UGS_LICENSE_SERVER $FILENAME
- # Linux had to do it differently, of course! Added NX050P23
- [[ `uname` = Linux ]] && [ -d /etc/profile.d ] && {
- FILENAME=/etc/profile.d/nx_login.csh
- # Get rid of the old obsolete name first. NX050P24
- [ -f /etc/profile.d/nx_profile.csh ] && {
- rm /etc/profile.d/nx_profile.csh > $NULL 2>&1
- }
- # If its not there already just create it.
- [ -f $FILENAME ] || { # If its not there already just create it.
- # If it exists just edit, in case it was customer customized.
- print "# UGS NX csh shell login." > $FILENAME
- }
- $VECHO "\r\tModifying ${FILENAME} ..."
- }
- # glob/noglob Disabled NX050P23
- # grep -s "^set noglob" $FILENAME >$NULL || {
- # print "set noglob " >> $FILENAME ;}
- Mod_etc_login UGII_BASE_DIR $BASE_DIR $FILENAME
- Mod_etc_login UGII_ROOT_DIR $BASE_DIR/bin/ $FILENAME
- [ "$UGF_SERVERS" ] && {
- Mod_etc_login UGS_LICENSE_SERVER $UGF_SERVERS $FILENAME
- }
- # Now do the actual edit. If we have all the pieces.
- [ -f $FILENAME -a -f $UGS_TMP/ED.$$ ] && {
- ed - $FILENAME < $UGS_TMP/ED.$$ > /dev/null || { # Check ed worked.
- print "${ERR}unable to correctly modify ${FILENAME}. Status $?
- \r\tRestoring original ${FILENAME}. " >&2
- mv -f $UGS_TMP/`basename ${FILENAME}`.$$ ${FILENAME}
- }
- rm -f $UGS_TMP/ED.$$
- }
- # glob/noglob Disabled NX050P23
- # grep "^unset noglob" $FILENAME > /dev/null || {
- # print "unset noglob " >> $FILENAME ;}
- else
- print "${WARN}could not find ${FILENAME},
- \r\tit must be edited manually." >&2
- fi
- #
- # Do the CDE 'dt/config/Xsession.d' file. If CDE is installed. Added V105P07.
- # Check for CDE by looking for a 'dt/config/Xsession.d' directory.
- unset XSESSION_DIR # Init to be safe.
- [ -d /usr/dt/config/Xsession.d ] && XSESSION_DIR=/usr/dt/config/Xsession.d
- [ -d /etc/dt/config/Xsession.d ] && XSESSION_DIR=/etc/dt/config/Xsession.d
- # Reverse order of precedence. If XSESSION_DIR not set, we don't have CDE.
- [ "$XSESSION_DIR" ] && Create_dt_xsession $XSESSION_DIR xsession.ugs
- #
- # Clean up.
- rm -f $UGS_TMP/ED.$$ 2>&- # Just in case we missed it earlier.
- return 0
- } # End of Mod_environment_files.
- Mod_etc_profile() # Check and/or add/modify the Bourne shell profile script
- { # RKB Mon Aug 13 23:21:40 PDT 1990
- # RKB Updtd: Nov 19 23:35 91
- # RKB Updtd: Mar 23 22:27 94 Use $3 for filename.
- # Check and/or add/modify the /etc/profile file.
- # Requires 3 parameters. $1=variable name $2=variable value $3=filename
- # this function simply adds commands to an 'ed' command file.
- if grep -s "^$1=" $3 > /dev/null ; then
- cat >> $UGS_TMP/ED.$$ <<-END_OF_CAT
- /^$1=/c
- $1=$2 ; export $1
- .
- w
- END_OF_CAT
- [ $? = 0 ] || {
- print "${ERR}unable to create an edit command file in '$UGS_TMP'.
- \r\tThe environment variable: $1 is not set in: $3 " >&2
- return 1 ;}
- else # Wasn't there, so just append it.
- print "$1=$2 ; export $1" >> $3
- fi
- #
- } # End of Mod_etc_profile
- Mod_etc_login() # Check and/or add/modify the C shell login script
- { # RKB Aug 13 23:21:40 PDT 1990
- # RKB Updtd: Oct 13 23:07:06 1992 fix grep line to use $1
- # RKB Updtd: Jul 13 20:53 1993 V10.1 make generic.
- # Check and/or add/modify the global csh login file.
- # this function simply adds commands to an 'ed' command file.
- # Requires 3 parameters. $1=variable name $2=variable value $3=filename
- if grep -s "setenv ${1} " $3 >$NULL ; then
- cat >> $UGS_TMP/ED.$$ <<-END_OF_CAT
- /setenv $1 /c
- setenv $1 $2
- .
- w
- END_OF_CAT
- [ $? = 0 ] || {
- print "${ERR}unable to create an edit command file in ' $UGS_TMP '.
- \r\tThe environment variable: ${1} is not set in: ${3}" >&2
- return 1 ;}
- else # Wasn't there, so just append it.
- print "setenv $1 $2" >> $3
- fi
- } # End of Mod_etc_login.
- Mod_pvision_file() # Create or modify the Product Vision Pseudo Registry file.
- { # RKB Wed Dec 1 11:21 99 Initial version. Written so PV can find UG.
- # RKB Tue Feb 27 11:41 01 V180P08 Added $UG_VER to Unigraphics string.
- #
- # The PV product does not know how to read the $UGII_BASE_DIR env var
- # or follow the symbolic link '/usr/ugs999' - so this file is created
- # to contain the path to the UG startup script.
- #
- # Requires 1 arg - the path to the ugii startup script.
- : ${1:?} # Required arg check, the path to the ugii startup script.
- #
- # The path of the Product Vision 'Pseudo Registry' file.
- PV_FILE=/ugs/installed_programs.dat # Default location.
- #
- # First see if the file is already there AND set correctly. If so we're done.
- grep '^"Unigraphics '$UG_VER'"="'${1}'"' $PV_FILE >$NULL 2>&- && return 0
- #
- # Now check if we even have permission to modifiy system files.
- [ "$MODIFY_OK" = yes ] || { # No we don't
- # So we must use a sample file in tmp.
- PV_FILE=$UGS_TMP/installed_programs.dat
- # Make the UGS_TMP dir if it's not already there.
- [ -d $UGS_TMP ] || mkdir -p $UGS_TMP >$NULL 2>&-
- } # End mod ok ck.
- #
- # Now we know we do need to do something and which file to work with.
- #
- # Now see if the file needs to be created, modified or appended to.
- if [ ! -f $PV_FILE ] ; then # Wasn't there so just create it.
- $VECHO "${MSG}Creating Product Vision file: \n\t$PV_FILE ..."
- mkdir -p $( dirname $PV_FILE ) >$NULL 2>&- # Make the dir.
- echo '[HKEY_LOCAL_MACHINE\Software\Unigraphics \c' > $PV_FILE
- echo 'Solutions\Installed Applications]' >> $PV_FILE
- echo '"Unigraphics '$UG_VER'"="'${1}'"' >> $PV_FILE
- chmod 666 $PV_FILE
- # The file was there, so check if it had any entry for Unigraphics.
- elif grep '^"Unigraphics '$UG_VER'"=' $PV_FILE >$NULL 2>&- ; then
- # True if there was some entry.
- $VECHO "${MSG}Saving $PV_FILE \n\tas $UGS_TMP/$(basename $PV_FILE).$$"
- cp $PV_FILE $UGS_TMP/$(basename $PV_FILE).$$
- $VECHO "\r\tUpdating ${PV_FILE} ..."
- # Do the ed to set it correctly.
- ed - ${PV_FILE} <<-END_OF_ED
- /"Unigraphics $UG_VER"=/c
- "Unigraphics $UG_VER"="$1"
- .
- w
- q
- END_OF_ED
- else # The file was there but there was NO Unigraphics entry - so add it.
- $VECHO "${MSG}Saving $PV_FILE \n\tas $UGS_TMP/$(basename $PV_FILE).$$"
- cp $PV_FILE $UGS_TMP/$(basename $PV_FILE).$$
- $VECHO "\r\tUpdating ${PV_FILE} ..."
- echo '"Unigraphics '$UG_VER'"="'$1'"' >> $PV_FILE
- fi
- return 0
- #
- } # End Mod_pvision_file.
- Mod_rm_old() # Requires 2 parameters. $1=variable name $2=filename
- { # Strips out any line with $1 in it.
- cp $2 ${2}.tmp
- grep -v "^$1" ${2}.tmp |grep -v "export $1" |grep -v "setenv $1" > $2
- [ -f ${2}.tmp ] && rm ${2}.tmp
- }
- Nodename_filter() # converts std in to proper Flex format for UGF_SERVERS.
- { # RKB May 06 98 V150P03 Initial version.
- # RKB May 26 98 V150P03 Partial re-write for quirks in OSF's sed.
- # RKB Jun 17 98 V150P04 Re-write to change to : separators.
- #
- # Use this function as a in-line filter. It will convert standard-in to
- # the proper format for FLEXlm. i.e. @NodeA:@NodeB ...
- # Pipe standard-in "-" thru sed.
- cat - | sed -e '
- s!^.! &!
- s!,! , !g
- s!:! !g
- s! \([0-9|A-z]\)! @\1!g
- s!@\([0-9]*@\)!\1!g
- s!@\([0-9|A-z]*/\)!\1!g
- s! *! !g
- s!^[ |,|:]*!!
- s![ |,|:]*$!!
- s! , !,!g
- s!,,*!,!g
- s! !:!g
- s!,:!,!g
- '
- return $?
- # End of sed. The steps taken, in order, were:
- # 1. Insert a space in first column.
- # 2. Insert spaces around any commas.
- # 3. Change all colons into spaces.
- # 4. Insert at-sign at begining of each word.
- # 5. Rm at-signs from words that already had at-signs. i.e. socket@node
- # 6. Rm at-signs from words that contain slash(s). i.e. a filename.
- # 7. Rm extra spaces i.e. single space it.
- # 8. Rm leading space, comma or colons.
- # 9. Rm trailing space, comma or colons.
- # 10. Rm extra spaces around commas.
- # 11. Rm any extra commas.
- # 12. Change spaces back into colons.
- # 13. Rm any extra colons we may have inserted.
- #
- } # End of Nodename_filter.
- Ping_node() # Ping nodename in arg 1 and return true or false.
- { # RKB written: Aug 5 21:01 1993 V10.1p2 separate function just for ping.
- # RKB updtd: Oct 13 13:21 1993 Add IRIX specific stuff.
- # KDS updtd: Nov 18 18:50 1994 Added IBM AIX support
- # RKB updtd: Wed Apr 20 2005 Added Linux support. NX4P11.
- # RKB Aug 29 06 NX5P16 Change ERR to a WARN.
- # test nodename supplied in arg1 using ping.
- case ${MACHINE:?} in
- HP*) ping $1 -n 2 >$NULL 2>&- && return 0 ;;
- SunOS) ping $1 >$NULL 2>&- && return 0 ;;
- IRIX*) /usr/etc/ping -c2 $1 >$NULL 2>&- && return 0 ;;
- OSF1) ping -c 2 $1 >$NULL 2>&- && return 0 ;;
- AIX) ping -c2 $1 >$NULL 2>&- && return 0 ;;
- Linux) /bin/ping -c 2 $1 >$NULL 2>&- && return 0 ;;
- esac
- # Ping Test failed.
- print "${WARN}could not ping $1 This node may not be up. \c" >&2
- sleep 3 ; return 1
- } # End Ping_node.
- Read_ugf_file() # Read the (Arg 1) FlexLM license file, to get server info.
- { # RKB Mar 3 22:26 98 V150P01 Initial version.
- # RKB May 15 14:53 98 V150P03 Streamlined version.
- #
- # 1 required arg - the filename.
- #
- # Make sure we can find it.
- [ -r ${1:?} ] || { # see if there and readable.
- print "${ERR}cannot find or cannot read: $1 \c"
- sleep 2 ; return 1
- }
- #
- # Initialize vars to be safe.
- unset I LINES SERVERS PORTS
- #
- # Print host names and socket numbers (Fields 2 & 3) of all lines that
- # contain the word SERVER/server in Field 1. Save 'em in array LINES.
- set -A LINES $( awk '$1~/^SERVER$|^server$/ {printf"%s:%0d ",$2,$4}' $1 )
- #
- # Now split the LINES into nodes and socket numbers - for future use.
- while [ ${#LINES[*]} -gt ${I:=0} ] ; do
- SERVERS[$I]=${LINES[$I]%%:*} # Masking out :* leaves hostname.
- PORTS[$I]=${LINES[$I]##*:} # Masking out *: leaves port num.
- ((I+=1)) # Increment the index.
- done
- #
- return 0 # Looks good.
- #
- } # End Read_ugf_file.
- Read_var() # Read in a variable from the env, answer file, or keyboard.
- { # RKB created: Wed Jul 29 16:47:59 PDT 1992
- # Requires 3 args, the var to read, the default & the question text.
- : ${1:?} ; READVAR=$1 ; : ${2:?} ; : ${3:?} # Req arg check.
- # Possible read control switches are D,F,Q (set in Check_switches).
- SWITCH_TEST=$READ_CONTROL_SWITCHES
- # If 2nd time asking for this var, we could be in a loop, so use retry case.
- [ "$READVAR" = "$LAST_READVAR" ] && SWITCH_TEST=retry
- case ${SWITCH_TEST:=interactive} in # If no switches, we're interactive
- interactive) # If no switches then we somehow looped.
- print "$3" ; read $READVAR
- [ -n "`eval echo \\$$READVAR`" ] || eval $READVAR=$2
- ;;
- retry) # If no switches or we somehow looped.
- [ "$Q_SWT" ] && { # A question loop in quiet mode is cause for exit.
- print "${ERR}bad answer for $READVAR caused a loop." >&2
- exit 1 ;}
- print "$3" ; read $READVAR
- [ -n "`eval echo \\$$READVAR`" ] || eval $READVAR=$2
- ;;
- d) # Take the defaults, display question.
- print "$3" ; echo $2 ; eval $READVAR=$2
- ;;
- dq) # Take the defaults, but quietly.
- eval $READVAR=$2
- ;;
- df) # Read from file and or take the defaults, display question.
- env | grep "^${READVAR}=" >$NULL 2>&- || {
- eval `grep "^${READVAR}=" $READFILE 2>&- | tail -1` ;}
- # If the var named by READVAR is not set, set it to the default.
- [ -n "`eval echo \\$$READVAR`" ] || eval $READVAR=$2
- print "$3" # echo the question
- echo `eval echo \\$$READVAR` # echo contents of var named by READVAR.
- ;;
- dfq) # Read from file and or take the defaults, but quietly.
- env | grep "^${READVAR}=" >$NULL 2>&- || {
- eval `grep "^${READVAR}=" $READFILE 2>&- | tail -1` ;}
- # If the var named by READVAR is not set, set it to the default.
- [ -n "`eval echo \\$$READVAR`" ] || eval $READVAR=$2
- ;;
- f) # Read from file and or take the defaults, but quietly.
- env | grep "^${READVAR}=" >$NULL 2>&- || {
- eval `grep "^${READVAR}=" $READFILE 2>&- | tail -1` ;}
- # If the var named by READVAR is not set, set it to the default.
- if [ -n "`eval echo \\$$READVAR`" ] ; then
- # echo the question and the contents of var named by READVAR.
- print "$3" ; echo `eval echo \\$$READVAR`
- else
- # echo the question and read in the contents of var named by READVAR.
- print "$3" ; read $READVAR
- fi
- ;;
- fq) # Read from file and or take the defaults, but quietly.
- env | grep "^${READVAR}=" >$NULL 2>&- || {
- eval `grep "^${READVAR}=" $READFILE 2>&- | tail -1` ;}
- [ -n "`eval echo \\$$READVAR`" ] || { # Must have answer or fail.
- print "${ERR}no valid answer found in: $READFILE
- \n\tcould not answer question:" >&2
- ( print "$3" ; echo ) >&2
- exit 1 ;}
- ;;
- esac
- # Set the requested variable to contents of the var named by READVAR.
- LAST_READVAR=$READVAR # Save the name of last requested variable name.
- } # End Read_var
- Rm_old_files() # Clean up old obsoleted files.
- { # RKB Sep 14 14:45:37 1992
- # RKB updtd: Jul 6 21:20 1993 V10.1.1
- # RKB updtd: Feb 17 22:53 94 V10.3P2B add unigraphics.def_default.
- # RKB updtd: Mar 10 23:39 94 V103P2E added old .pl files & menufile.grs
- # RKB updtd: Oct 13 00:18 94 V104P09 added uguser.dat & rename for ugphoto.
- # RKB updtd: Mar 7 10:54 95 V105P01 rm the old Sun 'lib' dir.
- # RKB updtd: Jun 24 13:35 98 V150P05 rm old eds_reset & rename ugflexlm.
- # RKB updtd: Jun 10 11:37 99 V160P10 Added 10.ugf_mdc
- # Requires one variable BASE_DIR
- : ${BASE_DIR:?} # Internal check.
- for FILENAME in gfem/posexe gfem/posint ugii/refile \
- ugii/Ugraf_mdc ugii/Xconsoles_mdc ugii/X0screens_mdc \
- ugii/Xconsoles ugii/menufile.grs_mdc ugii/10.ugf_mdc \
- ugii/unigraphics.def_default \
- ugii/menufile.grs_default \
- ugii/10.ugf_mdc \
- install/mdc_install install/mdc_install.dat \
- install/mdc_install.arc \
- admin/ug_reset admin/eds_reset ugii/eds_reset \
- ughelp/ughlpdoc/onhelp.pl \
- ughelp/ughlpdoc/onkeys.pl \
- ughelp/ughlpdoc/onwindow.pl \
- ufunc/uguser.dat
- do
- rm -f ${BASE_DIR}/$FILENAME >$NULL 2>&-
- rm -f ${BASE_DIR}/bin/`basename $FILENAME` >$NULL 2>&-
- done
- rm -f $BASE_DIR/*_mdc $BASE_DIR/mdc_install.* >$NULL 2>&-
- mv /tmp/mdc_tmp $UGS_TMP >$NULL 2>&-
- mv $BASE_DIR/ugrender $BASE_DIR/ugphoto >$NULL 2>&- # Added V104P09
- mv $BASE_DIR/ugflex $BASE_DIR/ugflexlm >$NULL 2>&- # Added V150P05
- # V105P01 rm the old Sun 'lib' kit. Now included in uglibs.
- rm -rf $BASE_DIR/lib/libF77 2>&- && rmdir $BASE_DIR/lib 2>&-
- } # End Rm_old_files
- Select() # RKB Select a product to load requires 1 argument.
- { # Updated for ksh arrays: Thu May 10 13:46:04 PDT 1990
- # RKB Updated: Apr 1 17:44:45 1993 V10P11.
- # RKB updtd Jul 8 00:52 1993 V10.1.1 rm swap space logic.
- # RKB updtd Jul 8 19:41 1993 NEW for V10.1 use faster ksh arithmetic.
- # RKB Jun 17 04 NX3P18 Chng FSETS logic in prep for multi CD installs.
- : ${1:?} # Required product name arg check.
- [ "`eval echo \\$$1`" ] || return 0 # If $1 is null var, don't select.
- [ "`eval echo \\${${1}[0]}`" = "$SELECTED" ] && return 0 # Already selected.
- PROD_SIZE=`eval echo \\${${1}[3]}` ; : ${PROD_SIZE:=0}
- PROD_INDEX=`eval echo \\${${1}[5]}` ; : ${PROD_INDEX:=0}
- # Subract product size from free space array.
- let FS_FREE[$PROD_INDEX]=${FS_FREE[$PROD_INDEX]}-$PROD_SIZE
- # Add product size to the needed space array.
- let FS_NEEDED[$PROD_INDEX]=${FS_NEEDED[$PROD_INDEX]}+$PROD_SIZE
- # Add product size to space required var.
- let SPACE_REQUIRED_KB=$SPACE_REQUIRED_KB+$PROD_SIZE
- eval `echo ${1}[0]=\\$SELECTED` # Mark this product selected.
- FSETS="$FSETS ${1}" # Add product name to FSETS var.
- return 0
- } # End of Select
- Select_products() # RKB Selects individual product sets.
- { # RKB Tue May 15 20:40:41 PDT 1990
- # RKB Sep 30 23:40 92 Add multiple selection logic.
- # RKB May 11 11:32 93 V100P12g.
- # RKB Jul 11 01:04 93 V101 rewrite to use indirect vars to selects.
- # RKB Nov 9 15:15 93 V102P02d changed "continue" to "load".
- # RKB Nov 11 00:03 93 V102P02d moved call to Check_space to Main.
- # RKB Mar 7 00:32 95 V105P01 Rm reqd logic for ADMIN & Sun LIB kit.
- # RKB Oct 18 23:36 95 V110P12 Cosmetic changes.
- # RKB Jan 21 02:20 96 V110P22 Add another ck for valid product number.
- # RKB Oct 16 11:20 97 V140P06 Add call to Check_kit_dependencies.
- # RKB May 5 01:21 99 V160P08 Chng to allow NOT loading UGII kit.
- # RKB Apr 15 23:20 02 V190P16 Take out use of 'tr' - HPUX 11i bug.
- # RKB Jun 17 04 NX3P18 Chng FSETS logic in prep for multi CD installs.
- #
- while true ; do # Loop thru menu and selection processs. Break exits.
- # Calculate disk space just for info on the prodmenu screen.
- let SPACE_REQUIRED_MB=${SPACE_REQUIRED_KB:=0}/1024
- # When nothing selected show zero.
- [ $SPACE_REQUIRED_MB -le 1 ] && SPACE_REQUIRED_MB=0
- Display_screen3 # Display the actual choices
- Read_var UGII_SELECTIONS load \
- "\r*\tEnter kit or option number(s): [load] \c"
- UGII_SELECTIONS=`echo $UGII_SELECTIONS | tr "," " "`
- print "\n\tProcessing selection: ${UGII_SELECTIONS} ..."
- for SELECTION in $UGII_SELECTIONS ; do
- # If the product is not selected, select it, if it is, unselect it.
- case ${SELECTION:=load} in
- [1-9]|[1-8][0-9]) # Select/Deselect individual products 1-89.
- # If the PRODUCT number SELECTION is already selected, deselect it,
- # if not, select it. The next line compares element 0 of a product
- # array named by the selected element number in the PRODUCTS array.
- # First check that selection number is even a valid product.
- [ "${PRODUCTS[$SELECTION]}" ] || continue
- # Now see if it's selected or not.
- if [ "`eval echo \\${${PRODUCTS[$SELECTION]}[0]}`" = "$SELECTED" ]
- then
- Deselect ${PRODUCTS[$SELECTION]} # Call Deselect with kit name.
- else
- Select ${PRODUCTS[$SELECTION]} # Call Select with kit name.
- fi
- ;;
- 95) Select_prod_dirs ; continue 2
- ;;
- 96) # Select required files.
- [ "${UGFLEXLM[0]}" = "$SELECTED" ] || Select UGFLEXLM
- [ "${UGII[0]}" = "$SELECTED" ] || Select UGII
- ;;
- 98) # Deselect all files, if already Deselected, does nothing.
- for KIT in ${PRODUCTS[*]} ; do
- [ "`eval echo \\${${KIT}[0]}`" = "$SELECTED" ] && Deselect $KIT
- done
- ;;
- 97) # Deselect all files, if already Selected, does nothing.
- for KIT in ${PRODUCTS[*]} ; do
- [ "`eval echo \\${${KIT}[0]}`" = "$SELECTED" ] || Select $KIT
- done
- ;;
- 99|c*|l*|L*) # Load selected files
- # Make sure we have something selected.
- # Chng grep [A-z] to [A-Z|a-z]. V060P14 for Linux.
- echo $FSETS | grep "[A-Z|a-z]" >$NULL || {
- print "${MSG}no products selected."
- sleep 2 ; continue 2
- [ "$Q_SWT" ] && { print "${ERR}no products selected." ; exit 1 ;}
- } # End empty FSETS ck.
- # Make sure required kits are selected or already loaded.
- [ "${UGFLEXLM[0]}" = "$SELECTED" -o -d $BASE_DIR/ugflexlm ] || {
- print "${MSG}UGFLEXLM not selected and not previously loaded"
- sleep 3 ; continue 2
- }
- # Make sure UG is selected or alread loaded. For FLEX Only, use
- # a different install type. V160P20.
- [ "${UGII[0]}" = "$SELECTED" -o -d $BASE_DIR/ugii ] || { # V160P08
- print "${MSG}UGII not selected and not previously loaded
- \r\tUnigraphics products will NOT run on this node. "
- sleep 3 ; continue 2
- }
- # Now check for known kit dependencies. V140P06
- Check_kit_dependencies || continue 2 # V150P08
- #
- # O.K. we passed the tests, time to check the space.
- let SPACE_REQUIRED_MB=${SPACE_REQUIRED_KB:=0}/1024
- break 2
- ;;
- q*) unset FSETS ; return 1
- ;;
- "!") echo Use ^d to return to $SCRIPTNAME ; $SHELL ; continue 2
- ;;
- "?"|h*) Help_install Select_products ; continue 2
- ;;
- p*) unset FSETS ; return 1 # wants previous menu
- ;;
- esac
- done # end multiple selection loop.
- done # End of while loop, only way out is a break statement.
- UGII_SELECTIONS=`echo $UGII_SELECTIONS | tr " " ","` # Gotta have no spaces.
- Log_var UGII_SELECTIONS "Optional Product selections"
- print "$FSETS" | tr " " "\012" | grep "INSTALL" >$NULL 2>&- || { #Added V10.2p2d
- FSETS="INSTALL $FSETS" ;} # pre-pend INSTALL if not already there.
- } # End of Select_products
- Select_prod_dirs() # Move the product directories.
- { # RKB Jan 31 23:45:43 PST 1991
- # RKB Sep 23 21:38 1993 V10.1ph3k change call to Create_dir to mkdir -p.
- # RKB updtd: Apr 26 16:30 94 V103P4D add chmod for created directories.
- # RKB Apr 15 23:20 02 V190P16 Take out use of 'tr' - HPUX 11i bug.
- while true ; do # Outer question loop. Cycle till all conditions satisfied.
- Display_selected # Display the selected products, their dirs & size.
- echo ${FS_FREE[*]} | grep "\-[0-9]" > /dev/null 2>&1 && {
- print "${WARN}the current selections MAY overflow file system(s)." >&2 ;}
- while true ; do # Product name question loop.
- print "${QUE}Enter product name to move, or <CR> when done. [done]: \c "
- read PRODUCT
- typeset -u PRODUCT=$PRODUCT
- typeset -l LC_PRODUCT=$PRODUCT
- case ${PRODUCT:=DONE} in
- ACS|INSTALL) print "${MSG}this product cannot be moved." ; continue ;;
- Q|QU|QUI|QUIT) return 1 ;;
- "?"|H|HE|HEL|HELP)
- print "${MSG}This prompt is requesting the name of one of the products
- \r\tlisted above. The product you select will moved to a new
- \r\tdestination directory and it's corresponding file system.
- \n\tYou will be prompted for destination directory."
- continue ;;
- "!") echo Use ^d to return to $SCRIPTNAME ; $SHELL ; continue 1 ;;
- D|DO|DON|DONE) echo # Cosmetic line feed.
- for PRODUCT in $CHANGED_PRODUCTS ; do
- PRODUCT_DIR=`eval echo \\${${PRODUCT}[4]}`
- [ $PRODUCT_DIR = ${BASE_DIR}/${LC_PRODUCT} ] && continue
- Create_prod_link $PRODUCT_DIR ${BASE_DIR}/${LC_PRODUCT} || {
- print "${ERR}could not sucessfully move $PRODUCT" >&2
- sleep 3 ; continue 2 ;}
- [ -d $PRODUCT_DIR ] || {
- mkdir -p $PRODUCT_DIR 2>&- || {
- print "${ERR}could not sucessfully move $PRODUCT" >&2
- rm -f $PRODUCT_DIR >$NULL 2>&-
- sleep 3 ; continue 2
- }
- chmod 555 $PRODUCT_DIR >$NULL 2>&- # in case of weird umask
- }
- done
- return 0 # Finally out of here.
- ;;
- esac
- # Now Check that the entry is a known product
- ( [ -n "`eval echo \\${${PRODUCT}[2]}`" ] ) 2>&-|| {
- print "${ERR}the name ${PRODUCT} is not a known product." >&2
- continue 1 ;}
- # Check that the entry is a valid product.
- ( [ "`eval echo \\${${PRODUCT}[2]}`" = "$PRODUCT" ] ) 2>&- || {
- print "${ERR}the name ${PRODUCT} is not a valid product." >&2
- continue 1 ;}
- # Now check that the entry is a selected product.
- ( [ "`eval echo \\${${PRODUCT}[0]}`" = "$SELECTED" ] ) 2>&- || {
- print "${ERR}the product $PRODUCT has not been selected." >&2
- continue 1 ;}
- break
- done # End of product question loop.
- #
- while true ; do # Pathname question loop.
- print "${QUE}Enter full pathname for ${PRODUCT} [help]: \c "
- read DIRNAME ; typeset -l DIRNAME=$DIRNAME
- case ${DIRNAME:=help} in
- "?"|h|he|hel|help)
- print "${MSG}Enter the full pathname that will be used for the target
- \r\tdirectory when loading ${PRODUCT}. When you enter a pathname
- \r\tother than ${BASE_DIR}/${LC_PRODUCT} a symbolic link will be
- \r\tcreated in ${BASE_DIR} to point to the new directory.
- \n\tYour entry must be a full & real pathname, i.e. no links.
- \n\tThe file systems are listed showing the amount of free disk
- \r\tspace that will be available after loading has completed.
- \n\tOnly file system that are writeable and allow root access are
- \r\tlisted. (i.e. NFS mounted systems may NOT appear on the list.)
- \n\tTo escape to the shell by enter '!'.
- \r\tTo return to the previous question enter 'q'."
- continue ;;
- "!") echo Use ^d to return to $SCRIPTNAME ; $SHELL ; continue 1 ;;
- q|qu|qui|quit) continue 2 ;;
- esac
- echo $DIRNAME | grep "^/" >$NULL 2>&- || {
- print "${ERR}the pathname: $DIRNAME must begin at the root." >&2
- continue 1 ; }
- DIRNAME=`echo $DIRNAME | sed 's/\/$//p'` # Strip any trailing slash.
- [ `basename $DIRNAME` = `echo $LC_PRODUCT` ] || { # Add prod dir name.
- DIRNAME="${DIRNAME}/$LC_PRODUCT" ; }
- Change_prod_dir $PRODUCT $DIRNAME || continue # Got info, now change dir.
- print "$CHANGED_PRODUCTS" | grep -s "${PRODUCT} " >$NULL 2>&- || {
- CHANGED_PRODUCTS="$CHANGED_PRODUCTS $PRODUCT" ;}
- continue 2 # Did the change, now back to outer loop.
- done # End of pathname question loop.
- done # End of outer loop.
- } # End of Select_prod_dirs
- Set_main_defaults() # Get or set all the possible defaults for future use.
- { # RKB Tue Apr 6 16:20:09 PDT 1993
- # RKB updtd: Aug 24 15:05 93 V10.1ph3c read ans file for defaults.
- # RKB updtd: Nov 9 22:11 93 allow use of link name for base dir prompt.
- # RKB updtd: Apr 20 11:17 94 V103P4B save initial prompts as a defaults.
- # RKB updtd: Mar 7 00:34 95 V105P01 rm ADMIN from reqd list.
- # RKB Aug 8 18:08 95 V110P04 Chng UGFF_PMT default for remote nodes.
- # RKB 06DEC95 V110P19 Correct -f logic for UGII_MODIFY_OK & remote ACS nodes.
- # RKB 23JAN96 V110P22 Chng UGII_MODIFY_OK to MODIFY_SYSTEM_FILES_OK.
- # RKB 17OCT97 V140P06 Unset ACS master & alternate when using -f.
- # RKB Mar 3 17:30 98 V150P01 Rm ACS specific logic.
- # RKB Nov 3 17:46 99 V160P20 Tweaks for license_server install type.
- # RKB Jul 13 17:12 00 V170P13 Add rev ck for BASE_PMT.
- # RKB Mar 10 13:29 03 V020P13 Add logic to check for tar.Z files.
- # RKB May 26 04 NX3P16 Add OLDSCRIPTDIR to look in original script dir.
- # RKB Jul 28 04 NX3P20 Add logic for a 2nd Source dir.
- # RKB Aug 11 04 NX3P21 Correction for logic to get BASE_PMT.
- # RKB Aug 28 06 NX050P16 Changes for new universal flexlm i.e. ugslmd.
- # RKB Dec 11 06 NX050P22 Temporaily default to client-only install.
- # RKB Feb 15 07 NX5P25 Permanently for to client-only install.
- #
- # 2 required variable: MACHINE, HOST
- : ${MACHINE:?} # Reqd var Int ck.
- : ${HOST:?} # Reqd var Int ck.
- #
- # Unset all the prompts
- unset SRC_PMT SRC_PMT2 BASE_PMT MOD_PMT OVER_PMT
- unset UGFT_PMT UGFS_PMT UGFF_PMT DAT_PMT
- #
- # If using -f get prompts out of answer file. else figure out defaults.
- if [ "$F_SWT" ] ; then
- for READVAR in UGII_INSTALL_TYPE UGII_SOURCE UGII_SOURCE2 \
- UGII_BASE_DIR_ANSWER MODIFY_SYSTEM_FILES_OK \
- FLEX_LIC_TYPE FLEX_LIC_FILE FLEX_LIC_SERVERS \
- UGII_SELECTIONS
- do
- # Ck the env then the file for each var, so env setting takes priority
- # Can't just source all of them from file cuz it would overwrite env.
- env | grep "^${READVAR}=" >$NULL 2>&- || {
- eval `grep "^${READVAR}=" $READFILE 2>&- | tail -1` ;}
- done
- #
- # Set the prompts.
- INS_TYPE=${UGII_INSTALL_TYPE:=load+configure}
- SRC_PMT=${UGII_SOURCE:=$OLDSCRIPTDIR}
- SRC_PMT2=${UGII_SOURCE2} # Added NX3P20 for multi cd's.
- BASE_PMT=${UGII_BASE_DIR_ANSWER:=help}
- MOD_PMT=${MODIFY_SYSTEM_FILES_OK:=help}
- UGFT_PMT=${FLEX_LIC_TYPE:=both}
- UGFF_PMT=${FLEX_LIC_FILE:=${BASE_PMT}/ugflexlm/ugnx4.lic}
- UGFS_PMT=${FLEX_LIC_SERVERS:=${UGS_LICENSE_SERVER:=28000@$HOST}}
- # Reformat this one for FLEXlm
- UGFS_PMT=$( print " $UGFS_PMT" | Nodename_filter )
- #
- else # Figure out internal defaults.
- # Set the default INS_TYPE
- [ "$C_SWT" ] && INS_TYPE="configure_only" || INS_TYPE="load+configure"
- #
- # Attempt to set the SRC_PMT by looking in some known places.
- # `dirname $OLDSCRIPTDIR` \
- for SRC_PMT in $SCRIPTDIR \
- $OLDSCRIPTDIR \
- `dirname $SCRIPTDIR` \
- /cdrom/ugii$VNUM \
- /CDROM/ugii$VNUM
- do
- typeset -l PRODUCT_LC # Make a lower case kit name.
- for PRODUCT in INSTALL UGFLEXLM UGII ; do # Check for base kits.
- PRODUCT_LC=$PRODUCT
- [ -f $SRC_PMT/${PRODUCT}.tar.Z -o \
- -d $SRC_PMT/$PRODUCT -o \
- -d $SRC_PMT/$PRODUCT_LC ] || {
- unset SRC_PMT
- continue 2
- }
- done
- [ "$SRC_PMT" ] && break
- done
- #
- case ${SRC_PMT:=help} in
- ".") SRC_PMT=`pwd` ;;
- "..") SRC_PMT=`cd .. ; pwd ` ;;
- esac
- #
- # Set the BASE_PMT Updated NX030P21.
- if [ -n "$UGII_BASE_DIR" -a -x "$UGII_BASE_DIR/ugii/env_print" ] ; then
- # Use UGII_BASE_DIR if its already set to this rev.
- # Get the rev of $UGII_BASE_DIR by running env_print. Updt 030P21
- UGREV=$($UGII_BASE_DIR/ugii/env_print -n 2>&- ) # Get the rev.
- UGREV=${UGREV##*[A-z| ]} # Strip leading letters or space.
- UGREV="${UGREV%%.*}" # Strip all but 1st digit.
- # Compare the 1st digits with a leading "V" added.
- if [ "V$UGREV" = "${NX_VER%%.*}" ] ; then
- BASE_PMT=$UGII_BASE_DIR
- else # If not, we fall back to the ugs$VNUM default.
- BASE_PMT=/usr/ugs$VNUM
- fi
- elif [ -h /usr/ugs$VNUM -a -d /usr/ugs$VNUM ] ; then
- # if not set check for a link then get the real dir.
- BASE_PMT=`cd /usr/ugs$VNUM ; echo pwd | /bin/csh -fs 2>&-`
- else
- # If no pre-existing var or link, just use /usr/ugs$VNUM
- BASE_PMT=/usr/ugs$VNUM
- fi
- #
- # Set the MOD_PMT
- MOD_PMT=yes
- #
- # Set the UG FLEX licensing TYPE prompt.
- # Force to client only. Flex Server install now done by
- # ugslicensing_install only.
- UGFT_PMT="client"
- #
- # Set the UGS_LICENSE_SERVER prompt.
- UGFS_PMT=${UGS_LICENSE_SERVER:="28000@$HOST"} # Chng socket NX050P16.
- #
- fi
- #
- # Final tweaks to UGFS_PMT to add socket to plain hostname. Added V160P10
- case $UGFS_PMT in
- "$HOST") UGFS_PMT="28000@$UGFS_PMT" ;;
- "@$HOST") UGFS_PMT="28000$UGFS_PMT" ;;
- esac
- #
- # Now save all the prompts as an original default for possible use
- # in resorting to defaults.
- INS_TYPE_DEF=$INS_TYPE
- SRC_PMT_DEF=$SRC_PMT
- SRC_PMT2_DEF=$SRC_PMT2 # Added NX3P20.
- BASE_PMT_DEF=$BASE_PMT
- UGFT_PMT_DEF=$UGFT_PMT
- UGFF_PMT_DEF=$UGFF_PMT
- UGFS_PMT_DEF=$UGFS_PMT
- #
- # Now re-set the UGF prompts based UGF Licensing type.
- case $UGFT_PMT in
- cli*|CLI*) UGFF_PMT=n/a ;; # Client only.
- ser*|SER*) UGFS_PMT=n/a ;; # Server only.
- esac
- #
- # Now re-set some of the prompts based on the installation type.
- case ${INS_TYPE} in
- 1|load+c*) INS_TYPE="load+configure" ;;
- 2|load_o*) INS_TYPE="load_only"
- MOD_PMT=n/a # Not modifying system files.
- UGFT_PMT=n/a # Won't be doing any FLEX setup.
- UGFS_PMT=n/a # Don't need any server names.
- UGFF_PMT=n/a # Don't need a license file.
- ;;
- 3|config*) INS_TYPE="configure_only"
- SRC_PMT=n/a # Not loading any files.
- SRC_PMT2=n/a # Not loading any files. # Added NX3P20
- ;;
- 4|license*) INS_TYPE="license_server" # V160P20
- UGFT_PMT=server # Must be a server for this install type.
- UGFS_PMT=n/a # Don't need any server names.
- esac
- return 0
- } # End Set_main_defaults.
- Start_ug() # RKB Starts or re-starts the UG processes
- { # RKB rewritten Mar 10 1993 for V10 phase 10 to use new rc.eds.xxx scheme.
- # RKB updtd: Jan 17 15:46 95 V104P23 Added new case for V10 HP-UX.
- # RKB updtd: Mar 1 12:51 95 V105P01 clean up, merge AIX & HP SVR4.
- # RKB updtd: Jun 25 11:46 98 V150P05 change for ugflexlm, use RC_LNK_DIR.
- # RKB Jul 22 01:02 98 V150P07 Correction for IBM's lack of RC_LNK_DIR.
- #
- # Requires 1 variable: MACHINE
- : ${MACHINE:?} # Reqd var int chk.
- #
- print "${MSG}Initializing NX background processes ... "
- OLDCWD=`pwd`
- case $MACHINE in
- AIX) cd /etc ; RC_LIST=rc.ugs ;; # On AIX, we only use rc.ugs.
- *) cd ${RC_LNK_DIR:?} ; RC_LIST=`ls S*rc.eds.* S*rc.ugs.* 2>&-` ;;
- esac
- #
- # Run the list of rc script(s).
- for SCRIPT in $RC_LIST ; do
- [ -x $SCRIPT ] || continue # Ck it's there & executable.
- if [ "$V_SWT" ] ; then
- ./$SCRIPT 2>&1 # Run the script with full output.
- else
- ./$SCRIPT >$NULL # Run the script but quietly.
- fi
- done
- cd $OLDCWD ; return
- } # End of Start_ug
- Size_filesystems() # Size & qualify the mounted filesystems, save to a file.
- { # RKB Thu Jan 31 23:13:24 PST 1991
- # RKB Updtd: Sep 14 15:44:26 1992 for mdc -> eds.
- # RKB Updtd: Sep 28 15:23:57 PDT 1992
- # RKB Updtd V9.1 ph 11 use bdf-awk-expr to prevent big number overflows.
- # RKB Updtd: Jun 30 11:15 93 V10.1 make generic.
- # RKB Updtd: Aug 10 23:41 93 V10.1p2 switch to 1024 byte blocks.
- # RKB updtd: Oct 13 13:21 93 Add IRIX specific stuff.
- # RKB updtd: Feb 17 22:40 94 V10.3P2B Add OSF1 specific stuff.
- # RKB updtd: Mar 8 22:28 94 V103P2E minor streamlining.
- # KDS updtd: Nov 18 18:53 94 V104 Add IBM AIX support
- # RKB updtd: Mar 1 11:06 95 V105P1. cleanup & add owner id check.
- # RKB updtd: Wed Apr 20 2005 Added Linux support. NX4P11.
- # This function is designed to run in the background. It will size
- # and qualify all the mounted file systems and write the results to a file.
- # Two required global variables.
- : ${AWK_CMD:?} # Internal check.
- : ${DF_CMD:?} # Internal check.
- #
- # Make the UGS_TMP dir if not already there.
- [ -d $UGS_TMP ] || mkdir -p $UGS_TMP >$NULL 2>&-
- #
- FS_FILE="$UGS_TMP/filesystem_info" # File name to write the results to.
- TEST_FNAME="UgsWriteTestFile678901234567890.$$" # A Test filename, 30+ chars.
- rm -f ${FS_FILE} >$NULL 2>&- # Get rid of any old ${FS_FILE}.
- #
- # Set machine specific variables for mount rpt field containing filesystem.
- case ${MACHINE:=`uname`} in
- IRIX*|OSF1) GROUP_ID=0 # Group id for 'system'.
- FILE_SYSTEMS=`mount | grep -iv "read only" | $AWK_CMD '{print $3}'`
- ;;
- AIX) GROUP_ID=0 # Group id for 'system'.
- FILE_SYSTEMS=`mount | grep -iv "ro," | $AWK_CMD 'BEGIN { getline getline } { if ( substr($1,1,1) == "/" ) { print $2 } else { print $3 } }'`
- ;;
- Linux) GROUP_ID=0 # Group id for 'system'.
- FILE_SYSTEMS=`mount | grep -iv "ro," | $AWK_CMD '{print $3}'`
- ;;
- *) GROUP_ID=3 # Group id for 'sys'.
- FILE_SYSTEMS=`mount | grep -iv "read only" | $AWK_CMD '{print $1}'`
- ;;
- esac
- #
- # Make a list of mounted filesystems and check each one.
- for FS in $FILE_SYSTEMS ; do
- touch ${FS}/$TEST_FNAME 2>&- || continue # Test if it's writeable
- # Check that owner of created file is id 0.
- [[ `ls -lon ${FS}/$TEST_FNAME | $AWK_CMD '{print $3}'` = 0 ]] || {
- rm -f ${FS}/$TEST_FNAME 2>&-
- continue
- }
- chown root ${FS}/$TEST_FNAME 2>&- || { # Test chown priviledge
- rm -f ${FS}/$TEST_FNAME 2>&-
- continue
- }
- chgrp $GROUP_ID ${FS}/$TEST_FNAME 2>&- || { # Test chgrp priviledge
- rm -f ${FS}/$TEST_FNAME 2>&-
- continue
- }
- ACTUAL_FNAME=`ls -l ${FS}/${TEST_FNAME}* 2>&- | $AWK_CMD '{print $NF}'`
- ACTUAL_FNAME=`basename $ACTUAL_FNAME`
- [ "$ACTUAL_FNAME" = "$TEST_FNAME" ] || { # Check long filenames.
- rm -f ${FS}/$TEST_FNAME 2>&-
- continue
- }
- #
- # Now get 2nd to last field of last line of machine specific "df" output.
- SPACE=`$DF_CMD $FS | tail -1 | $AWK_CMD '{printf("%d",$(NF-2))}'`
- #
- rm -f ${FS}/$TEST_FNAME 2>&- # Cleanup.
- print "${FS}\t${SPACE:=0}" >> ${FS_FILE} # Looks O.K. write it out.
- done
- #
- } # End of Size_filesystems.
- Lmstat_node() # Ck we can talk to the ugslmd daemon running on nodename in arg1.
- { # RKB Jul 9 15:33 98 V150P06
- # RKB May 4 23:28 99 V160P08 Chng to accept socket@host formatted args.
- # RKB updtd: Aug 28 06 NX050P16 Changes for new universal flexlm i.e. ugslmd.
- # RKB Aug 29 06 NX5P16 Change ERR to a WARN.
- #
- # This function is called by Test_ugf_nodenames.
- : ${1:?} # Required arg check, must be at least one arg.
- [ "$UGF_WKDIR" ] || return 0 # Couldn't find lmutil so no-op this test.
- #
- # Do the lmstat test. Set LM_LICENSE_FILE to arg1 then call lmutil.
- LM_LICENSE_FILE="$1" $UGF_WKDIR/lmutil lmstat -s ugslmd >&- || {
- print "${WARN}The ugslmd daemon did NOT respond on: $1"
- sleep 2 ; return 1
- }
- #
- # Looks like it passed, so return 0.
- return 0
- #
- } # End Lmstat_node.
- Test_ugf_nodenames() # Test the nodenames supplied as arguments.
- { # RKB May 18 16:44 98 V150P03.
- # RKB May 5 00:26 99 V160P08 Chng to allow custom socket entries.
- # RKB Oct 29 11:56 99 V160P20 Add specific check for "this_host".
- #
- # This function is called by Check_license_servers.
- #
- : ${1:?} # Required arg check, must be at least one arg.
- #
- # Init vars to be safe.
- unset SERVER BAD_NAMES BAD_PINGS BAD_TESTS
- GOOD_SERVERS=0 # Count how many good ones we find.
- #
- # Now loop through the names supplied as paramaters.
- for SERVER_ID in "$@" ; do
- #
- # SERVER_ID is full socket@host or @host format. V160P08
- # SERVER is just the host name.
- SERVER=${SERVER_ID##*@} # Mask out '@' and all to left - just leave host.
- [ "$SERVER" ] || continue 1 # If it's empty, we just had a socket num.
- #
- # Pre-screen for file names. Cant check those yet - future maybe.
- # If it either Is a file or has a "/" in the name - skip it.
- [[ "$SERVER" = *"/"* ]] || [ -f "$SERVER" ] && {
- ((GOOD_SERVERS+=1)) # Inc. the good servers counter.
- continue 1
- }
- #
- # Pre-screen for non-node locked host fields.
- case "$SERVER" in
- "this_host")
- print "${NOTE}For best performance you should change the \"SERVER\"
- \r\tentry in the license file $UGFF_PMT
- \r\tfrom \"$SERVER\" to your actual hostname \"${HOST}\". "
- ((GOOD_SERVERS+=1)) # Increment the good servers counter.
- sleep 3 ; continue 1
- ;;
- YourHost*|Yourhost*|ChangeThis*)
- print "${WARN}invalid field: $SERVER must be edited before use.
- \r\tThe installation may continue, but $SERVER must be changed
- \r\tBEFORE running Unigraphics."
- sleep 3 ; continue 1
- ;;
- esac
- #
- # O.K. Now were ready to actually check it as a nodename.
- #
- $VECHO "${MSG}Checking license server: ${SERVER} ... \c"
- #
- # Check if it's a valid hostname via etc/hosts, NIS or DNS.
- Check_hostname $SERVER || { # Set a flag if it fails.
- BAD_NAMES="$BAD_NAMES $SERVER"
- continue 1 # Cant find host, skip to next one.
- }
- #
- # Check the hostname using ping.
- Ping_node $SERVER || {
- BAD_PINGS="$BAD_PINGS $SERVER"
- continue 1 # Cant ping host, skip to next one.
- }
- #
- # If node IS the local host, set the flag and skip to next one.
- # cuz cant test local ugflex - it may not be installed yet.
- [ $SERVER = "$HOST" ] && { # True if local node.
- UGF_LOCAL_SERVER=TRUE # Flag this is a local server.
- ((GOOD_SERVERS+=1)) # Increment the good servers counter.
- continue 1 # Skip to next server name.
- }
- #
- # Check the full server_id (i.e. socket@host) using lmstat. V160P08.
- [ $SERVER_ID = $SERVER ] && SERVER_ID="@$SERVER_ID" # Add an '@" if needed.
- Lmstat_node $SERVER_ID || {
- BAD_TESTS="$BAD_TESTS $SERVER"
- continue 1 # Cant pass lmstat test, skip to next one.
- }
- #
- # Got this far, must be o.k.
- ((GOOD_SERVERS+=1)) # Increment the good servers counter.
- done
- #
- return 0
- #
- } # End Test_ugf_nodenames
- Updt_custom_files() # Passively copy and rename the customizable files.
- { # These files are only updated if not already updated. i.e. passively.
- # RKB Tue May 22 90
- # RKB May 11 23:21 93 V10ph12g. Mv Ugraf10 logic to another function.
- # RKB Jul 6 21:53 93 V1011 add lines to create links in bin.
- # RKB Feb 17 17:15 94 V103 rm logic for menufile.grs
- # RKB Apr 26 16:32 94 V103P4D add chmod 555 for ugplot dir.
- # RKB Oct 13 00:10 94 V104P09 removed logic for uguser.dat
- # RKB Jun 2 13:42 97 V130P17 Add xhatch2.chx, rm ufunc/xhatch.chx.
- # RKB Jun 20 15:18 97 V130P18 Correct typo on xhatch2.chx.
- # RKB Sep 9 13:20 97 V140P03 Remove logic for 10.ugf - obsoleted.
- # RKB Dec 2 17:14 97 V140P09 Restore logic for 10.ugf - reinstated.
- # RKB Jun 10 17:45 99 V160P11 Add logic for custom_dirs.dat_default.
- # RKB Jun 10 17:45 99 V160P11 Add logic for custom_dirs.dat_default.
- # RKB Jun 29 00:11 99 V160P12 Rm logic for cgmdef.txt, xhatch & xhatch2.
- # RKB Aug 09 00:11 99 V160P12 Rm logic for cgmdef.txt, xhatch & xhatch2.
- # RKB Aug 10 04 030P21 Rm obsolete logic for old plot queues.
- #
- OCWD=`pwd` ; cd ${BASE_DIR}
- #
- # Take care of 10.ugf
- [ -f ugii/10.ugf_default -a ! -f ugii/10.ugf ] && {
- cp ugii/10.ugf_default ugii/10.ugf ; }
- chmod 777 ugii/10.ugf 2>&- # Make sure it's read/write/exec.
- ( cd $BASE_DIR/bin ; ln -s ../ugii/10.ugf 10.ugf >$NULL 2>&- )
- #
- # Take care of blockfont.txt
- [ -f ugii/blockfont.txt_default -a ! -f ugii/blockfont.txt ] && {
- cp ugii/blockfont.txt_default ugii/blockfont.txt ; }
- chmod 777 ugii/blockfont.txt 2>&- # Make sure it's read/write/exec.
- ( cd $BASE_DIR/bin ; ln -s ../ugii/blockfont.txt blockfont.txt >$NULL 2>&- )
- #
- # Take care of custom_dirs.dat # Added V160P11
- [ -f ugii/custom_dirs.dat_default -a ! -f ugii/custom_dirs.dat ] && {
- cp ugii/custom_dirs.dat_default ugii/custom_dirs.dat ; }
- ( cd $BASE_DIR/bin ; ln -s ../ugii/custom_dirs.dat custom_dirs.dat >$NULL 2>&- )
- #
- cd $OCWD
- } # End of Updt_custom_files.
- Updt_ug_files() # Update the .ugii_env file & customer default files.
- { # These files are ALWAYS updated even if already updated. i.e. forced.
- # RKB May 12 23:39 93 extracted from Mod_environment_files. V10ph12g
- # RKB May 25 23:21 93 add handling for unigraphics.def to this function.
- # RKB Feb 17 17:28 94 V10.3P2B chng logic to for loop & add ug_metric.def
- # RKB Oct 12 00:05 94 V104P09 Added ug_cam.def & ugsmd_def.std
- # RKB Nov 16 11:46 94 V104P15 Added ugmenu.dat
- # RKB Feb 27 17:51 96 V111P03 Add logic for CAM *_default files.
- # RKB Nov 20 13:08 97 V140P08 Add logic for ug_shops.def file.
- # RKB Jun 15 16:37 99 V160P11 Rm logic for ugshops, comment out mach logic.
- # RKB Jun 20 00 V170P11 Add ug_smd.def to the list.
- # RKB Jan 10 01 V180P05 Add ug_bodydes.def to the list.
- # RKB Feb 07 01 V180P07 Add ug_modeling.def to the list.
- # RKB Jan 08 02 V190P09 Add ug_die.def to the list
- # RKB Feb 12 03 V20P11 Add ug_cae_motion.def
- # RKB Aug 10 04 030P21 Rm _default logic for a list of .def files.
- # RKB Dec 11 07 NX6P16 Change .ugii_env to ugii_env.dat.
- #
- Check_root_access ${BASE_DIR}/ugii && { # Can't do it w/o root.
- #
- # Following list of files were removed in 030P21: ug_english.def
- # ug_metric.def ug_modeling.def ug_cam.def ug_smd.def ug_die.def
- # ug_cae_motion.def ug_bodydes.def
- #
- for FILENAME in ugii_env.dat ugmenu.dat ugsmd_def.std
- do
- FILENAME=$BASE_DIR/ugii/$FILENAME # prepend the ugii directory.
- [ -f ${FILENAME} ] || $VECHO && { # Save the customer's original.
- $VECHO "${MSG}Saving ${FILENAME}
- \r\tas $UGS_TMP/`basename ${FILENAME}`.$$ ..."
- cp ${FILENAME} $UGS_TMP/`basename ${FILENAME}`.$$ 2>&-
- }
- $VECHO "\r\tUpdating ${FILENAME} ..."
- # This copy may not work on NFS clients, but it'll work on the server.
- cp ${FILENAME}_default $FILENAME >$NULL 2>&-
- done
- } # End Check_root_access check for ugii.
- #
- #
- return 0
- } # End Updt_ug_files.
- Updt_resource_files() # Update the X resource file in app-defaults.
- { # RKB May 11 23:32 93. V10ph12g. Replaces Mod_ugraf function.
- # RKB Jun 10 21:34 93. V10ph13g. Add XKeysymDB & Iview.
- # RKB Aug 11 00:56 93 V10.1ph2 rm XKeysymDB, add Ugmenu10
- # RKB Aug 23 23:24 93 V10.1p3c force replace Ugraf10 & Ugmenu10.
- # RKB Oct 7 14:25 93 V10.1p3l fix save customer Ugraf10 & Ugmenu10.
- # RKB Feb 17 23:27 94 V10.3P2B add ck for root access.
- # RKB Mar 22 23:38 94 V103P3B add copies in UGS_TMP.
- # RKB Apr 26 16:39 94 V103P4D add chmod 555 for created dirs.
- # KDS Nov 18 18:30 94 V10.4 Change filenames to uppercase for IBM
- # RKB Mar 6 23:44 95 V105P01. Merge in IBM & streamline.
- # RKB Jun 21 22:14 95 V110P01. Change Ugraf10 file to Ugraf110.
- # RKB Jun 21 23:15 95 V110P01. Rm Iview resource file. Obsoleted.
- # RKB Oct 18 22:41 95 V110P12. Add Xessu resource file.
- # RKB Oct 18 22:52 95 V110P12. Change logic to 'for' loop.
- # RKB Feb 27 17:23 96 V111P03. Change Ugraf110 to Ugraf111.
- # RKB Jul 29 14:05 96 V120P06. Change Ugraf111 to Ugraf${VNUM}.
- # RKB Feb 10 17:09 98 V140P13. Change Xessu to Xessu4.
- # RKB Jul 19 13:37 00 V170P14 Add Xessu5, rewrite to use $UPDT_LIST. Rm Iview.
- # RKB Jun 27 17:16 01 V180P16 Add Xessu6 to the list.
- # RKB Oct 31 11:51 02 V020P04 Change Ugraf$VNUM to Ugnx$FNUM.
- # RKB Aug 10 04 030P21 Rm Xessu4 and Xessu5.
- #
- # 3 required variables.
- : ${X11_DIR:?} # Internal ck.
- : ${UGS_TMP:?} # Internal ck.
- : ${FNUM:?} # Internal ck.
- #
- UPDT_LIST="Ugnx${FNUM} Ugmenu10 Xessu6" # File list. 030P21
- #
- # Either modify the system files or just put a new copy in UGS_TMP.
- if [ "$MODIFY_OK" = yes ] && Check_root_access ${X11_DIR}
- then # Installer said O.K. to modify system files. AND we have root access.
- for FILE in $UPDT_LIST ; do
- # Ck if the file is even there. If so Forcibly replace it.
- [ -f $BASE_DIR/ugii/${FILE}_default ] || continue # Not there.
- LONGNAME=$X11_DIR/app-defaults/$FILE
- # Save customer's copy if present in app-defaults.
- [ -f $LONGNAME ] && {
- $VECHO "${MSG}Saving $LONGNAME
- \r\tas $UGS_TMP/${FILE}.$$ ...\c"
- cp $LONGNAME $UGS_TMP/${FILE}.$$ 2>&-
- }
- $VECHO "${MSG}Updating $LONGNAME ..."
- cp $BASE_DIR/ugii/${FILE}_default $LONGNAME >$NULL 2>&-
- chmod 444 $LONGNAME >$NULL 2>&-
- done
- else # Didn't want to mod system files. So just make copies.
- for FILE in $UPDT_LIST ; do
- [ -f $BASE_DIR/ugii/${FILE}_default ] && {
- cp $BASE_DIR/ugii/${FILE}_default $UGS_TMP/$FILE >$NULL 2>&-
- chmod 444 $UGS_TMP/$FILE 2>&-
- }
- done
- fi
- #
- # Workaround kludge for IBM.
- if [ "${MACHINE}" = "AIX" ] # Copy xterm to ugterm for IBM
- then
- cp /usr/lpp/X11/bin/xterm $BASE_DIR/ugii/ugterm 2>&-
- chmod 555 $BASE_DIR/ugii/ugterm 2>&-
- fi
- #
- return 0
- } # End of Updt_resource_files
- # ****************************************************************************
- # MAIN ***********************************************************************
- # ****************************************************************************
- # Verify user is root
- [ `id | cut -c5` = "0" ] || {
- print "\r\tmust be root to run ${SCRIPTNAME}." ; exit 1
- }
- Check_runpath || exit 1 # Check SCRIPTDIR for '#' character.
- Check_switches # Check for command line switches.
- Set_main_defaults # Set defaults for main screen.
- # Make the UGS_TMP dir if it's not already there.
- [ -d "$UGS_TMP" ] || mkdir -p $UGS_TMP >$NULL 2>&-
- while true ; do # Outer control loop.
- Ask_main_screen || continue 1 # Ask all questions for the main screen.
- # Main screen checking # Now check all the answers.
- Check_source # Check the source directory.
- Check_base # Check the base directory.
- Check_modify_ok # Check ok to modify system files.
- if [[ "$UGFS_PMT" = *"/"* ]] ; then # Check license file or server(s).
- Check_license_file # UGFS_PMT had a slash so must be file.
- else
- Check_license_servers # Check user supplied servers. V150P03
- fi
- # Now ck if ANY error flags are set. If so, we loop.
- print "$SRC_FLAG $BASE_FLAG $MOD_FLAG $UGFS_FLAG $UGFF_FLAG" | \
- grep '\*\*\*' >$NULL && {
- print "\n\n*\tEnter CR after reading errors. \c" ; read CR
- continue 1
- } # End error flag check.
- # Size filesystems in background. Must be done after Check_base.
- $VECHO # Cosmetic line feed.
- $VECHO "${MSG}Sizing mounted File Systems ..."
- Size_filesystems &
- SIZE_FS_PID=$!
- UGII_INSTALL_TYPE=$INS_TYPE # Log INS_TYPE if -l switch.
- Log_var UGII_INSTALL_TYPE "UG Installation type"
- Make_base # Make base dir if it doesn't exist.
- # Now do the UNIQUE steps for the various installation types.
- case ${INS_TYPE} in # Now take appropriate actions based on Install type.
- load+configure) # Doing load AND config install. Install type 1.
- Kill_ug # Kill the UG daemons.
- [ "$V_SWT" ] || print "${MSG}Initializing product menu..."
- Init_fs_arrays # Init file system arrays.
- Init_prod_arrays # Init product arrays.
- # If doing a load+configure, pre-select ALL kits. V150P07.
- for KIT in ${PRODUCTS[*]} ; do
- [ "`eval echo \\${${KIT}[0]}`" = "$SELECTED" ] || Select $KIT
- done
- #
- # Allow installer to Select products to load.
- while true ; do # Select products/check space loop.
- Select_products || continue 2 # Select/Deselect products manually.
- Check_space ; RTN_CODE=$? # Check space and save the return code.
- case ${RTN_CODE:=0} in # Do not proceed till enough space.
- 0) break 1 ;; # had enough, good status, break out.
- 1) continue 1 ;; # not enough space re-sel prods.
- 2) continue 2 ;; # not enough space re-sel base dir.
- esac
- done
- Check_openfiles || continue 1 # Make sure there's no open files.
- Load_selected_kits # Process & load kits NX030P19.
- # load+configure only install continues below.
- ;;
- load_only) # Doing a load ONLY install. Install type 2.
- [ "$V_SWT" ] || print "${MSG}Initializing product menu..."
- Init_fs_arrays # Init file system arrays.
- Init_prod_arrays # Init product arrays.
- # Allow installer to Select products to load.
- while true ; do # Select products/check space loop.
- Select_products || continue 2 # Select/Deselect products manually.
- Check_space ; RTN_CODE=$? # Check space and save the return code.
- case ${RTN_CODE:=0} in # Do not proceed till enough space.
- 0) break 1 ;; # had enough, good status, break out.
- 1) continue 1 ;; # not enough space re-sel prods.
- 2) continue 2 ;; # not enough space re-sel base dir.
- esac
- done
- Check_openfiles || continue 1 # Make sure there's no open files.
- Load_selected_kits # Process & load kits NX030P19.
- print "\n\n\t${SCRIPTNAME} $INS_TYPE completed `date` "
- exit 0 # Load_only install stops here.
- ;;
- configure_only) # Doing a configure ONLY install. Install type 3.
- Kill_ug # Kill the UG daemons.
- : # No-op. Nothing else to do here - mostly shown for readability.
- # configure only install continues below.
- ;;
- esac
- # The configure only AND the load+configure installs continue from here.
- # _________________________________________________________________
- $VECHO "\n\n\tENVIRONMENT CONFIGURATION "
- [ "$V_SWT" ] || print "\n\tModifying environment files ...\c"
- Mod_environment_files # Modify the environment config files.
- Updt_ug_files # Update .ugii_env & cutomer def files.
- Updt_resource_files # Update X resource files.
- Mod_pvision_file ${BASE_DIR}/ugii/ugii # Added for Product Vision V160P22.
- $VECHO "\n\n\tFILE CONFIGURATION \n"
- [ "$V_SWT" ] || print "\n\tCreating links and custom files ...\c"
- Rm_old_files # Remove obsoleted files.
- Updt_custom_files # Passively update customizable files.
- Link_all_products # Create the appropriate soft links.
- Copy_license_file # If file, copy it. if servers no-op.
- [ "$V_SWT" ] || echo # cosmetic echo
- print "${NOTE}Some System requirements such as patch levels are NOT
- \r\tchecked by this installation. Please review the Release Letter
- \r\tinformation before running Unigraphics."
- if [ "$MODIFY_OK" = yes ] ; then
- Start_ug # Start the UG background processes.
- print "${NOTE}To implement changes, log out/in of $HOST"
- else
- print "\n${NOTE}System files were NOT modified. This node: $HOST
- \r\t is NOT yet configured to run $PRODNAME."
- fi
- # Completion message.
- print "${MSG}${SCRIPTNAME} $INS_TYPE completed `date` "
- exit 0
- done # outer control loop.
- # End of ug_install.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement