Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export UGII_BASE_DIR=/usr/ugs060 ; export UGII_BASE_DIR
- export UGII_ROOT_DIR=/usr/ugs060/bin/ ; export UGII_ROOT_DIR
- export UGS_LICENSE_SERVER=28000@blackbox ; export UGS_LICENSE_SERVER
- export LD_LIBRARY_PATH=/usr/ugs060/bin/
- #!/bin/ksh
- # *****************************************************************************
- # Copyright (c) 1994-2008 UGS. All rights reserved
- # SCCS: @(#) link_stamp ugii V6.0.0.24 06/18/08 18:41:58
- # *****************************************************************************
- # Title: ugii
- # Purpose: Shell script to start NX.
- # *****************************************************************************
- # Rev History:
- # 6.0 Ric Baxter 31JUL07 Initial NX 6.0 version taken directly from NX 5.0.
- # 6.0 Ric Baxter 20MAY08 Final NX6 version.
- # *****************************************************************************
- # Script Description:
- # This script will start Unigraphics NX on the following workstations:
- # AIX|HP-UX|Linux|SunOS
- # The operation of the script is briefly described by the following:
- # 1. Set and or check all the prerequisite environment.
- # 2. Check for optional Java runtime environment.
- # 3. Determine if Space Ball should be started.
- # 4. Check if X is running then start Unigraphics NX [and spaceball].
- # *****************************************************************************
- # *****************************************************************************
- # GLOBAL VARIABLES ************************************************************
- # *****************************************************************************
- # Unset any aliases to preclued colisions.
- unalias $(alias | cut -d= -f1 | grep ^[0-z]) 2>/dev/null # Added for AIX V160P03
- # PRE-REQUISITE ENVIRONMENT VARS. ____________________________________________
- : ${DISPLAY:?variable must be set to run ugii} # Ck DISPLAY var.
- : ${UGS_LICENSE_SERVER:?variable must be set to run UG} # Ck UGS_LICENSE_SERVER.
- # Check UGII_ROOT_DIR is set AND that it is real. # Ck UGII_ROOT_DIR.
- [ -d "${UGII_ROOT_DIR:?variable must be set to run ugii}" ] || {
- echo "ugii: \$UGII_ROOT_DIR is not a directory." ; sleep 2 ; exit 1 ; }
- : ${UGII_BASE_DIR:=`dirname $UGII_ROOT_DIR`} # BASE_DIR from ROOT_DIR.
- BASE=$UGII_BASE_DIR # Shortened name.
- export UGII_BASE_DIR UGII_ROOT_DIR # export em.
- # GENERAL SCRIPT VARS. _______________________________________________________
- CMD_LINE_ARGS=$@ # Save cmd line args.
- HOST=`uname -n` # Get the hostname.
- ERR="\n\rERROR:\t" # Error messages.
- WARN="\n\rWARNING: " # Warning messages.
- MSG="\n\t" # Normal text.
- NU=/dev/null # Linux cuz cant use 1>&-
- #
- # To skip the ug_validate test, set this variable to non-zero.
- : ${RUN_UG_VALIDATE:=1} # Default to off - don't run ug_validate. V190P04
- #
- # Directory containing the UG Shared Libraries.
- UGLIBS=$BASE/ugii # Rm uglibs dir V2.0P06
- UGRAF_IMAGE=ugraf # Default name of ugraf image. NX4P20.
- # PLATFORM SPECIFIC VARS. ____________________________________________________
- case `uname` in # Set system dependent variables
- AIX) # IBM platform.
- export PATH=.:/usr/bin:/usr/sbin:/usr/ucb:/bin:/usr/bin/X11:/sbin:$PATH
- X11_DIR=/usr/bin/X11 # X11 directory for this system.
- #
- # Set the LIBPATH, for the UG shared libraries.
- if [ -z "$LIBPATH" ] ; then # It's NOT set so set it.
- LIBPATH=/usr/lib:$UGLIBS
- else # It was set. Check it & prepend UGLIBS if not found.
- echo $LIBPATH | grep "$UGLIBS" 1>$NU 2>$NU || {
- LIBPATH=$UGLIBS:$LIBPATH ;}
- fi
- #
- # JAVA specific env vars for AIX. Added NX4P20.
- # On AIX we only need to set LIBPATH.
- #
- # Check the env first, then if needed call env_print to read .ugii_env file.
- # AIX splits it's libraries into 2 dirs so both dirs need to be used.
- # UGII_JVM_LIBRARY_DIR & UGII_JVM_LIBRARY_DIR2 should contain the platform
- # specific Java runtime libs.
- : ${UGII_JVM_LIBRARY_DIR:=$(
- $BASE/ugii/env_print UGII_JVM_LIBRARY_DIR 2>$NU) }
- : ${UGII_JVM_LIBRARY_DIR2:=$(
- $BASE/ugii/env_print UGII_JVM_LIBRARY_DIR2 2>$NU) }
- #
- # Check that UGII_JVM_LIBRARY_DIR and UGII_JVM_LIBRARY_DIR2 are both valid
- # dirs then add them to LIBPATH. NX4P23
- # Tweak -d test to rm quotes. AIX Ksh fails w/quotes. NX5P25a.
- [ -d ${UGII_JVM_LIBRARY_DIR} -a -d ${UGII_JVM_LIBRARY_DIR2} ] && {
- # On IBM we need to ck LIBPATH for both of these dirs.
- #
- # Check for UGII_JVM_LIBRARY_DIR if not there prepend it. Chngd NX4P23
- echo $LIBPATH | tr ':' '\012' | \
- grep "^${UGII_JVM_LIBRARY_DIR}$" 1>$NU 2>$NU || {
- LIBPATH=${UGII_JVM_LIBRARY_DIR}:$LIBPATH
- }
- #
- # Check for UGII_JVM_LIBRARY_DIR2 if not there prepend it. Added NX4P23
- echo $LIBPATH | tr ':' '\012' | \
- grep "^${UGII_JVM_LIBRARY_DIR2}$" 1>$NU 2>$NU || {
- LIBPATH=${UGII_JVM_LIBRARY_DIR2}:$LIBPATH
- }
- #
- # Change the name of the ugraf image to ugraf_java.
- UGRAF_IMAGE=ugraf_java
- }
- #
- # NX 5.0.1.4 AIX Ksh bug adds a space to concatenated strings like LIBPATH
- # add workaround to remove spurious spaces from LIBPATH.
- LIBPATH=$(echo $LIBPATH | sed s'! !!g') # Remove spaces.
- export LIBPATH
- ;;
- HP-UX) # HP platform.
- export PATH=.:/bin:/usr/bin:/etc:/usr/contrib/bin:/usr/local/bin:$PATH
- X11_DIR=/usr/bin/X11 # X11 directory for this system.
- #
- # Set LD_LIBRARY_PATH for HPR shared libs. Changed from SHLIB_PATH V190P01.
- if [ -z "$LD_LIBRARY_PATH" ] ; then # It's NOT set so set it.
- LD_LIBRARY_PATH=/usr/lib:$UGLIBS
- else # It was set. Check it & prepend UGLIBS if not found.
- echo $LD_LIBRARY_PATH | grep "$UGLIBS" 1>$NU 2>$NU || {
- LD_LIBRARY_PATH=$UGLIBS:$LD_LIBRARY_PATH ;}
- fi
- #
- # JAVA specific env vars for HPR. Added NX4P20.
- # On HPR we need to set LD_PRELOAD_ONCE var.
- #
- # Check the env first, then if needed call env_print to read .ugii_env file.
- # UGII_JVM_LIBRARY_DIR should contain platform specific Java runtime libs.
- : ${UGII_JVM_LIBRARY_DIR:=`$BASE/ugii/env_print UGII_JVM_LIBRARY_DIR 2>$NU`}
- # UGII_JSIG_LIB is an explicit list of Java signal handler(s).
- : ${UGII_JSIG_LIB:=$($BASE/ugii/env_print UGII_JSIG_LIB 2>$NU)}
- #
- # Added NX050P19. More HP Specific libraries.
- # UGII_JAVA_RUNTIME_LIBDIR ensures that all java libraries are able to be
- # demand loaded to ensure proper program execution. e.g, the swing libs.
- : ${UGII_JAVA_RUNTIME_LIBDIR:=$(
- $BASE/ugii/env_print UGII_JAVA_RUNTIME_LIBDIR 2>$NU )}
- # Make sure it got set, and it really exists, then append to library path.
- [ -n "$UGII_JAVA_RUNTIME_LIBDIR" -a -d "$UGII_JAVA_RUNTIME_LIBDIR" ] && {
- LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$UGII_JAVA_RUNTIME_LIBDIR"
- }
- #
- # Check that UGII_JVM_LIBRARY_DIR is a valid dir AND that UGII_JSIG_LIB
- # is a valid list of file(s). Only first file is checked.
- [ -d "${UGII_JVM_LIBRARY_DIR}" ] && [ -r "${UGII_JSIG_LIB%%:*}" ] && {
- # Sanity check both vars even if both vars are not actually used.
- # Check if the PRELOAD var is set. Then prepend to it or just set it.
- if [ "$LD_PRELOAD_ONCE" ] ; then # Already set so prepend to it.
- LD_PRELOAD_ONCE="${UGII_JSIG_LIB}:$LD_PRELOAD_ONCE"
- else # Not set so just set it.
- LD_PRELOAD_ONCE=$UGII_JSIG_LIB
- fi
- }
- #
- export LD_LIBRARY_PATH LD_PRELOAD_ONCE
- ;;
- Linux) # Linux Wed Apr 13 17:19:36 PDT 2005
- alias -x echo="print" # Linux echo cant do esc chars.
- export PATH=.:/bin:/usr/bin:/usr/sbin:/usr/contrib/bin:${PATH}
- #
- X11_DIR=/usr/bin/X11 # Directory for X11 executables.
- #
- # Temporary setting for early Linux phases.
- export LC_CTYPE=C
- #
- # Set LD_LIBRARY_PATH for Linux shared libs.
- if [ -z "$LD_LIBRARY_PATH" ] ; then # It's NOT set so set it.
- LD_LIBRARY_PATH=/usr/lib:$UGLIBS
- else # It was set. Check it & prepend UGLIBS if not found.
- echo $LD_LIBRARY_PATH | grep "$UGLIBS" 1>$NU 2>$NU || {
- LD_LIBRARY_PATH=$UGLIBS:$LD_LIBRARY_PATH ;}
- fi
- #
- # JAVA specific env vars for Linux. Added NX4P20.
- # On Linux set both LD_LIBRARY_PATH and LD_PRELOAD.
- #
- # Check the env first, then if needed call env_print to read .ugii_env file.
- # UGII_JVM_LIBRARY_DIR and UGII_JVM_LIBRARY_DIR2 should contain platform
- # specific Java runtime libs.
- [ "${UGII_JVM_LIBRARY_DIR2}" ] || { # If not set in env call env_print.
- UGII_JVM_LIBRARY_DIR2=$($BASE/ugii/env_print UGII_JVM_LIBRARY_DIR2 2>$NU)
- }
- # UGII_JSIG_LIB is an explicit list of Java signal handler(s).
- : ${UGII_JSIG_LIB:=$($BASE/ugii/env_print UGII_JSIG_LIB 2>$NU)}
- #
- # Check that UGII_JVM_LIBRARY_DIR2 is a valid dir AND that UGII_JSIG_LIB
- # is a valid list of file(s). Only first file is checked.
- [ -d "${UGII_JVM_LIBRARY_DIR2}" ] && [ -r "${UGII_JSIG_LIB%%:*}" ] && {
- # Linux splits its libs into a dir & a subdir. It needs the parent dir
- # (UGII_JVM_LIBRARY_DIR2) added to the LD_LIBRARY_PATH. Added NX4P22
- # UGII_JVM_LIBRARY_DIR still needs to be set but is not added to
- # to the LD_LIBRARY_PATH. NX4P22.
- # Check LD_LIBRARY_PATH for UGII_JVM_LIBRARY_DIR2 if not there prepend it.
- echo $LD_LIBRARY_PATH | grep "$UGII_JVM_LIBRARY_DIR2" 1>$NU 2>$NU || {
- LD_LIBRARY_PATH=${UGII_JVM_LIBRARY_DIR2}:$LD_LIBRARY_PATH
- }
- # Check if PRELOAD var is set. Then prepend to it or just set it.
- if [ "$LD_PRELOAD" ] ; then # Already set so prepend to it.
- LD_PRELOAD="${UGII_JSIG_LIB}:$LD_PRELOAD"
- else # Not set so just set it.
- LD_PRELOAD=$UGII_JSIG_LIB
- fi
- }
- #
- export LD_LIBRARY_PATH LD_PRELOAD
- ;;
- SunOS) # Sun platform.
- export PATH=.:/sbin:/usr/sbin:/usr/bin:/bin:/etc:$PATH
- X11_DIR=/usr/openwin/bin # X11 directory for this system.
- #
- # Sun specific keyboard variable.
- [ "${UGII_KEYBOARD_TYPE}" ] || {
- case `uname -m` in # Workaround for broken "kbd" command
- sun4c) export UGII_KEYBOARD_TYPE="sun_model4" ;; # sparc2/ipx
- sun4m|*) export UGII_KEYBOARD_TYPE="sun_model5" ;; # sparc10 or future.
- esac
- }
- # Special workaround to prempt conflicts with new SUN 64 Bit LIB PATH var.
- unset LD_LIBRARY_PATH_64 # V190P21.
- #
- # Set the LD_LIBRARY_PATH, for the UG shared libraries.
- if [ -z "$LD_LIBRARY_PATH" ] ; then # It's NOT set so set it.
- LD_LIBRARY_PATH=/usr/lib:$UGLIBS
- else # It was set. Check it & prepend UGLIBS if not found.
- echo $LD_LIBRARY_PATH | grep "$UGLIBS" 1>$NU 2>$NU || {
- LD_LIBRARY_PATH=$UGLIBS:$LD_LIBRARY_PATH ;}
- fi
- #
- # JAVA specific env vars for SUN. Added NX4P20.
- # On SUN we only need to set LD_PRELOAD_64.
- #
- # Check the env first, then if needed call env_print to read .ugii_env file.
- # UGII_JVM_LIBRARY_DIR should contain platform specific Java runtime libs.
- : ${UGII_JVM_LIBRARY_DIR:=`$BASE/ugii/env_print UGII_JVM_LIBRARY_DIR 2>$NU`}
- # UGII_JSIG_LIB is an explicit list of Java signal handler(s).
- : ${UGII_JSIG_LIB:=$($BASE/ugii/env_print UGII_JSIG_LIB 2>$NU)}
- #
- # Check that UGII_JVM_LIBRARY_DIR is a valid dir AND that UGII_JSIG_LIB
- # is a valid list of file(s). Only first file is checked.
- [ -d "${UGII_JVM_LIBRARY_DIR}" ] && [ -r "${UGII_JSIG_LIB%%:*}" ] && {
- # Sanity check both vars even if both vars are not actually used.
- # Check if the PRELOAD var is set. Then prepend to it or just set it.
- if [ "$LD_PRELOAD_64" ] ; then # Its set so prepend.
- LD_PRELOAD_64="${UGII_JSIG_LIB}:$LD_PRELOAD_64"
- else # Not set so just set it.
- LD_PRELOAD_64=$UGII_JSIG_LIB
- fi
- }
- #
- export LD_LIBRARY_PATH LD_PRELOAD_64
- ;;
- *) echo "${ERR}`uname` not supported by this script." >&2 ; exit 5
- ;;
- esac
- # *****************************************************************************
- # FUNCTION DEFINITIONS ********************************************************
- # *****************************************************************************
- Run_ug_validate() # Run the ug_validate program to check customer defaults.
- { # RKB Mar 3 13:58 95 V105P01
- # Run ug_validate it hasn't been turned off with the flag.
- [ "${RUN_UG_VALIDATE}" = 0 ] || return 0 # Turned off so return.
- # Make sure ug_validate is there and executable.
- [ -x ${UGII_BASE_DIR}/ugii/ug_validate ] || {
- echo "${ERR}${UGII_BASE_DIR}/ugii/ug_validate not found, or not executable
- \n\t\tPress <Return> to continue \c"
- read CR ; return 1
- }
- # Check unigraphics definition file.
- ${UGII_BASE_DIR}/ugii/ug_validate 1>$NU 2>$NU || {
- echo "${ERR}NX definitions file defined by the variable
- \r\tUGII_DEFAULTS_FILE in the '.ugii_env' file did NOT pass validation.
- \r\tCorrect this file and verify using: 'ug_validate' or 'ugmenu'.
- \n\t\tPress <Return> to continue \c"
- read CR ; return 1
- }
- return 0
- } # End Run_ug_validate.
- # *****************************************************************************
- # MAIN ************************************************************************
- # *****************************************************************************
- # Runtime checks. _____________________________________________________________
- # Check that we have X running.
- ${X11_DIR}/xset -q 1>$NU 2>$NU || { # Error if Xm window not running..
- echo "${ERR}unable to start NX.
- \r\tCheck: X windows is running, $DISPLAY is valid,
- \r\tand X display has been authorized on ${DISPLAY}.
- \n\t\tPress <Return> to continue \c" ; read CR
- exit 1
- }
- # Check that the ugraf image is there and executable.
- [ -x ${UGII_BASE_DIR}/ugii/$UGRAF_IMAGE ] || {
- echo "${ERR} ugraf was not found, or was not executable
- \n\t\tPress <Return> to continue \c" ; read CR ; exit 1
- }
- # Run ug_validate it hasn't been turned off with the flag.
- [ "${RUN_UG_VALIDATE}" = 0 ] && { Run_ug_validate || exit 1 ;}
- # Final startup. _____________________________________________________________
- # Give a starup message.
- echo "\n Starting NX ... \n"
- # Check for and run Spaceball or Magellan (a.k.a. SpaceMouse).
- # Check if any one of the spaceball/magellan device files is there. AND
- # the magellan script is present, if so, then run it.
- [ -c /dev/spaceball -o -c /dev/smouse -o -c /dev/magellan ] && {
- # Make sure the script is there, then run it.
- [ -x ${UGII_BASE_DIR}/ugii/magellan.ksh ] && {
- ${UGII_BASE_DIR}/ugii/magellan.ksh 2>$NU
- }
- }
- echo "\n Starting UGRAF ... \n"
- # Now START the ugraf image with the command line arguments.
- ${UGII_BASE_DIR}/ugii/$UGRAF_IMAGE "${@}"
- # After ugraf, check for a "-d" debug switch. If so, pause after execution.
- echo $CMD_LINE_ARGS | tr " " "\012" | grep ' \-d' 1>$NU 2>$NU && {
- echo "\n\t\tPress <Return> to continue \c" ; read CR ; exit 1
- }
- exit 0 # All done.
- # END ************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement