Advertisement
Guest User

Untitled

a guest
May 29th, 2012
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 159.33 KB | None | 0 0
  1. #!/bin/ksh
  2. # *****************************************************************************
  3. # Copyright (c) 1989-2008
  4. # UGS. All rights reserved
  5. # SCCS: @(#) link_stamp ug_install V6.0.0.24 06/18/08 18:39:54
  6. # *****************************************************************************
  7. # Title: ug_install
  8. # Purpose: To install NX on Unix workstations.
  9. # *****************************************************************************
  10. # Rev History:
  11. # 6.0.0.7 Ric Baxter 31JUL07 Initial NX 6.0 version taken directly from NX 5.0.
  12. # 6.0.0.12 Ric Baxter 02OCT07 Phase 12. no changes.
  13. # 6.0.0.14 Ric Baxter 30OCT07 Tweaks to Select_products for Linux problem.
  14. # 6.0.0.16 Ric Baxter 11DEC07 Added NXASSEMBLY kit dependency logic.
  15. # 6.0.0.16 Ric Baxter 11DEC07 Change .ugii_env file to ugii_env.dat.
  16. # 6.0.0.19 Ric Baxter 21FEB08 Changes to support standalone license file.
  17. # 6.0.0.21 Ric Baxter 25MAR08 More chngs for Standalone license file support.
  18. # 6.0.0.24 Ric Baxter 20MAY08 Final NX6 version.
  19. # *****************************************************************************
  20.  
  21.  
  22.  
  23. # *****************************************************************************
  24. # GLOBAL VARIABLES ************************************************************
  25. # *****************************************************************************
  26.  
  27.  
  28. # Unset any aliases to preclued colisions.
  29. unalias $(alias | cut -d= -f1 | grep ^[0-z]) 2>&- # Add grep for AIX V160P18
  30. print "initializing ...\c" # Put out a simple startup message.
  31. CMD_LINE_ARGS=$* # Immediately save any cmd line args.
  32. PRODNAME="NX" # The product this script installs.
  33. NX_VER="V6.0" # New NX style Alpha-numeric version.
  34. UG_VER="V24.0" # Old UG style Alpha-numeric version.
  35. VNUM="060" # Numeric-only version.
  36. FNUM="6" # Simple Numeric version for filenames.
  37. SCRIPTNAME=`basename $0` # Script name without the directory.
  38. SCRIPTDIR=$(cd $(dirname $0) ; pwd) # Get an absolute path to the script.
  39. CWD=`pwd` # Preserve current directory name.
  40. HOST=$(uname -n 2>&- || hostname 2>&-) # Try 'hostname' if uname -n fails.
  41. NULL=/dev/null # Global for Linux cuz cant use 1>&-
  42.  
  43. # Standardized text message and screen variables.
  44. NOTE="\n NOTE: " ; ERR="\nERROR: " ; WARN="\nWARNING: "
  45. MSG="\n " ; QUE="\n* " ; TAB=" "
  46. FILL_TXT="______________________________________" # Forms inter-field filler.
  47. REENTER=" *****> " # Forms re-enter flag.
  48. SELECTED="-->" # Product selected flag
  49. UNSELECTED="no" # Product unselected flag
  50.  
  51. # Set machine dependant variables.
  52. MACHINE=`uname` # Save machine var. for future use.
  53. REV=`uname -r` # Save the revision of the OS.
  54. case $MACHINE in
  55. AIX) # Machine type AIX.
  56. PATH=/usr/bin:/etc:/etc/yp:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/etc:.
  57. export PATH # Set the PATH
  58. UGS_TMP=/tmp/ugs_tmp # Define tmp dir for old files.
  59. X11_DIR=/usr/lib/X11 # X11 directory for this system.
  60. PS_CMD="ps -ef" # ps command for this system.
  61. AWK_CMD=awk # awk command for this system.
  62. DF_CMD="df -I" # df command for this system.
  63. RC_DIR=/etc # Dir for real rc scripts.
  64. RC_LNK_DIR="" # Not used on IBM.
  65. TMP_DIR=/tmp # Tmp directory.
  66. LPATH_VAR_NAME=LIBPATH # Library path var name. V160P14
  67. RC_PATH_VAR=/usr/bin:/etc:/usr/sbin:/usr/ucb:/sbin:/usr/etc
  68. ;;
  69. HP-UX) # Machine type is HP
  70. # Check if the HP-UX is at least V11. test w/o leading letters or decimal.
  71. [ "${REV#*${REV%%[0-9]*}}" -lt 11 ] && { # Pre V11 no longer supported.
  72. print "${ERR} $MACHINE $REV is not supported." >&2 ; exit 1
  73. }
  74. PATH=.:/usr/sbin:/sbin:/usr/bin:/usr/ccs/bin:/usr/contrib/bin
  75. RC_DIR=/sbin/init.d # Dir for real rc files
  76. RC_LNK_DIR="/sbin/rc3.d" # Dir links to rc files. Chngd V120P10
  77. RC_PATH_VAR=/usr/sbin:/sbin:/usr/bin
  78. UGS_TMP=/tmp/ugs_tmp # Define a tmp area for old files.
  79. X11_DIR=/usr/lib/X11 # X11 directory for this system.
  80. AWK_CMD=awk # awk command for this system.
  81. DF_CMD=bdf # df command for this system.
  82. PS_CMD="ps -ef" # ps command for this system.
  83. TMP_DIR=/tmp # Tmp directory.
  84. LPATH_VAR_NAME=SHLIB_PATH # Library path var name. V160P14
  85. ;;
  86. Linux) # Machine type Linux
  87. PATH=.:/sbin:/usr/sbin:/usr/bin:/bin:/etc ; export PATH # Set the PATH
  88. UGS_TMP=/tmp/ugs_tmp # Define a stash area for old files.
  89. X11_DIR=/usr/lib/X11 # X11 directory for this system.
  90. PS_CMD="ps -ef" # ps command for this system.
  91. DF_CMD="df -k" # df command for this system.
  92. AWK_CMD=awk # awk command for this system.
  93. RC_DIR=/etc/rc.d # Dir for real rc scripts
  94. RC_LNK_DIR=/etc/rc.d/rc5.d # Dir for links to rc scripts
  95. TMP_DIR=/tmp # Tmp directory.
  96. LPATH_VAR_NAME=LD_LIBRARY_PATH # Library path var name. V160P14
  97. RC_PATH_VAR=/sbin:/usr/sbin:/usr/bin:/bin:/etc
  98. alias -x pwd='pwd -L' # Tweak Linux pwd to give logical pwd.
  99. alias -x uncompress=gunzip # On SuSE 10 must use gunzip. NX050P24
  100. ;;
  101. SunOS) # Machine type SUN.
  102. case $REV in
  103. 5*) # OS is Solaris.
  104. PATH=.:/sbin:/usr/sbin:/usr/bin:/bin:/etc ; export PATH # Set the PATH
  105. UGS_TMP=/var/tmp/ugs_tmp # Define a stash area for old files.
  106. X11_DIR=/usr/openwin/lib # X11 directory for this system.
  107. PS_CMD="ps -ef" # ps command for this system.
  108. DF_CMD="df -k" # df command for this system.
  109. AWK_CMD=nawk # awk command for this system.
  110. RC_DIR=/etc/init.d # Dir for real rc scripts
  111. RC_LNK_DIR="/etc/rc3.d" # Dir for links to rc scripts
  112. TMP_DIR=/var/tmp # Tmp directory.
  113. LPATH_VAR_NAME=LD_LIBRARY_PATH # Library path var name. V160P14
  114. RC_PATH_VAR=/sbin:/usr/sbin:/usr/bin:/bin:/etc
  115. ;;
  116. *) print "${ERR} $MACHINE $REV is not supported." >&2 ; exit 1
  117. ;;
  118. esac
  119. ;;
  120. *) print "${ERR} $MACHINE is not supported." >&2 ; exit 1
  121. ;;
  122. esac
  123.  
  124.  
  125. # ****************************************************************************
  126. # FUNCTION DEFINITIONS ********************************************************
  127. # ****************************************************************************
  128.  
  129.  
  130. Ask_base_dir() # Ask where the base directory is, or where to put it.
  131. { # RKB Apr 16 12:22:54 1993 V10
  132. # RKB updtd: Nov 9 22:11 1993 Chnged to allow use of link for base dir.
  133. # RKB updtd: Mar 14 07 Add preemptive ck for subdirs of /usr/ugs$VUM.
  134. [ "$BASE_PMT" = "n/a" ] && return 1
  135. unset BASE_DIR BASE_MSG BASE_FLAG # If we ask the question, unset em.
  136. # If /usr/ugs$VNUM is a mount point we'll have trouble renaming it.
  137. [ $BASE_PMT != /usr/ugs$VNUM ] && {
  138. [ `Get_fs_info -mnt /usr/ugs$VNUM` = /usr/ugs$VNUM ] && {
  139. print "${NOTE}/usr/ugs$VNUM is a mount point,
  140. \r\tit cannot be renamed or removed."
  141. }
  142. }
  143. # Do all checking on the user's answer ANS then make it BASE_DIR.
  144. while true ; do # base dir question loop.
  145. print "${QUE}Enter full pathname for UG BASE
  146. \r\tdirectory. [$BASE_PMT]: \c"
  147. read ANS
  148. case ${ANS:=$BASE_PMT} in
  149. h|he|hel|help|H|HE|HEL|HELP|"?") Help_install Ask_base ; continue ;;
  150. !) print "Use ^d to return to $SCRIPTNAME" ; $SHELL ; continue ;;
  151. q|qu|qui|quit|Q|QU|QUI|QUIT) return 1 ;;
  152. /usr/ugs$VNUM/*) # Preemptive check for subdirs of /usr/$VNUM. NX5P25a.
  153. print "${NOTE}Cannot enter a subdirectory of /usr/ugs$VNUM
  154. \r\tThat directory name is a reserved pathname with an expected
  155. \r\ttree structure used by other programs and scripts.
  156. \n\tYou may use /usr/ugs$VNUM or another directory, but not a
  157. \r\tsubdirectory of /usr/ugs$VNUM."
  158. continue 1
  159. ;;
  160. esac
  161. # Make sure full path was entered.
  162. print "$ANS" |grep "^/" >$NULL 2>&- || {
  163. print "\n\tPlease enter a full pathname, starting at the root."
  164. continue 1
  165. }
  166. #
  167. # If ans is different from prompt unset flags, cuz user made a change.
  168. [ "$ANS" = "$BASE_PMT" ] || {
  169. unset OVERWRITE_OK OVER_FLAG BASE_FLAG BASE_MSG ;}
  170. #
  171. # If answer is a link, check that it points to a valid directory.
  172. [ -h $ANS ] && { # If answer is a link make sure it's valid.
  173. if [ -d $ANS ] ; then
  174. REAL_BASE=`cd $ANS 2>&- ; echo pwd | csh -fs 2>&-`
  175. print "${MSG}NOTE: $ANS is a symbolic link to: $REAL_BASE \c"
  176. # Next line disabled V10.2ph2d. to stop switching to real dir.
  177. # ANS=$REAL_BASE # This line switches the action of the script.
  178. sleep 3
  179. else
  180. print "${ERR}${ANS} does NOT point to a real directory." >&2
  181. continue # Directory was bogus, continue.
  182. fi
  183. }
  184. #
  185. # Passed the easy tests, set the var & leave.
  186. BASE_PMT=$ANS
  187. return 0
  188. done # end question loop.
  189. } # End Ask_base_dir
  190.  
  191.  
  192.  
  193. Ask_install_type() # Ask the install type question and set defaults accordingly.
  194. { # RKB Wed Apr 7 11:25 1993
  195. # RKB rewrite: Aug 6 14:07 1993 V10.1p2 submenu to main screen.
  196. # RKB updtd: Apr 20 12:16 94 V103P4B no default reset; ck interdependencies.
  197. # RKB Jul 22 00:10 98 V150P07 Add dependency ck for UGFT_PMT.
  198. # RKB Sep 23 17:25 99 V160P18 Partial re-write for license-only install type.
  199. # RKB Nov 2 11:34 99 V160P20 Add License Server install type.
  200. # RKB Jan 12 07 NX5P24 Rm license server only option.
  201. while true ; do # question loop.
  202. print "${MSG}1) Load files AND configure system.
  203. \r\t2) Load files only. Do NOT configure system.
  204. \r\t3) Configure only. Do NOT load any files. "
  205. # Now ask the question.
  206. print "${QUE}Enter type of UG installation to perform: [1] \c"
  207. read ANS
  208. case ${ANS:=1} in
  209. 1) INS_TYPE="load+configure"
  210. # Re-store these to last value or default, if not set.
  211. [ "$SRC_PMT" = "n/a" ] && SRC_PMT=$SRC_PMT_OLD
  212. [ "$SRC_PMT" = "n/a" ] && SRC_PMT=$SRC_PMT_DEF
  213. [ "$SRC_FLAG" ] && unset SRC_FLAG SRC_MSG SOURCE
  214. #
  215. [ "$BASE_PMT" = "n/a" ] && BASE_PMT=$BASE_PMT_OLD
  216. [ "$BASE_PMT" = "n/a" ] && BASE_PMT=$BASE_PMT_DEF
  217. [ "$BASE_FLAG" ] && unset BASE_FLAG BASE_MSG BASE
  218. #
  219. [ "$MOD_PMT" = "n/a" ] && MOD_PMT=$MOD_PMT_OLD
  220. [ "$MOD_PMT" = "n/a" ] && MOD_PMT=$MOD_PMT_DEF
  221. [ "$MOD_FLAG" ] && unset MOD_FLAG MOD_MSG MODIFY_OK
  222. #
  223. [ "$UGFT_PMT" = "n/a" ] && UGFT_PMT=$UGFT_PMT_OLD # V150P03
  224. [ "$UGFT_PMT" = "n/a" ] && UGFT_PMT=$UGFT_PMT_DEF # V150P03
  225. [ "$UGFT_FLAG" ] && unset UGFT_FLAG UGFT_MSG UGF_TYPE # V150P03
  226. #
  227. break
  228. ;;
  229. 2) INS_TYPE="load_only"
  230. # Force these to n/a & unset err flags.
  231. MOD_PMT_OLD=$MOD_PMT # Save the old value.
  232. MOD_PMT=n/a ; unset MOD_FLAG MOD_MSG
  233. #
  234. UGFT_PMT_OLD=$UGFT_PMT # Save the old value. # V150P03
  235. UGFT_PMT=n/a ; unset UGFT_FLAG UGFT_MSG # V150P03
  236. #
  237. UGFS_PMT_OLD=$UGFS_PMT # Save the old value. # V150P03
  238. UGFS_PMT=n/a ; unset UGFS_FLAG UGFS_MSG # V150P03
  239. #
  240. UGFF_PMT_OLD=$UGFF_PMT # Save the old value. # V150P03
  241. UGFF_PMT=n/a ; unset UGFF_FLAG UGFF_MSG # V150P03
  242. #
  243. # Re-store these prompts if necessary
  244. [ "$BASE_PMT" = "n/a" ] && BASE_PMT=$BASE_PMT_OLD
  245. [ "$BASE_PMT" = "n/a" ] && BASE_PMT=$BASE_PMT_DEF
  246. [ "$BASE_FLAG" ] && unset BASE_FLAG BASE_MSG BASE
  247. #
  248. [ "$SRC_PMT" = "n/a" ] && SRC_PMT=$SRC_PMT_OLD
  249. [ "$SRC_PMT" = "n/a" ] && SRC_PMT=$SRC_PMT_DEF
  250. [ "$SRC_FLAG" ] && unset SRC_FLAG SRC_MSG SOURCE
  251. break
  252. ;;
  253. 3) INS_TYPE="configure_only"
  254. # Re-store these to last value or default, if not set.
  255. #
  256. [ "$BASE_PMT" = "n/a" ] && BASE_PMT=$BASE_PMT_OLD
  257. [ "$BASE_PMT" = "n/a" ] && BASE_PMT=$BASE_PMT_DEF
  258. [ "$BASE_FLAG" ] && unset BASE_FLAG BASE_MSG BASE
  259. #
  260. [ "$MOD_PMT" = "n/a" ] && MOD_PMT=$MOD_PMT_OLD
  261. [ "$MOD_PMT" = "n/a" ] && MOD_PMT=$MOD_PMT_DEF
  262. [ "$MOD_FLAG" ] && unset MOD_FLAG MOD_MSG MODIFY_OK
  263. #
  264. [ "$UGFT_PMT" = "n/a" ] && UGFT_PMT=$UGFT_PMT_OLD # V150P03
  265. [ "$UGFT_PMT" = "n/a" ] && UGFT_PMT=$UGFT_PMT_DEF # V150P03
  266. [ "$UGFT_FLAG" ] && unset UGFT_FLAG UGFT_MSG UGF_TYPE # V150P03
  267. #
  268. # Set this to n/a.
  269. SRC_PMT_OLD=$SRC_PMT # Save the old value.
  270. SRC_PMT="n/a" # No src on conf-only.
  271. unset SRC_FLAG SRC_MSG SOURCE # unset err & msg.
  272. break
  273. ;;
  274. h|he|hel|help|H|HE|HEL|HELP|"?") Help_install Ask_install_type ;;
  275. !) print "Use ^d to return to $SCRIPTNAME" ; $SHELL ;;
  276. q|qu|qui|quit|Q|QU|QUI|QUIT) return 1 ;;
  277. esac
  278. done # end question loop
  279. #
  280. # Now restore UGFF_PMT & UGFS_PMT but ONLY IF appropriate for on UGFT_PMT.
  281. case $UGFT_PMT in # If UGFT_PMT is n/a then we do nothing. # V150P07
  282. server)
  283. [ "$UGFF_PMT" = "n/a" ] && UGFF_PMT=$UGFF_PMT_OLD # V150P03
  284. [ "$UGFF_PMT" = "n/a" ] && UGFF_PMT=$UGFF_PMT_DEF # V150P03
  285. [ "$UGFF_FLAG" ] && unset UGFF_FLAG UGFF_MSG UGF_FILE # V150P03
  286. ;;
  287. client)
  288. [ "$UGFS_PMT" = "n/a" ] && UGFS_PMT=$UGFS_PMT_OLD # V150P03
  289. [ "$UGFS_PMT" = "n/a" ] && UGFS_PMT=$UGFS_PMT_DEF # V150P03
  290. [ "$UGFS_FLAG" ] && unset UGFS_FLAG UGFS_MSG UGF_SERVERS # V150P03
  291. ;;
  292. both)
  293. [ "$UGFF_PMT" = "n/a" ] && UGFF_PMT=$UGFF_PMT_OLD # V150P03
  294. [ "$UGFF_PMT" = "n/a" ] && UGFF_PMT=$UGFF_PMT_DEF # V150P03
  295. [ "$UGFF_FLAG" ] && unset UGFF_FLAG UGFF_MSG UGF_FILE # V150P03
  296. #
  297. [ "$UGFS_PMT" = "n/a" ] && UGFS_PMT=$UGFS_PMT_OLD # V150P03
  298. [ "$UGFS_PMT" = "n/a" ] && UGFS_PMT=$UGFS_PMT_DEF # V150P03
  299. [ "$UGFS_FLAG" ] && unset UGFS_FLAG UGFS_MSG UGF_SERVERS # V150P03
  300. ;;
  301. esac
  302. return 0
  303. } # End Ask_install_type.
  304.  
  305.  
  306.  
  307. Ask_main_screen() # Ask and process all the questions on screen2.
  308. { # RKB Jul 7 22:05 93 NEW for V10.1
  309. # RKB Sep 24 15:54 93 Merge in old Check_dependencies function.
  310. # RKB Apr 20 13:25 94 V103P4B add logic to save old prompts.
  311. # RKB Oct 30 01:00 95 V110P13 Added more interdependency logic.
  312. # RKB May 21 16:45 98 V150P03 Added logic for UGFLEXlm.
  313. # RKB Feb 20 08 NX6P19 Chg to allow standalone license file or server names.
  314. #
  315. # Save the old answers
  316. SRC_PMT_OLD=$SRC_PMT # Save the old source dir prompt.
  317. BASE_PMT_OLD=$BASE_PMT # Save the old base dir prompt.
  318. MOD_PMT_OLD=$MOD_PMT # Save the old Mod O.K. prompt.
  319. UGFT_PMT_OLD=$UGFT_PMT # Save the old UGF licensing Type prompt.
  320. UGFS_PMT_OLD=$UGFS_PMT # Save the old UGF licensing Servers prompt.
  321. UGFF_PMT_OLD=$UGFF_PMT # Save the old UGF licensing File prompt.
  322. #
  323. while true ; do # Ask_main_screen question loop.
  324. Display_main_screen # Display the screen.
  325. # Ask the question IF we're not using the -f or -d switch.
  326. if [ "$SKIP_MAIN_QUE" ] ; then
  327. CHOICES=continue
  328. else
  329. print "${QUE}Enter item(s) to query or change: [continue] \c"
  330. read CHOICES ; : ${CHOICES:=continue}
  331. # Sort choices in menu order to lessen interdependencies.
  332. CHOICES=`echo $CHOICES | tr "," " " | tr " " "\012" | sort -n -t:`
  333. fi
  334. # Parse thru the choices.
  335. for CHOICE in $CHOICES ; do
  336. case ${CHOICE} in
  337. q|qu|qui|quit|Q|QU|QUI|QUIT) exit 0 ;;
  338. "?"|h|he|hel|help|H|HE|HEL|HELP) Help_install Ask_main_screen ;;
  339. !) print "Use ^d to return to $SCRIPTNAME" ; $SHELL ; continue ;;
  340. 1) Ask_install_type ;;
  341. 2) Ask_source ;;
  342. 3) Ask_base_dir ;;
  343. 4) Ask_modify_ok ;;
  344. 5) Ask_ugs_servers ;;
  345. c*) unset SKIP_MAIN_QUE # Can only skip it the first time thru.
  346. return 0
  347. ;;
  348. esac
  349. #
  350. # Now check and handle interdependencies each time thru for loop.
  351. #
  352. done # End CHOICES for loop.
  353. done # End Screen2 question loop
  354. unset SKIP_MAIN_QUE # Can only skip it the first time thru.
  355. } # End Ask_main_screen.
  356.  
  357.  
  358.  
  359. Ask_modify_ok() # Ask the installer if is O.K. to modify the system files.
  360. { # RKB Jun 29 13:04 93
  361. # RKB Nov 1 13:59 94 rm ANS ck, that compared old/new ans for MOD_PMT.
  362. # RKB Apr 15 23:20 02 V190P16 Take out 'tr' for MOD_PMT - HPUX 11i bug.
  363. [ "$MOD_PMT" = "n/a" ] && return 0
  364. unset MODIFY_OK MOD_MSG MOD_FLAG
  365. while true ; do # Ask modify ok question loop.
  366. $VECHO "${MSG}System file(s) must be modified to run Unigraphics.
  367. \r\tOriginals will be saved in: $UGS_TMP with the extension: '$$'"
  368. $VECHO "\n\tNOTE: If you answer 'no' to this prompt, this node will NOT
  369. \r\tbe configured to run $PRODNAME or the UGFLEXlm daemon processes."
  370. print "${QUE}O.K. to modify system files: [$MOD_PMT] ? \c"
  371. read MODIFY_SYSTEM_FILES_OK
  372. ANS=$MODIFY_SYSTEM_FILES_OK
  373. [ "${ANS:=$MOD_PMT}" = $MOD_PMT ] || unset MOD_MSG MOD_FLAG
  374. case ${ANS:=$MOD_PMT} in
  375. !) print "Use ^d to return to $SCRIPTNAME" ; $SHELL ; continue ;;
  376. h|he|hel|help|H|HE|HEL|HELP|"?") Help_install Ask_modify_ok ; continue ;;
  377. q|qu|qui|quit|Q|QU|QUI|QUIT) return 1 ;;
  378. y*|Y*) MOD_PMT=yes ; break ;;
  379. n*|N*) MOD_PMT=no ; break ;;
  380. esac
  381. done
  382. [ -d $UGS_TMP ] || mkdir -p $UGS_TMP
  383. return 0
  384. } # End of Ask_modify_ok.
  385.  
  386.  
  387.  
  388. Ask_source() # Ask where to get the files from for loading
  389. { # RKB Apr 14 11:50:48 1993 V10
  390. # RKB updtd: Sep 16 23:20 1993 streamlining & cosmetics. V10.1p3h
  391. [ "$SRC_PMT" = "n/a" ] && return 1
  392. unset SOURCE SRC_MSG SRC_FLAG
  393. while true ; do # Do this loop til you get a good source directory.
  394. print "${QUE}Enter the $PRODNAME $NX_VER source directory [$SRC_PMT]: \c"
  395. read ANS
  396. case ${ANS:=$SRC_PMT} in
  397. h|he|hel|help|H|HE|HEL|HELP|"?") Help_install Ask_source ;;
  398. !) echo Use ^d to return to $SCRIPTNAME ; $SHELL ;;
  399. q|qu|qui|quit|Q|QU|QUI|QUIT) return 1 ;;
  400. ".") SRC_PMT=`pwd` ; return 0 ;; # Wants to load from pwd.
  401. "..") SRC_PMT=`cd .. ; pwd` ; return 0 ;; # load from parent.
  402. *) # Now do a little massaging and checking of the answer.
  403. # If ANS is NOT a remote tape. Make absolute path if necessary.
  404. echo $ANS | grep ":" >$NULL || {
  405. echo $ANS | grep "^/" >$NULL 2>&- || \
  406. ANS=`pwd`/$ANS
  407. } # Make absolute path from the pwd.
  408. SRC_PMT=$ANS
  409. return 0
  410. ;;
  411. esac
  412. done
  413. } # End Ask_source
  414.  
  415.  
  416.  
  417. Ask_source2() # Ask for a second source directory for loading files.
  418. { # RKB Jun 23 04 NX3P18 First iteration. Taken from original Ask_source.
  419. # RKB Jul 29 04 NX3P20 Add logic for SRC_PMT2 for env or ans file.
  420. # RKB Aug 30 04 NX3P21a Add check for an "." or ".." entered.
  421. #
  422. while true ; do # Do this loop til you get a good source directory.
  423. case $1 in
  424. -initial*) # We are on the first pass so ask for source2 in advance.
  425. : ${SRC_PMT2:=$SOURCE} # SRC_PMT2 set in Set_main_defaults.
  426. unset SOURCE2
  427. print "\n\tYou may enter an additional source location now, such
  428. \r\tas a second CD reader or another disk or NFS location.
  429. \n\tYou may also reuse the current source location. If so, you
  430. \r\twill later be prompted to insert the next CD."
  431. print "${QUE}Enter a new source for remaining kits or reuse the current
  432. \r\tdirectory [${SRC_PMT2}]: \c"
  433. ;;
  434. -next*) # We weren't on FIRST_PASS so ask a different question.
  435. # Calculate a reasonable source prompt.
  436. N=${SOURCE##${SOURCE%[0-9]}} # Get the last number of the SOURCE dir.
  437. : ${N:=1} ; ((N+=1)) # Make sure its at least 1 then bump it.
  438. SRC_PMT2=${SOURCE%[0-9]}$N # Construct a new source prompt.
  439. print "${QUE}Enter new source directory or enter CR when the next
  440. \r\tCD is ready [${SRC_PMT2}]: \c"
  441. ;;
  442. esac
  443. # We've displayed the appropriate prompt now check the answer.
  444. read ANS
  445. case ${ANS:=$SRC_PMT2} in
  446. h|he|hel|help|H|HE|HEL|HELP|"?") Help_install Ask_source2 ;;
  447. !) print "Use ^d to return to $SCRIPTNAME" ; $SHELL ;;
  448. q|qu|qui|quit|Q|QU|QUI|QUIT) return 1 ;;
  449. "."|"..") print "${MSG}Please enter an absolute path" ; continue ;;
  450. *) # Now do a little massaging and checking of the answer.
  451. # If ANS is NOT a remote tape. Make absolute path if necessary.
  452. echo $ANS | grep ":" >$NULL || {
  453. echo $ANS | grep "^/" >$NULL 2>&- || \
  454. ANS=`pwd`/$ANS
  455. } # Make absolute path from the pwd.
  456. # Only if answer is different from prompt do we have a new source.
  457. [ "$ANS" = "$SOURCE" ] || {
  458. SOURCE2=$ANS
  459. }
  460. SRC_PMT2=$ANS
  461. return 0
  462. ;;
  463. esac
  464. done
  465. #
  466. } # End Ask_source2
  467.  
  468.  
  469.  
  470. Ask_ugf_file() # Ask for a valid path to the UGFLEXlm license file.
  471. { # RKB Mar 4 23:40 98 V150P01 Initial version from Ask_acs_dat_file.
  472. #
  473. [ "$UGFF_PMT" = "n/a" ] && return 1 # Ck if we should be here.
  474. # Set a default if not already set.
  475. : ${UGFF_PMT:=${UGII_BASE_DIR:=${BASE_DIR}/ugflexlm/ugnx4.lic}}
  476. # Initialize flags and message vars.
  477. unset UGF_FILE UGFF_FLAG UGFF_MSG
  478. # Now ask for the license file name.
  479. while true ; do # Question loop for pathname to dat file.
  480. print "${QUE}Enter filename of the UGNX FLEXlm license
  481. \r\tfile [${UGFF_PMT}]: \c"
  482. read ANS
  483. case ${ANS:=$UGFF_PMT} in
  484. h|he|hel|help|H|HE|HEL|HELP|"?") Help_install Ask_ugf_file ;;
  485. !) print "Use ^d to return to $SCRIPTNAME" ; $SHELL ;;
  486. q|qu|qui|quit|Q|QU|QUI|QUIT) return 1 ;;
  487. /*) UGFF_PMT=$ANS ; return 0 ;;
  488. [!/]*) UGFF_PMT=`pwd`/$ANS ; return 0 ;;
  489. esac
  490. done # End license file question loop.
  491. } # Ask_ugf_file.
  492.  
  493.  
  494.  
  495. Ask_ugs_servers() # Ask the nodename of the acs master server.
  496. { # RKB Apr 29 1998 Initial version. Taken from old Ask_acs_master.
  497. # RKB Feb 20 08 NX6P19 Chg to allow standalone license file or server names.
  498. # RKB Mar 24 08 NX6P21 More chngs for Standalone license.
  499. # RKB Mar 24 08 NX6P21 Renamed from Ask_ugf_servers to Ask_ugs_servers.
  500. #
  501. [ "$UGFS_PMT" = "n/a" ] && return 1 # Ck if we should be here.
  502. # Initialize flags and message vars.
  503. unset UGF_SERVERS UGFS_FLAG UGFS_MSG
  504. # Now ask for the server names.
  505. print "${MSG}Enter server name(s) that supply licenses TO this node: $HOST
  506. \r\tOR enter a full path to a standalone license file."
  507. #
  508. while true ; do # @Nodename question loop.
  509. print "${QUE}Enter server name(s) OR a license
  510. \r\tfile.[${UGFS_PMT[*]}]: \c"
  511. read ANS
  512. case ${ANS:=${UGFS_PMT[*]}} in
  513. q|qu|qui|quit|Q|QU|QUI|QUIT) return 1 ;;
  514. h|he|hel|help|H|HE|HEL|HELP|"?") Help_install Ask_ugs_servers ;;
  515. !) print "Use ^d to return to $SCRIPTNAME" ; $SHELL ;;
  516. "."*|".."*) print "${MSG}Please enter an absolute path" ; continue ;;
  517. /*) UGFS_PMT=$ANS ; return 0 # Ans checked in Check_license_file.
  518. ;;
  519. */*) # If it has a slash in it, it must be a filename.
  520. echo $ANS | grep "^/" >$NULL 2>&- || UGFS_PMT=`pwd`/$ANS # Make abs.
  521. return 0 # Ans checked in Check_license_file.
  522. ;;
  523. *) # Must be a nodename. Convert to proper format, using Nodename_filter.
  524. UGFS_PMT=$( print " $ANS" | Nodename_filter )
  525. return 0
  526. ;;
  527. esac
  528. done
  529. } # End of Ask_ugs_servers
  530.  
  531.  
  532.  
  533. Change_prod_dir() # Change the directory & file system for individual products.
  534. { # RKB Tue Jan 29 15:51:01 PST 1991
  535. # Requires two args. The PRODUCT name and new directory for the PRODUCT.
  536. PRODUCT=$1 ; : ${PRODUCT:?} # Required arg internal check.
  537. NEW_DIR=$2 ; : ${NEW_DIR:?} # Required arg internal check.
  538. PROD_SIZE=`eval echo \\${${PRODUCT}[3]}`
  539. # Get file system name & index number for new directory.
  540. NEW_FS=`Get_fs_info -mnt $NEW_DIR` || return 1
  541. NEW_INDEX=`Get_fsindex $NEW_FS`
  542. OLD_DIR=`eval echo \\${${PRODUCT}[4]}` # Get old directory for product.
  543. OLD_FS=`Get_fs_info -mnt $OLD_DIR` # Get old file system name.
  544. OLD_INDEX=`Get_fsindex $OLD_FS` # Get old index into FS_NAME array.
  545. # Move the kit space from old to new file system.
  546. let FS_FREE[$NEW_INDEX]=${FS_FREE[$NEW_INDEX]}-$PROD_SIZE
  547. let FS_FREE[$OLD_INDEX]=${FS_FREE[$OLD_INDEX]}+$PROD_SIZE
  548. let FS_NEEDED[$NEW_INDEX]=${FS_NEEDED[$NEW_INDEX]}+$PROD_SIZE
  549. let FS_NEEDED[$OLD_INDEX]=${FS_NEEDED[$OLD_INDEX]}-$PROD_SIZE
  550. eval `echo ${PRODUCT}[4]=\\$NEW_DIR` # Switch PRODUCT[4] to new directory.
  551. eval `echo ${PRODUCT}[5]=\\$NEW_INDEX` # Switch PRODUCT[5] to new index.
  552. } # End of Change_prod_dir.
  553.  
  554.  
  555.  
  556. Check_base() # Ck the answer for the Unigraphics base dir on config_only.
  557. { # RKB Apr 16 14:09 93
  558. # RKB updtd: Aug 4 23:54 93 V101p2 change checks when doing config only.
  559. # RKB updtd: Aug 11 16:14 93 V101p2 more changes for config only.
  560. # RKB updtd: Oct 26 08:53 93 V101p1f rm ck for ugraf for SGI.
  561. # RKB updtd: Nov 9 17:13 93 V102p2d change to allow use of link for base dir.
  562. # RKB updtd: Nov 10 19:52 93 V102p2d further changes for automounter support.
  563. # RKB updtd: Feb 17 17:12 94 V103P2B rm ck for .ugii_env on config_only.
  564. # RKB updtd: Mar 17 01:08 94 V103P3B add message for occupied base dir.
  565. # RKB updtd: Apr 26 16:35 94 V103P4D add chmod 555 for created dirs.
  566. # RKB updtd: Mar 18 14:56 98 V150P01 chng to ck for ugflexlm files not acs.
  567. # RKB updtd: Nov 3 15:00 99 V160P20 add ck for license_server install type.
  568. # RKB updtd: Aug 28 06 NX050P16 Changes for new universal flexlm i.e. ugslmd.
  569. #
  570. [ "$BASE_PMT" = "n/a" ] && return 0 # No point in cking if n/a.
  571. [ "$BASE_DIR" ] && return 0 # If already set, no need to check.
  572. print "${MSG}Checking base directory ${BASE_PMT} ... \c"
  573. unset BASE_DIR BASE_FLAG BASE_MSG # Init these vars to be safe.
  574. #
  575. # Now check the answer.
  576. ( cd $BASE_PMT >$NULL 2>&- ; ) # Do a cd just in case its automounted.
  577. # If answer is a link, check that it points to a valid directory.
  578. [ -h $BASE_PMT ] && { # If answer is a link make sure it's valid.
  579. if [ -d $BASE_PMT ] ; then
  580. REAL_BASE=`cd $BASE_PMT 2>&- ; echo pwd | csh -fs 2>&-`
  581. print "${NOTE}$BASE_PMT is a symbolic link to: $REAL_BASE "
  582. # Next line commented out for V10.2ph2d to allow use of links for base.
  583. # BASE_PMT=$REAL_BASE # This line switches the action of the script.
  584. else
  585. print "${ERR}${BASE_PMT} does NOT point to a real directory." >&2
  586. BASE_MSG="${BASE_PMT} does NOT point to a real directory."
  587. BASE_FLAG=$REENTER
  588. return 1 # Directory was bogus, return.
  589. fi
  590. }
  591. #
  592. # If /usr/ugs$VNUM is a mount point we'd have trouble renaming it.
  593. [ $BASE_PMT != /usr/ugs$VNUM -a `Get_fs_info -mnt /usr/ugs$VNUM` = /usr/ugs$VNUM ] && {
  594. print "${ERR}/usr/ugs$VNUM is a mount point, it cannot be moved or removed.
  595. \r\tumount /usr/ugs$VNUM or use /usr/ugs$VNUM for base dir"
  596. BASE_MSG="/usr/ugs$VNUM is a mount point, cannot be moved or removed."
  597. BASE_FLAG=$REENTER
  598. sleep 3 ; return 1
  599. } # Must use /usr/ugs$VNUM if it's a mount point.
  600. #
  601. # Now do checks based on the type of installation.
  602. case ${INS_TYPE} in
  603. load+c*|load_o*|license_serv*) # Checks if doing a load op.
  604. # Make sure we don't try to load on top of ourselves.
  605. # Make sure REAL_BASE is set for next comparison.
  606. : ${REAL_BASE:=$BASE_PMT}
  607. [ "$BASE_PMT" = "$SOURCE" -o "$REAL_BASE" = "$SOURCE" ] && {
  608. print "${ERR}base and source can't be the same" >&2
  609. BASE_MSG="base and source can't be the same"
  610. BASE_FLAG=$REENTER
  611. sleep 3 ; return 1
  612. }
  613. #
  614. # If BASE_PMT is NFS mounted we need root access for load operations.
  615. Get_fs_info -nfs $BASE_PMT && { # True if BASE_PMT is NFS mounted.
  616. BASE_MOUNT=`Get_fs_info -mnt $BASE_PMT`
  617. print "${NOTE}$BASE_PMT is NFS mounted on: $BASE_MOUNT"
  618. Check_root_access "$BASE_MOUNT" || { # No root access.
  619. NFS_PATH=`Get_fs_info -fsname $BASE_PMT` # Get NFS pathname.
  620. print "${WARN}$BASE_PMT is NFS mounted without root access.
  621. \r\tThis node: $HOST does not have root access in: $NFS_PATH
  622. \n\tExport $NFS_PATH with root access (if available) OR,
  623. \r\tUse the 'load & configure option' on the NFS server first then
  624. \r\tuse the 'configure only' option on NFS client(s). " >&2
  625. BASE_MSG="NFS mounted without root access: $BASE_PMT"
  626. BASE_FLAG=$REENTER
  627. sleep 3 ; return 1
  628. } # Root access check.
  629. } # NFS check.
  630. # Check if BASE_PMT is an empty dir and supports long filenames.
  631. if [ -d $BASE_PMT ] ; then
  632. [ `ls -a $BASE_PMT | wc -w` = 2 ] || {
  633. BASE_EMPTY=no
  634. print "\n${NOTE}$BASE_PMT is NOT empty, this installation
  635. \r\twill OVERWRITE existing UG files in that directory."
  636. sleep 3
  637. }
  638. Check_longnames $BASE_PMT || {
  639. BASE_MSG="$BASE_PMT does not support long filenames."
  640. BASE_FLAG=$REENTER
  641. return 1
  642. }
  643. else # there was no directory so create it.
  644. $VECHO "${MSG}Creating directory ${BASE_PMT} ..."
  645. mkdir -p $BASE_PMT || return 1
  646. chmod 555 $BASE_PMT >$NULL 2>&-
  647. BASE_EMPTY=yes
  648. Check_longnames $BASE_PMT || {
  649. BASE_MSG="$BASE_PMT does not support long filenames."
  650. BASE_FLAG=$REENTER
  651. rmdir $BASE_PMT 2>&-
  652. return 1
  653. }
  654. fi
  655. ;;
  656. config*) # Checks if doing a config_only op.
  657. # Check if NFS, for info only.
  658. Get_fs_info -nfs $BASE_PMT && {
  659. print "${NOTE}$BASE_PMT is NFS mounted."
  660. }
  661. # Make sure it already exists on config_only.
  662. [ -d $BASE_PMT ] || {
  663. print "${WARN}the directory $BASE_PMT does not exist
  664. \r\tcannot use 'configure_only' option, with this directory." >&2
  665. BASE_MSG="$BASE_PMT does not exist. cannot use 'configure only'."
  666. BASE_FLAG=$REENTER
  667. sleep 3 ; return 1
  668. }
  669. # Now check it has some basic files.
  670. for FILENAME in ugflexlm/lmgrd ugflexlm/ugslmd ugii/ugii
  671. do
  672. [ -f $BASE_PMT/$FILENAME ] || {
  673. print "${WARN}not a UG base directory, required files are missing.
  674. \r\tcannot use 'configure_only' option." >&2
  675. BASE_MSG="$BASE_PMT is missing files, cannot 'configure_only'"
  676. BASE_FLAG=$REENTER
  677. sleep 3 ; return 1
  678. }
  679. done
  680. ;;
  681. esac
  682. #
  683. # If we got this far, should be a good directory.
  684. # Set the vars and return.
  685. BASE=$BASE_PMT # Set BASE used by Init_product_arrays.
  686. BASE_DIR=$BASE_PMT # Set BASE_DIR to BASE_PMT.
  687. ROOT_DIR=${BASE_DIR}/bin/ # Set ROOT_DIR for compatability.
  688. UGII_BASE_DIR_ANSWER=$BASE_PMT
  689. Log_var UGII_BASE_DIR_ANSWER "UG base directory answer."
  690. return 0
  691. } # End of Check_base
  692.  
  693.  
  694.  
  695. Check_kit_dependencies() # Define & check kit selections dependent on arg1.
  696. { # RKB Oct 15 97 Initial version written to handle UGROUTING.
  697. # RKB Nov 17 97 Change to use CR to continue method.
  698. # RKB Aug 19 98 V150P09 Add check for UGOPENPP & partial re-write.
  699. # RKB Tue 2 99 V160P20 Add check for UGHARNESS.
  700. # RKB 05 May 03 V020P17 Rm kit dependencies for UGROUTING.
  701. # RKB Feb 17 04 NX3P09 Add check for NXTOOLING_COMMON
  702. # RKB Mar 18 04 NX3P11 Change NXTOOLING_COMMON to TOOLING_BASE.
  703. # RKB Jun 17 04 NX3P18 Chng FSETS logic in prep for multi CD installs.
  704. # RKB Aug 30 05 NX4P20 Add check for NXJRE.
  705. # RKB Sep 29 05 NX4P22 Fix missing "|" in DEPENDANTS definition for NXJRE.
  706. # RKB May 15 06 NX5P08 Add CATIAV5,DXFDWG,IGES,STEP203UG,STEP214UG.
  707. # RKB Dec 11 07 NX6P16 Add NXASSEMBLY.
  708. #
  709. : ${FSETS:?} # Required variable check. List of currently selected kits.
  710. #
  711. unset DEPENDANTS_FLAG
  712. #
  713. set -f # Turn off filename expansion.
  714. for PARENT in UGOPEN TOOLING_BASE NXJRE
  715. do
  716. # If parent kit IS already in FSETS then we dont care about the dependants.
  717. echo $FSETS | tr ' ' '\012' | egrep "${PARENT}" >$NULL && continue 1
  718. #
  719. # The parent kit is NOT in FSETS, so define the dependants to check.
  720. # For multiple dependants, define the var like an egrep 'OR' expression.
  721. case $PARENT in
  722. NXJRE)
  723. DEPENDANTS="
  724. UGOPEN|PSTUDIO|CATIAV5|DXFDWG|IGES|STEP203UG|STEP214UG|NXASSEMBLY" ;;
  725. UGOPEN) DEPENDANTS="UGOPENPP" ;;
  726. TOOLING_BASE) DEPENDANTS="MOLDWIZARD|PDIEWIZARD" ;;
  727. esac
  728. #
  729. # See if any of the dependants of $KIT are in FSETS. if so, it's a problem.
  730. #
  731. echo $FSETS | tr ' ' '\012' | egrep $DEPENDANTS >$NULL 2>$NULL && {
  732. # True if FSETS contained one or more of the dependants.
  733. print "${NOTE}The $PARENT kit must ALSO be selected with kit(s):"
  734. print "\r\t$DEPENDANTS" | sed 's!|!, !g'
  735. DEPENDANTS_FLAG=1
  736. }
  737. #
  738. done
  739. #
  740. set +f # Turn filename expansion back on.
  741. # Now see if there were any errors.
  742. [ "$DEPENDANTS_FLAG" ] && {
  743. print "\n*\tEnter CR after reading message. \c" ; read CR
  744. return 1
  745. }
  746. return 0 # There were no orphaned dependants so we are O.K.
  747. #
  748. } # End of Check_kit_dependencies.
  749.  
  750.  
  751.  
  752. Check_hostname() # Short function to see if arg1 is a valid hostname.
  753. { # RKB written: Aug 5 22:17 1993 V10.1p2
  754. # RKB updtd: Oct 13 00:14 94 V104P09 switch to egrep & ck for $1 EOL.
  755. # RKB updtd: Apr 29 00:44 96 V111P12 Added logic for DNS check.
  756. # RKB updtd: Oct 26 05 NX4P24 Tweak nslookup grep pattern for Linux.
  757. #
  758. # Check local hosts file then YP hosts file.
  759. if egrep "[ , ]$1[ , ]|[ , ]$1$" /etc/hosts >$NULL 2>&- ; then
  760. return 0
  761. elif ypcat hosts 2>&- | egrep "[ , ]$1[ , ]|[ , ]$1$" >$NULL 2>&- ; then
  762. return 0
  763. elif [ -f /etc/resolv.conf ] && \
  764. nslookup $1 2>&1 | egrep "^Name:[ , ]*$1" >$NULL 2>&-
  765. then
  766. return 0
  767. else
  768. print "${ERR}could not find $1 in '/etc/hosts' or NIS or DNS.\c" >&2
  769. sleep 3 ; return 1
  770. fi
  771. } # End Check_hostname.
  772.  
  773.  
  774.  
  775. Check_license_file() # Check the license file supplied by the user.
  776. { # RKB 21Feb08 NX6P19 Initial version taken from Check_license_servers.
  777. # RKB 24Mar08 NX6P21 More chngs for Standalone license.
  778. #
  779. # Preliminary checks & messages.
  780. [ "$UGFS_PMT" = "n/a" ] && return 0 # No point in cking if n/a.
  781. [ "$UGF_SERVERS" ] && return 0 # Already checked & set, don't check again.
  782. #
  783. : ${BASE_DIR:?} # Required variable check.
  784. #
  785. # Initialize the flags and message variables.
  786. unset UGFS_FLAG UGFS_MSG
  787. unset UGF_LOCAL_SERVER
  788. #
  789. print "${MSG}Checking user supplied license file... \c"
  790. #
  791. # Checked for mixed server-filename entry.
  792. [[ "$UGFS_PMT" = *"/"* ]] && [[ "$UGFS_PMT" = *"@"* ]] && {
  793. UGFS_MSG="Mixed filename and server name(s) not supported."
  794. print "${ERR}$UGFS_MSG
  795. \r\tEnter a full path to a filename OR server name(s).
  796. \n\tEntering both server(s) and a filename is not
  797. \r\tsupported by the install."
  798. UGFS_FLAG=$REENTER # Now we have to force user to re-enter.
  799. sleep 3 ; return 1
  800. }
  801. # Now check if we can find the file.
  802. [ -f "$UGFS_PMT" ] || { # Nope couldn't find the file.
  803. UGFS_MSG="The license file entered was not found."
  804. print "${ERR}$UGFS_MSG
  805. \r\tEnter a full path to a NX standalone license file.
  806. \n\tThe environment variable UGS_LICENSE_SERVER must be set to
  807. \r\ta license filename or valid servers(s) before running NX."
  808. UGFS_FLAG=$REENTER # Now we have to force user to re-enter.
  809. sleep 3 ; return 1
  810. }
  811. #
  812. # Check the filename is NOT a server type of license.
  813. grep "^SERVER" $UGFS_PMT >$NULL 2>&- && {
  814. UGFS_MSG="The specified license file is a server license file."
  815. print "${ERR}$UGFS_MSG
  816. \n\tThe specified license file can ONLY be used with a license
  817. \r\tserver installation. Install the ugs_licensing product."
  818. UGFS_FLAG=$REENTER # Now we have to force user to re-enter.
  819. sleep 3 ; return 1
  820. }
  821. # Looks like we passed ALL the tests, so set the permanent variables.
  822. FLEX_LIC_SERVERS=$UGFS_PMT # Used in answer file.
  823. Log_var FLEX_LIC_SERVERS "NX license file" # Log the answer.
  824. # As of NX6P21 we force the filename to a standard name & location so
  825. # that support folks can always find it and customer doesn't delete it.
  826. # UGS_LICENSE_SERVER=$UGFS_PMT # This is what gets set in the environment.
  827. # NX6P21 hard code these for now.
  828. UGS_LICENSE_SERVER=$BASE_DIR/ugflexlm/nx_license.lic # hard coded for now.
  829. UGF_SERVERS=$BASE_DIR/ugflexlm/nx_license.lic # hard coded for now.
  830. #
  831. return 0
  832. #
  833. } # End Check_license_file
  834.  
  835.  
  836.  
  837. Check_license_servers() # Check the server names supplied by the user.
  838. { # RKB 29Apr98 Initial version taken from Check_acs_master.
  839. # RKB 06May98 Add for loop for multiple nodes, and all check logic.
  840. # RKB 13Jul98 V150P06 Add ck for UGF_LOCAL_SERVER & client only.
  841. # RKB Aug 28 06 NX5P16 Changes for new universal flexlm i.e. ugslmd.
  842. # RKB Aug 28 06 NX5P16 Allow install to continue of servers fail validation.
  843. # RKB Dec 11 06 NX5P22 Tmp tweak to allow local server on client-only install.
  844. # RKB Feb 20 08 NX6P19 Chg to allow standalone license file or server names.
  845. # RKB Feb 21 08 NX6P19 Renamed Check_ugf_servers to Check_license_servers.
  846. #
  847. # Preliminary checks & messages.
  848. [ "$UGFS_PMT" = "n/a" ] && return 0 # No point in cking if n/a.
  849. [ "$UGF_SERVERS" ] && return 0 # Already checked & set, don't check again.
  850. #
  851. # Initialize the flags and message variables.
  852. unset UGFS_FLAG UGFS_MSG BAD_NAMES BAD_PINGS BAD_TESTS SERVERS
  853. unset UGF_LOCAL_SERVER
  854. #
  855. print "${MSG}Checking user supplied server name(s) ... \c"
  856. #
  857. # Test user supplied nodenames and see if any are local..
  858. # Check each node in UGFS_PMT. First convert the commas and
  859. # semi-colons into spaces so they can be passed as separate args.
  860. #
  861. Test_ugf_nodenames $(echo $UGFS_PMT | sed -e 's![;|:|,]! !g')
  862. #
  863. # Final check for ANY error flags.
  864. [ -n "$BAD_NAMES$BAD_PINGS$BAD_TESTS" ] && {
  865. print "${WARN}one or more servers failed validation tests"
  866. sleep 2
  867. }
  868. # Now check if there were ANY good nodes.
  869. [ "$GOOD_SERVERS" -lt 1 ] && { # Nope there were NO good ones.
  870. UGFS_MSG="no useable servers were entered. all failed validation tests."
  871. # print "${ERR}$UGFS_MSG \c"
  872. print "${ERR}$UGFS_MSG
  873. \r\tThe servers entered were not valid or not up and running.
  874. \r\tThe environment variable UGS_LICENSE_SERVER must be set to
  875. \r\tvalid server(s) OR a license filename before running NX."
  876. # Severity of check downgraded to warning. Allow install to continue NX5P16.
  877. # UGFS_FLAG=$REENTER # Now we have to force user to re-enter.
  878. # sleep 3 ; return 1
  879. sleep 3
  880. }
  881. #
  882. # Check if listed local host as a server but designated it client only.
  883. # Cant serve licenses unless configured as a license server ALSO.
  884. [ "$UGF_LOCAL_SERVER" = "TRUE" -a "$UGF_TYPE" = "client" ] && {
  885. # Disabled NX050P22 Just give a notice but allow continue.
  886. # UGFS_MSG="$HOST is designated client ONLY - it cannot serve licenses"
  887. # print "${ERR}$UGFS_MSG
  888. # \r\tchange UG Licensing option to BOTH - OR -
  889. # \r\tremove $HOST from list of license servers. \c"
  890. # UGFS_FLAG=$REENTER # Now we have to force user to re-enter.
  891. # sleep 3 ; return 1
  892. # Do quick ck if ugslmd is already running if so, we don't need a message.
  893. $PS_CMD | grep -v grep | grep ugslmd >$NULL 2>&- || {
  894. print "${WARN}$HOST is currently designated client ONLY.
  895. \r\tPlease be sure to:
  896. \r\tinstall licensing on this node with the ugslicensing install
  897. \r\t- OR -
  898. \r\tremove $HOST from the list of license servers. \c"
  899. sleep 6 # Just give the message and continue.
  900. }
  901. }
  902. #
  903. # Looks like we passed ALL the tests, so set the permanent variables.
  904. UGF_SERVERS="$UGFS_PMT" # Tested variable
  905. FLEX_LIC_SERVERS=$UGFS_PMT # Used in answer file.
  906. Log_var FLEX_LIC_SERVERS "UGS license servers" # Log the answer.
  907. UGS_LICENSE_SERVER=$UGF_SERVERS # This is what gets set in the environment.
  908. #
  909. return 0
  910. #
  911. } # End Check_license_servers
  912.  
  913.  
  914.  
  915. Check_longnames() # Check that this system can support long filenames.
  916. { # RKB Fri Jul 13 15:05:41 PDT 1990
  917. TEST_FSYS=${1} ; : ${TEST_FSYS:?} # Internal check.
  918. TEST_FNAME="ugs_test9012345678901234567890123456789012345678901234567890"
  919. touch ${TEST_FSYS}/$TEST_FNAME 2>&-
  920. ACTUAL_FNAME=`ls -l ${TEST_FSYS}/ugs_test901234* 2>&- |$AWK_CMD '{print $NF}'`
  921. ACTUAL_FNAME=`basename $ACTUAL_FNAME`
  922. rm -f ${TEST_FSYS}/$TEST_FNAME 2>&-
  923. [ "$ACTUAL_FNAME" = $TEST_FNAME ] || { # Make sure they match.
  924. print "${ERR}This file system does not support long filenames
  925. \r\tFilename lengths greater than 14 characters is required for
  926. \r\tinstallation of $PRODNAME ${NX_VER}." >&2
  927. return 1
  928. }
  929. return 0 # We're ok, they matched.
  930. } # End of Check_longnames.
  931.  
  932.  
  933.  
  934. Check_modify_ok() # Ck the answer for permission to modify system files.
  935. { # RKB Apr 28 18:58:39 1993
  936. # RKB Aug 4 23:43 1993 change to use yes/no case statement.
  937. # RKB Feb 26 15:16 2002 V190P12 Take out 'tr' for MOD_PMT - HPUX 11i bug.
  938. [ "$MOD_PMT" = "n/a" ] && return 0 # No point in cking if n/a.
  939. [ "$MODIFY_OK" ] && return 0 # If already set, no need to check.
  940. print "${MSG}Checking ok to modify system files ...\c"
  941. unset MODIFY_OK
  942. # Got the question answered now check the answer.
  943. case $MOD_PMT in
  944. Y*|y*) # User said yes.
  945. MODIFY_OK=yes # Nothing to ck, just set the var.
  946. ;;
  947. N*|n*) # user said no.
  948. MODIFY_OK=no
  949. print "${NOTE}This node will not be configured to run $PRODNAME \c" >&2
  950. sleep 2
  951. ;;
  952. esac
  953. unset MOD_FLAG MOD_MSG
  954. MODIFY_SYSTEM_FILES_OK=$MODIFY_OK
  955. Log_var MODIFY_SYSTEM_FILES_OK "O.K. to modify system files"
  956. # Passed the tests, and the var is set so leave.
  957. return 0
  958. } # End of Check_modify_ok
  959.  
  960.  
  961.  
  962. Check_openfiles() # Check for files left open which prevents updates.
  963. { # RKB Sep 14 21:45:37 1992
  964. # RKB Updated: Sep 23 22:19:10 1992 ck FSETS & save backup before rm.
  965. # RKB updtd: Mar 18 14:56 98 V150P01 chng to ck for ugflexlm files not acs.
  966. # RKB Apr 15 23:20 02 V190P16 Take out 'tr' for OPEN_FILES_OK - HPUX 11i bug.
  967. # RKB Jun 17 04 NX3P18 Chng FSETS logic in prep for multi CD installs.
  968. # RKB Jun 17 04 NX3P18 Rm check for plot/ugiipqd.
  969. # RKB updtd: Aug 28 06 NX050P16 Changes for new universal flexlm i.e. ugslmd.
  970. #
  971. : ${BASE_DIR:?} # Required variable internal check.
  972. $VECHO "${MSG}Checking for open files ..."
  973. OLDPWD=`pwd` ; cd $BASE_DIR
  974. while true ; do # Outer control loop.
  975. unset OPEN_FILES
  976. for FILENAME in ugflexlm/lmgrd ugflexlm/ugslmd ; do
  977. [ -f "$FILENAME" ] || continue 1 # If file is not there, it's not open.
  978. KITNAME=`echo $FILENAME | cut -d/ -f1` # Get the kitname (directory).
  979. # Check if this kit is a selected kit.
  980. echo $FSETS | tr " " "\012" | grep -i "^${KITNAME}$" >$NULL || continue
  981. cp -p $FILENAME ${FILENAME}.$$ 2>&- # Save it first.
  982. if rm -f ${FILENAME} >$NULL 2>&- ; then # Now try to remove it.
  983. mv -f ${FILENAME}.$$ ${FILENAME} 2>&- # Could rm it, now restore it.
  984. else
  985. OPEN_FILES="$OPEN_FILES $FILENAME"
  986. rm -f ${FILENAME}.$$ 2>&-
  987. fi
  988. done
  989. [ "$OPEN_FILES" ] || return 0 # There weren't any, so we're done.
  990. #
  991. print "${ERR}These files are still open, and cannot be updated:\n" >&2
  992. echo $OPEN_FILES | tr " " "\012" | pr -ato8 -3 >&2
  993. [ "$Q_SWT" ] && {
  994. print "\n\tcannot continue in 'quiet' mode." >&2 ; exit 1 ;}
  995. while true ; do # Question loop.
  996. print "${MSG}Do you want to:
  997. \r\t1) Continue anyway, update manually, later.
  998. \r\t2) No. Do not continue. Return to previous question.
  999. \r\t!) Escape to the shell to close file(s).
  1000. \r\tq) Quit $SCRIPTNAME
  1001. \r\t?) Help"
  1002. print "${QUE}Continue $SCRIPTNAME anyway [yes]: \c"
  1003. read OPEN_FILES_OK
  1004. case ${OPEN_FILES_OK:=yes} in
  1005. y*|Y*|1) print "${MSG}The files listed MUST be updated manually
  1006. \r\tbefore attempting to run $PRODNAME" ; return 0 ;;
  1007. h*|"?") print "${MSG}The file(s) listed above could not be removed.
  1008. \r\tThis script will NOT be able to correctly update the old file(s).
  1009. \n\tThese files may have been opened by a 'cnode' or an NFS client.
  1010. \r\tTerminate UGII background process on any remote node that may be
  1011. \r\taccessing files in ${BASE_DIR}. Use 'ugs_reset -h'.
  1012. \n\tAvailable options:
  1013. \n\tContinue anyway, and update manually BEFORE running ${PRODNAME}.
  1014. \n\tEscape to shell and shutdown the processes accessing the file(s).
  1015. \n\tQuit $SCRIPTNAME and re-run after the files have been closed."
  1016. continue 1 ;;
  1017. !) echo Use ^d to return to $SCRIPTNAME ; $SHELL
  1018. $VECHO "${MSG}Re-checking open files ..." ; continue 2 ;;
  1019. n*|N*|2) return 1 ;;
  1020. q*) return 1 ;;
  1021. esac
  1022. done # end OPEN_FILES_OK question loop.
  1023. done # end control loop.
  1024. } # End Check_openfiles
  1025.  
  1026.  
  1027.  
  1028. Check_root_access() # Simple function to test full root access to a dir.
  1029. { # RKB Wed Oct 2 22:02:10 PDT 1991
  1030. # Requires 1 switch & 1 arg, or just 1 arg; the directory to check.
  1031. case $1 in
  1032. -cr*) # -cr switch says create the dir in arg 2.
  1033. TARGET_DIR=$2 ; : ${TARGET_DIR:?} # Internal check.
  1034. mkdir -p $TARGET_DIR 2>&- || return 1 ;;
  1035. *) TARGET_DIR=$1 ; : ${TARGET_DIR:?} # Internal check. ;;
  1036. esac
  1037. OLDCWD=`pwd` ; cd $TARGET_DIR 2>&- || return 1
  1038. touch ugs_testfile.$$ 2>&- || { rm -f ugs_testfile.$$ 2>&- ; return 1 ;}
  1039. chgrp 100 ugs_testfile.$$ 2>&- || { rm -f ugs_testfile.$$ 2>&- ; return 1 ;}
  1040. chown 100 ugs_testfile.$$ 2>&- || { rm -f ugs_testfile.$$ 2>&- ; return 1 ;}
  1041. rm -f ugs_testfile.$$ 2>&- || return 1
  1042. cd $OLDCWD
  1043. return 0 # If we can do all these things we probably have access.
  1044. } # End Check_root_access.
  1045.  
  1046.  
  1047.  
  1048. Check_runpath() # Check path used to run this script. Cannot have pound sign.
  1049. { # RKB May 08 97 V130P13 Temporary special workaround to trap '#' in path.
  1050. #
  1051. # 1 Required variable: SCRIPTDIR
  1052. echo # Cosmetic newline.
  1053. #
  1054. echo ${SCRIPTDIR:?} | grep '#' >$NULL && {
  1055. print "${ERR}a '#' symbol has been detected in the directory path containing
  1056. \r\tthis script: $SCRIPTDIR/$SCRIPTNAME
  1057. \n\tSome external programs invoked by this script CANNOT tolerate this
  1058. \r\tspecial character, and MAY cause a failure later in the install.
  1059. \n\tIf $SCRIPTDIR is a disk directory, rename the directory
  1060. \r\tor create a symbolic link to it using another name.
  1061. \n\tIf $SCRIPTDIR is a DVD/CDROM directory, remount the DVD/CDROM using
  1062. \r\tanother mount point or create a symbolic link to it using another name.
  1063. \r\te.g. mkdir /tmp/cdrom
  1064. \r\t ln -s $SCRIPTDIR /tmp/cdrom "
  1065. [ ${MACHINE} = "SunOS" ] && {
  1066. print "\n\tNOTE: DVD/CDROM's mounted by the SunOS Volume Management Daemon
  1067. \r\t(vold) may already contain a useable symbolic link.
  1068. \r\te.g. /cdrom/cdrom0 "
  1069. }
  1070. echo # Cosmetic echo
  1071. return 1 # Can't use this path.
  1072. }
  1073. return 0 # Passed the simple test.
  1074. } # End Check_runpath.
  1075.  
  1076.  
  1077.  
  1078. Check_space() # Check if there's enough free disk space to load.
  1079. { # RKB Mon Feb 04 22:23:55 PST 1991
  1080. # RKB Oct 1 00:53 93 Fixes to option 3 - reselect base dir.
  1081. # RKB Nov 10 23:53 93 V10.2ph2d major changes to make menu return to Main.
  1082. # RKB Mar 7 18:12 94 V103P2E do df cmd inside main loop instead of Resize_fs.
  1083. # This function cycles thru the known filesystems to check free space.
  1084. #
  1085. print "\n\tChecking disk space, selections require $SPACE_REQUIRED_MB Mb ..."
  1086. #
  1087. # Loop thru the list useable filesystems, ck each one for space requirement.
  1088. I=0 # Initialize the index.
  1089. while [ ${I} -lt ${#FS_NAME[*]} ] ; do # Outer control loop.
  1090. #
  1091. # If we don't need any space on this filesystem then skip it.
  1092. [ "${FS_NEEDED[$I]}" = 0 ] && { # True if no space needed.
  1093. ((I+=1)) ; continue 1 # bump index, skip to next file system.
  1094. }
  1095. # Get the amount of free space on this filesystem in 1024 byte blks.
  1096. FS_FREE[$I]=`$DF_CMD ${FS_NAME[$I]} | tail -1 \
  1097. | $AWK_CMD '{printf"%d",$(NF-2)}'`
  1098. #
  1099. # Now check if we do have enough free space.
  1100. if (( ${FS_FREE[$I]} >= ${FS_NEEDED[$I]} )) ; then
  1101. # True if we had enough free space.
  1102. ((I+=1)) ; continue 1 # Bump index, skip to next file system.
  1103. else # Oh oh, we did NOT have enough free space.
  1104. #
  1105. # Put name of this filesystem into a simple var.
  1106. DNAME=${FS_NAME[$I]}
  1107. [ $DNAME = "/" ] && DNAME="/ (root)" # Change it for cosmetics.
  1108. #
  1109. [ "$Q_SWT" ] && { # This is fatal in quiet mode.
  1110. print "${ERR}not enough space on filesystem '$DNAME' to load files.
  1111. \r\tCannot continue in 'quiet' mode. " >&2 ; exit 1
  1112. }
  1113. # Now ask the user what they want to do.
  1114. while true ; do # Inner question loop.
  1115. print "${WARN}not enough space on filesystem '$DNAME' to load files.
  1116. \n\tFree Kbytes required: ${FS_NEEDED[$I]}
  1117. \r\tFree Kbytes available: ${FS_FREE[$I]}
  1118. \n\tDo you want to:
  1119. \r\t1) Continue anyway (Overwrite existing files)
  1120. \r\t2) Return to product selection menu to re-select products or dirs.
  1121. \r\t3) Return to main screen to select new base directory.
  1122. ${QUE}Enter your selection: [1] \c"
  1123. read ANS
  1124. case ${ANS:=1} in
  1125. 1) ((I+=1)) ; break 2 ;; # Continue the outer loop to next disk.
  1126. 2) return 1 ;; # Go back to Select_products.
  1127. 3) unset FSETS ; return 2 ;; # Go back to main screen.
  1128. !)
  1129. print "${MSG}Use ^d to return to $SCRIPTNAME"
  1130. $SHELL
  1131. print "${MSG}Re-checking disk space ... "
  1132. I=0 ; continue 2 # Reset index, retest all the disks.
  1133. ;;
  1134. "?"|h*|H*) Help_install Check_space ;;
  1135. q*|Q*) return 1 ;;
  1136. esac
  1137. done # End of inner question loop.
  1138. fi # end of space ck conditional.
  1139. done # End of outer control loop.
  1140. return 0
  1141. } # End of Check_space
  1142.  
  1143.  
  1144.  
  1145. Check_source() # Check the answer given for the source of the files.
  1146. { # RKB Apr 15 17:04:09 1993
  1147. # RKB updtd: Aug 4 22:26 93 Take out tape support.
  1148. # RKB updtd: Sep 17 00:12 93 V10.1ph3h Add case for set prompt to help.
  1149. # RKB updtd: Mar 7 00:34 95 V105P01 rm ADMIN from reqd list.
  1150. # RKB updtd: Apr 15 23:20 02 V190P16 Take out use of 'tr' - HPUX 11i bug.
  1151. # RKB Apr 15 23:20 02 V190P16 Take out use of 'tr' - HPUX 11i bug.
  1152. # RKB updtd: Mar 10 13:29 03 V020P13 Add logic to check for tar.Z files.
  1153. # This function sets the variable: SOURCE
  1154. [ "$SOURCE" ] && return 0 # If set, it's already been checked.
  1155. [ "$SRC_PMT" = "n/a" ] && return 0 # No point in cking if n/a.
  1156. print "${MSG}Checking source directory ${SRC_PMT} ...\c"
  1157. unset SOURCE SRC_FLAG SRC_MSG # Init these vars to be safe.
  1158. # Now check SRC_PMT
  1159. if [ $SRC_PMT = "help" ] ; then # True if prompt is set to 'help'.
  1160. print "${WARN}source directory required for '$INS_TYPE'." >&2
  1161. SRC_MSG="enter source directory for '$INS_TYPE' "
  1162. SRC_FLAG=$REENTER ; return 1
  1163. elif [ -d "$SRC_PMT" ] ; then # True if directory.
  1164. typeset -l DIR_LC
  1165. for DIR in INSTALL UGII UGFLEXLM ; do # Ck for Base products.
  1166. DIR_LC=$DIR
  1167. DIR_TAR=${DIR}.tar.Z
  1168. [ -d ${SRC_PMT}/$DIR ] && continue # found it, continue
  1169. [ -d ${SRC_PMT}/$DIR_LC ] && continue # found it, continue
  1170. [ -f ${SRC_PMT}/$DIR_TAR ] && continue # found it, continue
  1171. # If none found, fall through to this error.
  1172. print "${ERR}$DIR not found in $SRC_PMT" >&2
  1173. SRC_MSG="$DIR not found in $SRC_PMT"
  1174. SRC_FLAG=$REENTER ; return 1
  1175. done # End test.
  1176. SOURCE=$SRC_PMT # Passed the test set the SOURCE var.
  1177. elif [ -c $SRC_PMT ] ; then # True if local tape.
  1178. print "${WARN}tape devices not supported." >&2
  1179. SRC_MSG="tape devices not supported."
  1180. SRC_FLAG=$REENTER ; return 1
  1181. elif echo $SRC_PMT | grep ":" >$NULL ; then # True if remote tape.
  1182. print "${WARN}remote tapes/directories not supported." >&2
  1183. SRC_MSG="remote tapes/directories not supported."
  1184. SRC_FLAG=$REENTER ; return 1
  1185. else # None of the above, we can't use it.
  1186. print "${WARN}$SRC_PMT is not a valid source directory." >&2
  1187. SRC_MSG="$SRC_PMT is not a valid source directory."
  1188. SRC_FLAG=$REENTER ; return 1
  1189. fi # end of dir/tape conditional.
  1190. UGII_SOURCE=$SOURCE
  1191. Log_var UGII_SOURCE "Source dir for UG files"
  1192. return 0
  1193. } # End Check_source.
  1194.  
  1195.  
  1196.  
  1197. Check_switches() # Check and process the legal switches into a switch word.
  1198. { # RKB created Mon Aug 3 13:05:23 PDT 1992
  1199. # RKB updated: Aug 18 1992
  1200. # RKB updated: 27 Jan 07 Chng VECHO to use print instead of echo.
  1201. # This function works on 1 global variable, CMD_LINE_ARGS which may be empty.
  1202. unset C_SWT D_SWT F_SWT L_SWT Q_SWT V_SWT # unset switch vars just to be safe.
  1203. # Put the command line args (saved earlier) into positional parameters.
  1204. getopt cdfhlv ${CMD_LINE_ARGS} >$NULL 2>&- || { # Check for legal switches.
  1205. print "\nusage:\t$SCRIPTNAME [-c] [-v] [-d|-f [filename]] [-l [filename]]
  1206. \r\talso, use $SCRIPTNAME -h for help."
  1207. exit 2 ;}
  1208. set -- `getopt cdfhlv ${CMD_LINE_ARGS} | sed s/--//p` # Looked OK, use 'em.
  1209. # Process all the switches as positional parameters.
  1210. while [ "$#" -gt 0 ] ; do # Loop until they're all done.
  1211. case $1 in
  1212. -c) C_SWT=c ;; # Configure only.
  1213. -d) D_SWT=d # Take the defaults
  1214. SKIP_MAIN_QUE=0 # Skip the question for the main screen.
  1215. SKIP_MAIN_QUE2=0 # Skip the question for the product select screen.
  1216. ;;
  1217. -f) F_SWT=f # Use an answer File
  1218. SKIP_MAIN_QUE=0 # Skip the question for the main screen.
  1219. SKIP_MAIN_QUE2=0 # Skip the question for the product select screen.
  1220. # Now check if there's an arg for -f other than another switch.
  1221. if [ `print "$2" | sed s/-.//g` ] ; then
  1222. READFILE=$2 # If there's a legitimate arg use it.
  1223. elif [ -f ${SCRIPTNAME}.ans ] ; then
  1224. READFILE=${SCRIPTNAME}.ans # If no arg, use the default.
  1225. else
  1226. print "${ERR}no filename supplied with the '-f' switch. And,
  1227. \r\tcould not find the default file: ${SCRIPTNAME}.ans" >&2
  1228. exit 1
  1229. fi
  1230. ;;
  1231. -l) L_SWT=l # Log the answers
  1232. # Now check if there's an arg for -l other than another switch.
  1233. if [ `print "$2" | sed s/-.//g` ] ; then
  1234. LOGFILE=$2 # If there's a legitimate arg use it.
  1235. else
  1236. LOGFILE=${SCRIPTNAME}.ans # If no arg, use the default.
  1237. fi
  1238. if [ -f "$LOGFILE" ] ; then
  1239. echo >> $LOGFILE 2>&- || LOGFILE=$UGS_TMP/$LOGFILE # Ck write.
  1240. print "# answers appended `date` by $SCRIPTNAME" >> $LOGFILE
  1241. else
  1242. echo > $LOGFILE 2>&- || LOGFILE=$UGS_TMP/$LOGFILE # Write test.
  1243. cat > $LOGFILE <<-END_OF_CAT
  1244. # $LOGFILE created by $SCRIPTNAME
  1245. # on `date`
  1246. #
  1247. # Data in this file can be used to provide
  1248. # answers for installation questions.
  1249. # Answer rules:
  1250. # 1. bourne shell environment variable format.
  1251. # 2. answers must begin in the first column.
  1252. # 3. commented answers are ignored.
  1253. # 4. in line comments are allowed.
  1254. # 5. answers can be in any order
  1255. # 6. duplicates are allowed.
  1256. # 7. ONLY the last answer is used.
  1257. #
  1258. END_OF_CAT
  1259. [ $? = 0 ] || {
  1260. print "${ERR}could not create the logfile: $LOGFILE" >&2
  1261. exit ;}
  1262. fi
  1263. ;;
  1264. -q) Q_SWT=q ;; # Do it quietly
  1265. -v) V_SWT=v ;; # Do it verbose
  1266. -h) print "\n\t$SCRIPTNAME optional switch usage:
  1267. \n\t[-c ] configure only. (do not load files).
  1268. \n\t[-d ] take supplied defaults. cannot be used with '-f'.
  1269. \n\t[-f [filename]] take answers from supplied filename or
  1270. \r\t ${SCRIPTNAME}.ans if no filname given.
  1271. \r\t NOTE: answers in this file can be overidden
  1272. \r\t by environment variables.
  1273. \n\t[-l [filename]] save answers in supplied filename or
  1274. \r\t ${SCRIPTNAME}.ans if no filname given.
  1275. \n\t[-v ] verbose output messages. (overides quiet). \n"
  1276. # \n\t[-q ] quiet, no output messages and no questions asked.
  1277. # \r\t (must also use a '-f' or '-d' switch).
  1278. exit 1 ;;
  1279. esac
  1280. shift
  1281. done
  1282. #
  1283. # Now check/eliminate some switch combinations.
  1284. # The V switch superceeds the Q switch
  1285. [ "$V_SWT" ] && VECHO=print || VECHO=":" # Use print instead of echo NX5P24.
  1286. [ "$V_SWT" ] && unset Q_SWT
  1287. #
  1288. # Can't use -d and -f together.
  1289. [ -n "$D_SWT" -a -n "$F_SWT" ] && {
  1290. print "${ERR}cannot use the '-d' and '-f' switches together." >&2
  1291. exit 2
  1292. }
  1293. #
  1294. # If using the Q switch you must also have the D or F switch.
  1295. [ "$Q_SWT" ] && [ -z "$D_SWT" -a -z "$F_SWT" ] && { # Q AND D & F not set.
  1296. print "${ERR}to use '-q' you must also use '-d' OR '-f'." >&2 ; exit 2 ;}
  1297. #
  1298. # Concatenate the individual switches into a switch control word.
  1299. READ_CONTROL_SWITCHES="$D_SWT$F_SWT$Q_SWT"
  1300. # If in quiet mode just shut off std.out
  1301. [ "$Q_SWT" ] && exec 1>/dev/null
  1302. :
  1303. } # End Check_switches.
  1304.  
  1305.  
  1306.  
  1307. Copy_kits() # Copies kit files from source dir to base dir. Uses cpio or tar.
  1308. { # RKB Jun 23 04 NX3P19 Taken from original Cpio_from_disk.
  1309. # RKB updtd: Wed Apr 20 2005 Added Linux support. NX4P11.
  1310. #
  1311. COPY_ERRORS=0 # Init the error counter.
  1312. unset FAILED_KITS # Init the failed kit list.
  1313. typeset -l KIT_LC # Typeset a lowercase kit name.
  1314. #
  1315. # Display the loading message.
  1316. $VECHO "\n\n\tLOADING FILES from: ${SOURCE}" # Do the file loading.
  1317. #
  1318. # Cpio or tar extract all the kit names passed as arguments.
  1319. for KIT in $* ; do # Kit names passed as args.
  1320. KIT_LC=$KIT # Lowercase kit name.
  1321. # Directories are cpio'ed from SOURCE to BASE_DIR/KIT_LC
  1322. if [ -d $SOURCE/$KIT -o -d $SOURCE/$KIT_LC ] ; then
  1323. [ -d ${BASE_DIR}/${KIT_LC} ] || \
  1324. mkdir -p ${BASE_DIR}/${KIT_LC} 2>&- || {
  1325. print "${ERR}could not find or mkdir ${BASE_DIR}/$KIT_LC" >&2
  1326. continue ; }
  1327. chmod 555 ${BASE_DIR}/${KIT_LC} >$NULL 2>&- # in case weird umask.
  1328. print "${MSG}Copying $KIT files to $BASE_DIR/${KIT_LC} ... \c"
  1329. $VECHO ; $VECHO # Cosmetic line feeds for verbose mode.
  1330. # This method uses the cpio command.
  1331. cd $SOURCE/$KIT 2>&- || cd $SOURCE/$KIT_LC
  1332. # Now do the actual copy.
  1333. # Linux cpio always outputs to std.err so have to do special cases.
  1334. if [ "${MACHINE}" = "Linux" -a -n "$V_SWT" ] ; then # Linux only.
  1335. if [ -n "$V_SWT" ] ; then # Verbose mode - output filenames.
  1336. find . -print | cpio -pudmv ${BASE_DIR}/$KIT_LC 2>&1 ; STAT=$?
  1337. else # Non verbose mode - no output.
  1338. find . -print | cpio -pudm ${BASE_DIR}/$KIT_LC 2>&- ; STAT=$?
  1339. fi
  1340. else # All other unixes can do it this way.
  1341. find . -print | cpio -pudm${V_SWT} ${BASE_DIR}/$KIT_LC 2>&- ; STAT=$?
  1342. fi
  1343. [ "$STAT" != 0 ] && { # Do this block only if the cpio cmd failed.
  1344. # Old method obsoleted by Linux cpio problems.
  1345. # find . -print | cpio -pudm${V_SWT} ${BASE_DIR}/$KIT_LC 2>&- || {
  1346. print "${ERR}cpio failed copying $KIT to $BASE_DIR/$KIT_LC
  1347. \n\tOne or more files in $KIT failed to copy. Existing file(s)
  1348. \r\tin the $BASE_DIR/$KIT_LC directory may currently be open.
  1349. \r\tThese file(s) may be open by NFS clients using this directory.
  1350. \r\tRe-run $SCRIPTNAME when these file(s) have been closed. " >&2
  1351. FAILED_KITS="$FAILED_KITS $KIT" # Add this kit to failed list.
  1352. (( COPY_ERRORS+=1 )) # Increment the error count.
  1353. continue
  1354. }
  1355. # No directory, look for a tarset. Tarsets are extracted into base dir.
  1356. elif [ -f $SOURCE/${KIT}.tar.Z ] ; then # Compressed Tar file. V190P11.
  1357. chmod 555 ${BASE_DIR}/${KIT_LC} >$NULL 2>&- # in case weird umask.
  1358. print "${MSG}Extracting $KIT to $BASE_DIR/${KIT_LC} ... \c"
  1359. $VECHO ; $VECHO # Cosmetic line feeds for verbose mode.
  1360. # This method uses tar & uncompress.
  1361. cd $BASE_DIR
  1362. uncompress -c $SOURCE/${KIT}.tar.Z | tar -x${V_SWT}f - || {
  1363. print "${ERR}Could not extract compressed tar file: ${KIT}.tar.Z
  1364. \n\tOne or more files in $KIT failed to copy. Existing file(s)
  1365. \r\tin the $BASE_DIR/$KIT_LC directory may currently be open.
  1366. \r\tThese file(s) may be open by NFS clients using this directory.
  1367. \r\tRe-run $SCRIPTNAME when these file(s) have been closed. " >&2
  1368. FAILED_KITS="$FAILED_KITS $KIT" # Add this kit to failed list.
  1369. (( COPY_ERRORS+=1 )) # Increment the error count.
  1370. continue
  1371. }
  1372. else # Couldn't find either one so log it as an error. This shouldnt happen
  1373. # cuz this function is passed a pre-qualified list, but just in case.
  1374. print "${WARN}No product directory, or tarset found in $SOURCE
  1375. \r\tfor $KIT " >&2
  1376. FAILED_KITS="$FAILED_KITS $KIT" # Add this kit to failed list.
  1377. (( COPY_ERRORS+=1 )) # Increment the error count.
  1378. fi
  1379. done
  1380. cd $OLDCWD
  1381. [ "$COPY_ERRORS" -gt 0 -o -n "$FAILED_KITS" ] && {
  1382. FAILED_KITS=${FAILED_KITS#[ ]} # Cosmetics strip leading space.
  1383. print "${ERR}The following kits failed to copy correctly:
  1384. \r\t$FAILED_KITS
  1385. \n\tNumber of errors = $COPY_ERRORS \c"
  1386. }
  1387. echo # Cosmetic echo.
  1388. } # End of Copy_kits
  1389.  
  1390.  
  1391.  
  1392. Copy_license_file() # Copies the user supplied license file to ugflexlm.
  1393. { # RKB 26Mar08 NX6P21 Initial version.
  1394. #
  1395. : ${BASE_DIR:?} # Reqd var ck.
  1396. : ${UGFS_PMT:?} # Reqd var ck.
  1397. #
  1398. # Check this is a file, not server names(s).
  1399. [[ "$UGFS_PMT" = *"/"* ]] || return 0 # Not a file name so just return.
  1400. #
  1401. # Now copy the license file. if we can. As of NX6P21 we do this cp
  1402. # during config part of install.
  1403. #
  1404. # First check we're not trying to copy the same file.
  1405. [ "$UGFS_PMT" = "$UGS_LICENSE_SERVER" ] && return 0 # cant copy same file.
  1406. #
  1407. # Next make sure we can find it then try the copy.
  1408. if [ -f "$UGFS_PMT" ] ; then # Make sure we can find it else give error.
  1409. # Make ugflexlm dir if needed and copy the file to the dir.
  1410. [ -d ${BASE_DIR}/ugflexlm ] || mkdir -p ${BASE_DIR}/ugflexlm 2>&-
  1411. chmod 555 ${BASE_DIR}/ugflexlm >$NULL 2>&-
  1412. $VECHO "${MSG}Copying license file: $UGFS_PMT
  1413. \r\tto: $UGS_LICENSE_SERVER ... "
  1414. cp $UGFS_PMT $UGS_LICENSE_SERVER 2>1 || {
  1415. print "${ERR}Could not copy the license file: $UGFS_PMT
  1416. \r\tto $UGS_LICENSE_SERVER
  1417. \n\tCopy the license file to $UGS_LICENSE_SERVER
  1418. \r\tbefore attempting to run NX."
  1419. }
  1420. else # Couldn't find the file.
  1421. print "${ERR}The license file entered was not found: $UGFS_PMT
  1422. \n\tCopy the license file to $UGS_LICENSE_SERVER
  1423. \r\tbefore attempting to run NX."
  1424. fi
  1425. #
  1426. } # End Copy_license_file
  1427.  
  1428.  
  1429.  
  1430. Create_dt_xsession() # Creates an Xsession.d environment file for CDE.
  1431. { # RKB Created: Apr 17 23:11 95 V105P07
  1432. # RKB 03MAR98 V150P01 Rm ACS specific logic.
  1433. # RKB May 21 1998 V150P03 Add logic for UGFLEXlm.
  1434. # RKB Aug 28 06 NX050P16 Changes for new universal flexlm i.e. ugslmd.
  1435. #
  1436. [ -d "$1" ] || return 1 # Reqd arg ck. Must be an Xsession.d directory.
  1437. : ${2:?} # Reqd arg ck. Scriptname to create.
  1438. #
  1439. # Set FILENAME based on MODIFY_OK.
  1440. if [ "$MODIFY_OK" = yes ] ; then # Ck that we have permission to mod files.
  1441. FILENAME=$1/$2 # Create supplied filename in supplied dir.
  1442. else # Did not want to modify system files. Do it in UGS_TMP.
  1443. FILENAME=$UGS_TMP/$2 # Create supplied filename in ugs tmp.
  1444. fi
  1445. #
  1446. $VECHO "${MSG}Creating CDE environment file: \n\t$FILENAME ..."
  1447. #
  1448. # Now create the actual file.
  1449. cat > $FILENAME <<-END_OF_CAT1
  1450. # Unigraphics Solutions Inc. environment (for CDE).
  1451. # File name: $FILENAME
  1452. # Created by ${SCRIPTNAME} on: `date`
  1453. #
  1454. # NOTE: This script is NOT intended to be customizable.
  1455. # It is always replaced by ${SCRIPTNAME}.
  1456. #
  1457. # $PRODNAME $NX_VER Base directory, as entered during ug_install.
  1458. UGII_BASE_DIR=$BASE_DIR ; export UGII_BASE_DIR
  1459. #
  1460. # $PRODNAME $NX_VER Root directory, as entered during ug_install.
  1461. UGII_ROOT_DIR=\${UGII_BASE_DIR}/bin/ ; export UGII_ROOT_DIR
  1462. #
  1463. END_OF_CAT1
  1464. #
  1465. [ "$UGF_SERVERS" ] && {
  1466. cat >> $FILENAME <<-END_OF_CAT2
  1467. # Unigraphics - FLEXlm license variable, as entered during ug_install.
  1468. UGS_LICENSE_SERVER="$UGF_SERVERS"
  1469. export UGS_LICENSE_SERVER
  1470. #
  1471. END_OF_CAT2
  1472. }
  1473. print "# End $FILENAME " >> $FILENAME
  1474. chmod 555 $FILENAME
  1475. return 0
  1476. #
  1477. } # End of Create_dt_xsession
  1478.  
  1479.  
  1480.  
  1481. Create_prod_link() # Create make a symbolic link for the product (arg1).
  1482. { # RKB Sun Feb 03 19:16:29 PST 1991
  1483. TARGET_DIR=$1 ; : ${TARGET_DIR:?} # Required arg, internal check.
  1484. LINK_DIR=$2 ; : ${LINK_DIR:?} # Required arg, internal check.
  1485. $VECHO "\r\tCreating link: $LINK_DIR to ${TARGET_DIR} ..."
  1486. # If a link dir already exist, remove it.
  1487. [ -h ${LINK_DIR} ] && rm -f ${LINK_DIR} 2>&-
  1488. # If a real dir exists, rename it with pid extension.
  1489. if [ -d ${LINK_DIR} -a ! -h ${LINK_DIR} ] ; then
  1490. $VECHO "\r\texisting real directory saved as ${LINK_DIR}.$$"
  1491. mv ${LINK_DIR} ${LINK_DIR}.$$ 2>&- || {
  1492. print "${ERR}could not rename existing directory: ${LINK_DIR}" >&2
  1493. sleep 3 ; return 1 ;}
  1494. sleep 3
  1495. fi
  1496. # Now create the link for the product.
  1497. ln -sf $TARGET_DIR ${LINK_DIR} || {
  1498. print "${ERR}was not able to create a symbolic link for $PRODUCT" >&2
  1499. return 1
  1500. }
  1501. return 0
  1502. } # End of Create_prod_link.
  1503.  
  1504.  
  1505.  
  1506. Detect_missing_kits_list() # Scan arg list for kits in source dir. Make lists.
  1507. { # RKB Jun 23 04 NX3P19 First iteration.
  1508. # RKB Jul 21 04 NX3P20 Add testonly feature.
  1509. # RKB Jul 29 04 NX3P20 Split Detect function into test and list function.
  1510. #
  1511. # This function makes the MISSING_KITS & FOUND_KITS lists.
  1512. # Arg1 must be the source directory to check. Remaining args will be the
  1513. # kit name to look for in source directory.
  1514. #
  1515. TEST_SRC=$1 ; : ${TEST_SRC:?} # Arg1 is test src. Ck arg1 was set.
  1516. shift 1 # Remaining args are the kits to ck.
  1517. unset MISSING_KITS FOUND_KITS # Clear the kit lists.
  1518. typeset -l KIT_LC # Lowercase version of KIT var.
  1519. for KIT in $* ; do # Ck all the kits on arg list.
  1520. KIT_LC=$KIT # Lowercase version of KIT name.
  1521. # For each kit, check all the possible packaging formats.
  1522. if [ -d $TEST_SRC/$KIT -o \
  1523. -d $TEST_SRC/$KIT_LC -o \
  1524. -f $TEST_SRC/${KIT}.tar* -o \
  1525. -f $TEST_SRC/${KIT_LC}.tar* ]
  1526. then
  1527. FOUND_KITS="$FOUND_KITS $KIT" # Found one form of kit, add to list.
  1528. else # We couldn't find the kit in any known form.
  1529. MISSING_KITS="$MISSING_KITS $KIT" # Missing kit so add it to list.
  1530. fi
  1531. done
  1532. # If there are missing kits return 0 else return 1.
  1533. [ "$MISSING_KITS" ] && return 0 || return 1
  1534. #
  1535. } # End Detect_missing_kits_list.
  1536.  
  1537.  
  1538.  
  1539. Detect_missing_kits_test() # Scan arg list for kits in source dir. Test only.
  1540. { # RKB Jun 23 04 NX3P19 First iteration.
  1541. # RKB Jul 21 04 NX3P20 Add testonly feature.
  1542. # RKB Jul 29 04 NX3P20 Split Detect function into test and list function.
  1543. #
  1544. # This function does a test only, returns 1 if any kits are missing.
  1545. # Arg1 must be the source directory to check. Remaining args will be the
  1546. # kit name to look for in source directory.
  1547. #
  1548. TEST_SRC=$1 ; : ${TEST_SRC:?} # Arg1 is test src. Ck arg1 was set.
  1549. shift 1 # Remaining args are the kits to ck.
  1550. typeset -l KIT_LC # Lowercase version of KIT var.
  1551. for KIT in $* ; do # Ck kits on remaining arg list.
  1552. KIT_LC=$KIT # Lowercase version of each KIT name.
  1553. # For each kit, check all the possible packaging formats. If any test
  1554. # returns true, we will continue to the next kit name.
  1555. [ -d $TEST_SRC/$KIT ] ||
  1556. [ -d $TEST_SRC/$KIT_LC ] ||
  1557. [ -f $TEST_SRC/${KIT}.tar* ] ||
  1558. [ -f $TEST_SRC/${KIT_LC}.tar* ] || return 1 # Return 1 on first missing kit.
  1559. # If none of above tests passed we couldn't find the kit in any known form.
  1560. done
  1561. return 0 # Finished list with no kits missing.
  1562. #
  1563. } # End Detect_missing_kits_test.
  1564.  
  1565.  
  1566.  
  1567. Display_main_screen() # Display the second screen. i.e. the main menu.
  1568. { # RKB Apr 6 10:48 93
  1569. # RKB Feb 28 17:41 95 V105P01. Chng awk to use substr so it works on AIX.
  1570. # RKB May 8 17:05 98 V150P03. Multiple changes for UGFLEXlm.
  1571. # RKB Jun 30 16:00 05 NX4P16. Add quotes to echoes with [ for HP 11i bug.
  1572. # RKB Jan 26 07 NX5P24 Rm FLEXlm server logic.
  1573. # RKB Feb 20 08 NX6P19 Chg to allow standalone license file or server names.
  1574. clear
  1575. # Display the header for this menu.
  1576. print "\r\t$PRODNAME $NX_VER Installation `date`"
  1577. print "\r\tEnter '?' for help, '!' for shell, or 'q' to quit at any prompt."
  1578. print "\r\tMain Menu. 'n/a' indicates item is not applicable"
  1579. # Display the main body of this menu. Double quotes added in NX4P16.
  1580. ( # Do all these echoes in a subshell to use the awk same formating.
  1581. print "\n${INS_FLAG:=$TAB}1. UG Installation type."% "[${INS_TYPE}]"
  1582. print "\n${SRC_FLAG:=$TAB}2. SOURCE directory."% "[${SRC_PMT}]"
  1583. print "\n${BASE_FLAG:=$TAB}3. BASE directory."% "[$BASE_PMT]"
  1584. print "\n${MOD_FLAG:=$TAB}4. O.K. to MODIFY system files."% "[$MOD_PMT]"
  1585. print "\n${UGFS_FLAG:=$TAB}5. License server(s) or a filename."% "[$UGFS_PMT]"
  1586. ) | awk -F% '{
  1587. if ( NF < 2 ) { print $0 ; next ;} # Print header lines.
  1588. size=79-length($1)-length($2)-7 # Calculate size of fill txt.
  1589. if ( size <= 1 ) size=1 # Must be at least 1 .
  1590. printf("%s%s%s",$1,substr(" '$FILL_TXT' ",0,size),$2) # Now printf it.
  1591. }' # End of the awk formatting.
  1592. #
  1593. echo # Cosmetic line feed.
  1594. #
  1595. # If there's any error flags spit out reenter message.
  1596. print "$INS_FLAG $SRC_FLAG $BASE_FLAG $MOD_FLAG
  1597. $UGFT_FLAG $UGFF_FLAG $UGFS_FLAG " \
  1598. | grep "\*" >$NULL && {
  1599. print "\n\tItem(s) marked '${REENTER}' must be corrected:"
  1600. [ "$INS_MSG" ] && print "\tItem 1: $INS_MSG"
  1601. [ "$SRC_MSG" ] && print "\tItem 2: $SRC_MSG"
  1602. [ "$BASE_MSG" ] && print "\tItem 3: $BASE_MSG"
  1603. [ "$MOD_MSG" ] && print "\tItem 4: $MOD_MSG"
  1604. [ "$UGFS_MSG" ] && print "\tItem 5: $UGFS_MSG"
  1605. } # End flag check.
  1606. return 0
  1607. } # End Display_main_screen
  1608.  
  1609.  
  1610.  
  1611. Display_screen3() # Displays screen 3 i.e. the product menu.
  1612. { # RKB Tue Apr 6 18:25:00 PDT 1993
  1613. # RKB rewrite Jul 12 15:47 1993 NEW V10.1 use PRODUCTS to display arrays.
  1614. # RKB updt: Nov 9 15:08 93 Add "load" word to screen display.
  1615. # RKB updt: Mar 7 14:56 94 V103P2E Add display for Kb & Mb total space.
  1616. # RKB updt: Mar 7 00:30 95 V105P01. Rm reqd logic for ADMIN & Sun LIB.
  1617. # RKB updt: May 19 12:59 99 V160P09. Rm reqd logic for UGFLEXLM & UGII.
  1618. # RKB updt: Jul 25 03 V020P21 Chng SPACE_REQUIRED_MB to 4 digits.
  1619. # RKB updt: Jun 04 04 NX3P17 Chng Kit field to 14 chars & other adjustments.
  1620. # RKB updt: Apr 29 05 NX4P11 Chng some awk syntax for Linux.
  1621. clear
  1622. # Display the header for this menu.
  1623. print "\r\t $PRODNAME $NX_VER Installation `date`"
  1624. print "\r\t Product Selection Menu. '-->' = selected, '**' = required. "
  1625. print "\n\t # Name Kbytes Directory" # Titles
  1626. # Display the main body of this menu i.e. the available products.
  1627. ( # Do the following section in the same subshell, to pipe to awk.
  1628. # Loop thru the list of kits in PRODUCTS. except item 0.
  1629. unset PRODUCTS[0]
  1630. for KIT in ${PRODUCTS[*]} ; do
  1631. eval echo "\${${KIT}[*]}"
  1632. done
  1633. ) | $AWK_CMD ' $3!~/[A-Z|a-z].*/ {next} { # Skip lines w/o letters in Field3.
  1634. if( $3 == "UGFLEXLM" ) { $3=$3"**"} # Put required flag on UGFLEXLM
  1635. if( $3 == "UGII" ) { $3=$3"**"} # Put required flag on UGII
  1636. # If Field1 shows selected, print Fields 1-5, else print Fields 2-5.
  1637. if( $1 == "'$SELECTED'" )
  1638. # Sp Sel Num Kit Size Directory
  1639. { printf(" %-3s %2s %-14s %6s %-26s\n",$1,$2,$3,$4,$5)}
  1640. else
  1641. # Spaces Num Kit Size Directory
  1642. { printf(" %2s %-14s %6s %-26s\n",$2,$3,$4,$5)}
  1643. }'
  1644.  
  1645. typeset -R8 SPACE_REQUIRED_KB=$SPACE_REQUIRED_KB
  1646. typeset -L4 SPACE_REQUIRED_MB=$SPACE_REQUIRED_MB
  1647. print "\tTotal Disk space: $SPACE_REQUIRED_KB (${SPACE_REQUIRED_MB} Mb)"
  1648. print "\n\t95) Change dirs. 96) Select required 97) All 98) None 99) Load"
  1649. } # End of Display_screen3
  1650.  
  1651.  
  1652.  
  1653. Display_selected() # Display the selected products and their filesystem.
  1654. { # RKB Mon Jan 28 21:53:50 PST 1991
  1655. # RKB updtd: Aug 24 16:22 1993 V10ph3c change to open ended product list.
  1656. clear
  1657. echo
  1658. ( print " X KIT KIT CURRENT FILE"
  1659. print " X NAME SIZE DIRECTORY SYSTEM "
  1660. ) | $AWK_CMD '{ printf("\t%-12s %-8s %-25s %-10s\n",$2,$3,$4,$5)} '
  1661. echo
  1662. ( # Do the following section in the same shell, to pass to awk.
  1663. # Fixed directory products are not listed.
  1664. # Loop thru the list of kits in PRODUCTS. except item 0.
  1665. unset PRODUCTS[0]
  1666. for KIT in ${PRODUCTS[*]} ; do
  1667. [ $KIT = UGFLEXLM ] && continue # cant move acs
  1668. I=`eval echo \\${$KIT[5]}`
  1669. eval print "\${${KIT}[*]} \${FS_NAME[$I]}"
  1670. done
  1671. ) | $AWK_CMD '{ if( $1 == "'$SELECTED'" )
  1672. { printf("\t%-12s %-8d %-25s %-10s\n",$3,$4,$5,$7)}
  1673. }'
  1674. echo # Cosmetic line feed.
  1675. (
  1676. print "SPACE left after load:"
  1677. COUNT=0
  1678. while [ ${COUNT} -lt ${#FS_NAME[*]} ] ; do
  1679. print "${FS_NAME[$COUNT]} = ${FS_FREE[$COUNT]}"
  1680. let COUNT=COUNT+1
  1681. done
  1682. ) | pr -ato8 -3
  1683. } # End of Display_selected.
  1684.  
  1685.  
  1686.  
  1687. Deselect() # RKB unselects a product, requires 1 arg.
  1688. { # RKB Updated for ksh arrays: Thu May 10 14:02:10 PDT 1990
  1689. # RKB updtd Jul 8 00:51 1993 rm swap space logic
  1690. # RKB updtd Jul 8 19:41 1993 NEW for V10.1 use faster ksh arithmetic.
  1691. # RKB updtd Feb 1 17:03 1994 removed 'p' switch from the sed command.
  1692. # RKB Jun 17 04 NX3P18 Chng FSETS logic in prep for multi CD installs.
  1693. #
  1694. : ${1:?} # Required product name arg check.
  1695. [ "`eval echo \\${${1}[0]}`" = "$SELECTED" ] || return 0
  1696. PROD_SIZE=`eval echo \\${${1}[3]}` ; : ${PROD_SIZE:=0}
  1697. PROD_INDEX=`eval echo \\${${1}[5]}` ; : ${PROD_INDEX:=0}
  1698. # Subract product size from space required var.
  1699. let SPACE_REQUIRED_KB=$SPACE_REQUIRED_KB-$PROD_SIZE
  1700. # Add product size to free space array.
  1701. let FS_FREE[$PROD_INDEX]=${FS_FREE[$PROD_INDEX]}+$PROD_SIZE
  1702. # Subract product size from the needed space array.
  1703. let FS_NEEDED[$PROD_INDEX]=${FS_NEEDED[$PROD_INDEX]}-$PROD_SIZE
  1704. set -f
  1705. FSETS=`echo $FSETS | sed "s!$1!!"` # Rm prod name from FSETS var.
  1706. set +f
  1707. eval `echo ${1}[0]=\\$UNSELECTED` # Mark this product unselected.
  1708. return 0
  1709. } # End of Deselect
  1710.  
  1711.  
  1712.  
  1713. Get_fsindex() # Get the index number to supplied file system name.
  1714. { # RKB Mon Jan 21 21:00 91
  1715. # RKB Mar 8 23:59 94 V103P2E chg to use while loop not grep -n. faster.
  1716. : ${FS_NAME[*]:?} # Required variable internal check.
  1717. : ${1:?} # Required arg internal check.
  1718. I=0 # Init the index counter
  1719. # Loop thru the FS_NAME array to get index number for filesystem in arg 1.
  1720. while [ $I -le ${#FS_NAME[*]} ] ; do
  1721. [ $1 = "${FS_NAME[$I]}" ] && { echo $I ; return 0 ;}
  1722. ((I+=1)) # Increment the index.
  1723. done
  1724. unset FS_INDEX ; return 1 # Didn't find the file system.
  1725. } # End of Get_fsindex
  1726.  
  1727.  
  1728.  
  1729. Get_fs_info() # Returns filesystem info for the directory argument.
  1730. { # RKB Mon Sep 30 15:21:11 PDT 1991
  1731. # RKB updtd: Jul 6 13:20 1993 V10.1.1 make generic, add Solaris.
  1732. # RKB updtd: Aug 10 23:41 1993 V10.1p2 switch to 1024 byte blocks.
  1733. # RKB updtd: Oct 13 13:21 1993 Add IRIX specific stuff.
  1734. # Requires 2 global variables.
  1735. : ${DF_CMD:?cmd var must be set to use this function.}
  1736. : ${AWK_CMD:?cmd var must be set to use this function.}
  1737. # Requires 2 args; a switch and a target directory.
  1738. TARGET=$2 ; : ${TARGET:?} # Internal check
  1739. #
  1740. # If dir doesn't exist, check parent.
  1741. while [ ! -d $TARGET ] ; do
  1742. [ -f $TARGET ] && { # error if a file exists.
  1743. print "${ERR}directory name expected. file exists: $TARGET" >&2
  1744. return 1 ;}
  1745. TARGET=`dirname $TARGET`
  1746. done
  1747. #
  1748. # Do appropriate action based on the switch. The options are:
  1749. # use -sp to get free space, -fs for real filesystem name, -mnt returns
  1750. # the mount point and -nfs returns true if the filesystem is NFS mounted,
  1751. # and false if it's not.
  1752. #
  1753. # Set machine specific number for the df field containing filesystem.
  1754. [ $MACHINE = IRIX -o $MACHINE = IRIX64 ] && N=6 || N=5
  1755. case $1 in
  1756. -fs*) $DF_CMD $TARGET | tr "\012" " " | $AWK_CMD '{print $(NF-'$N')}' ;;
  1757. -mnt*) $DF_CMD $TARGET | tr "\012" " " | $AWK_CMD '{print $NF}' ;;
  1758. -nfs) $DF_CMD $TARGET | tr "\012" " " | $AWK_CMD '{print $(NF-'$N')}' | grep ":/" >$NULL || return 1 ;;
  1759. -sp*) $DF_CMD $TARGET | tail -1 | $AWK_CMD '{printf("%d",$(NF-2))}' ;;
  1760. esac
  1761. return 0
  1762. } # Get_fs_info
  1763.  
  1764.  
  1765.  
  1766. Help_install() # Display a range of the help file, indexed by arg 1.
  1767. { # RKB Mar 25 23:41:23 1993 V10p11.
  1768. # RKB Apr 21 11:23:23 1993 Take out the reformatting stuff for speed.
  1769. # RKB Mar 9 23:26 94 V103P2E add search for help file.
  1770. # RKB Mar 16 23:59 94 V103P3B mv inline comments out of sed script for OSF.
  1771. # RKB Nov 1 15:21 94 V104P12 add CR to continue at end of help screen.
  1772. # Requires 1 argument, the help code.
  1773. : ${1:?} # Internal check.
  1774. # Requires 2 variables.
  1775. : ${SCRIPTNAME:?'not defined for use with help.'} # Internal check
  1776. : ${SCRIPTDIR:?'not defined for use with help.'} # Internal check
  1777. # If not already set, look for the file.
  1778. [ "$HELPFILE" ] || {
  1779. # Make sure we can find the help file, either here or in SOURCE directory.
  1780. for DIR in $SCRIPTDIR $SOURCE $SOURCE/INSTALL $SOURCE/install \
  1781. $SRC_PMT $SRC_PMT/INSTALL $SRC_PMT/install
  1782. do
  1783. [ -f $DIR/${SCRIPTNAME}.hlp ] && {
  1784. HELPFILE=$DIR/${SCRIPTNAME}.hlp
  1785. break # found it, we're done.
  1786. }
  1787. done
  1788. }
  1789. # Ck the helpfile exists.
  1790. [ -f "$HELPFILE" ] || {
  1791. print "${WARN}could not find ${SCRIPTNAME}.hlp
  1792. \r\thelp is not available. "
  1793. return 1
  1794. }
  1795. echo # Cosmetic line feed.
  1796. #
  1797. # The following sed script uses a range of lines from Arg 1 thru "END_"Arg 1.
  1798. # It then deletes those lines, and prints the rest. In other words,
  1799. # it prints an inclusive range without the 1st and last lines.
  1800. sed -n "/^\($1\)/,/^END_$1/ {
  1801. /^[$1,END_$1]/d
  1802. p
  1803. }" $HELPFILE | more
  1804. print "\n\n\tEnter <CR> after reading help. \c" ; read CR
  1805. return 0
  1806. } # End Help_install
  1807.  
  1808.  
  1809.  
  1810. Init_fs_arrays() # Initializes the File System array.
  1811. { # RKB Thu Jan 31 22:39:57 PST 1991
  1812. # RKB Updated: Sep 28 15:26:28 PDT 1992
  1813. # RKB updtd: Jul 6 22:51 93 V10.1.1 make generic.
  1814. # RKB updtd: Mar 7 18:34 94 V103P2E streamline, rm "set --".
  1815. # RKB updtd: Mar 9 22:34 94 V103P2E rm test -s for FS_FILE, just wait for it.
  1816. # This function initializes the FS_NAME & FS_FREE
  1817. # arrays based on the contents of $FS_FILE
  1818. FS_FILE="$UGS_TMP/filesystem_info" # File name to read the results from.
  1819. $VECHO "${MSG}Initializing File System array ..."
  1820. wait $SIZE_FS_PID # in case the file is not ready, wait for the bg job.
  1821. I=0 # Initialize the index
  1822. cat $FS_FILE | while read NAME SPACE ; do
  1823. FS_NAME[$I]=$NAME ; FS_FREE[$I]=${SPACE:=0} ; FS_NEEDED[$I]=0
  1824. ((I+=1)) # Increment the index.
  1825. done
  1826. return 0
  1827. } # End of Init_fs_arrays
  1828.  
  1829.  
  1830.  
  1831. Init_fs_arrays() # Initializes the File System array.
  1832. { # RKB Thu Jan 31 22:39:57 PST 1991
  1833. # RKB Updated: Sep 28 15:26:28 PDT 1992
  1834. # RKB updtd: Jul 6 22:51 93 V10.1.1 make generic.
  1835. # RKB updtd: Mar 7 18:34 94 V103P2E streamline, rm "set --".
  1836. # RKB updtd: Mar 9 22:34 94 V103P2E rm test -s for FS_FILE, just wait for it.
  1837. # RKB updtd: Wed Apr 20 2005 NX4P11 Added Linux support.
  1838. # This function initializes the FS_NAME & FS_FREE
  1839. # arrays based on the contents of $FS_FILE
  1840. FS_FILE="$UGS_TMP/filesystem_info" # File name to read the results from.
  1841. $VECHO "${MSG}Initializing File System array ..."
  1842. wait $SIZE_FS_PID # in case the file is not ready, wait for the bg job.
  1843. I=0 # Initialize the index
  1844. # Linux
  1845. # cat $FS_FILE | while read NAME SPACE ; do
  1846. # Linux cant do "cat file | while read" "must use while read done < file"
  1847. while read NAME SPACE ; do
  1848. FS_NAME[$I]=$NAME ; FS_FREE[$I]=${SPACE:=0} ; FS_NEEDED[$I]=0
  1849. ((I+=1)) # Increment the index.
  1850. done < $FS_FILE
  1851. return 0
  1852. } # End of Init_fs_arrays
  1853.  
  1854.  
  1855.  
  1856. Init_prod_arrays() # Initialize the product arrays
  1857. { # RKB Mon May 14 16:32:01 PDT 1990
  1858. # RKB Updated Jan 23 1991
  1859. # RKB Updated Feb 05 11:12 1991
  1860. # RKB Updated Jun 7 22:51 1993 V10ph13g. Add ughelp kit.
  1861. # RKB re-write Jul 10 23:55 1993 NEW for V10.1 source the dat file.
  1862. # RKB updtd: Mar 9 00:28 94 V103P2E added double cks for FS_INDEX.
  1863. # RKB updtd: Mar 9 23:01 94 V103P2E add cks in SOURCE dir for SCRIPTNAME.dat
  1864. $VECHO "${MSG}Initializing Product arrays ..."
  1865. SPACE_REQUIRED_KB=0
  1866. # Get the mount point for BASE_DIR.
  1867. BASE_MNT_PT=`Get_fs_info -mnt $BASE_DIR` || {
  1868. print "${WARN}could not determine mount point for $BASE_DIR
  1869. \r\tFilesystem information may be incorrect. "
  1870. } # Shouldn't be any problem, but just to be safe.
  1871. FS_INDEX=`Get_fsindex $BASE_MNT_PT` || {
  1872. print "${WARN}could not determine filesystem containing $BASE_DIR
  1873. \r\tspace calculations may be incorrect. "
  1874. } # Shouldn't be any problem, but just to be safe.
  1875. #
  1876. # Make sure we can find the dat file, either here or in SOURCE directory.
  1877. for DIR in $SCRIPTDIR $SOURCE $SOURCE/INSTALL $SOURCE/install ; do
  1878. [ -f $DIR/${SCRIPTNAME}.dat ] && {
  1879. DAT_FILENAME=$DIR/${SCRIPTNAME}.dat
  1880. break # found it, we're done.
  1881. }
  1882. done
  1883. # Now double check that we found it.
  1884. [ -f $DAT_FILENAME ] || {
  1885. print "${ERR}Could not find ${SCRIPTNAME}.dat
  1886. \r\tthe install cannot be completed without it." >&2
  1887. return 1
  1888. }
  1889. #
  1890. # Now initialize the arrays by sourcing (dot-spacing) the dat file.
  1891. . $DAT_FILENAME || {
  1892. print "${ERR}Could not 'source' the ${SCRIPTNAME}.dat file.
  1893. \r\tthe install cannot complete without the data in this file." >&2
  1894. return 1
  1895. }
  1896. #
  1897. # The PRODUCT array is a list of all the available kits, each element
  1898. # contains the name of a kit. Each element number MUST match the number
  1899. # in element 1 of the kit arrays - this becomes the menu number.
  1900. # i.e. PRODUCT[2]=ADMIN so must ADMIN[1]=2
  1901. #
  1902. # Each kit array is initially defined as follows.
  1903. # PROD[0]=$UNSELECTED flag. PROD[1]=Product Selection Menu number.
  1904. # PROD[2]=product name. PROD[3]=product size. PROD[4]=product directory
  1905. # PROD[5]=initial index into FS_NAME array.
  1906. # Element 4 & 5 are defined as variables which are expanded at run time.
  1907. #
  1908. return 0
  1909. } # End of Init_prod_arrays.
  1910.  
  1911.  
  1912.  
  1913. Kill_ug() # RKB Kills all known UGII processes.
  1914. { # RKB Jun 11 98 V150P03 updated for UG FLEXlm processes.
  1915. # RKB updtd: Aug 28 06 NX050P16 Changes for new universal flexlm i.e. ugslmd.
  1916. # RKB Feb 15 07 NX5P25 Rm lmgrd & ugslmd. Now done in ugslicensing_install.
  1917. $VECHO "${MSG}Terminating UNIGRAPHICS processes ..."
  1918. for PROC in pqmgr ugii906 ugii925 ugiigrb ugiihp ugiips uglpplot ugnetplot \
  1919. ugplot ugiipqd pfk_daemon sballd_ugx ugraf
  1920. do
  1921. $PS_CMD | grep -v grep | grep "$PROC" > /dev/null && {
  1922. set -- `$PS_CMD | grep -v grep | grep "${PROC}"`
  1923. kill $2 >$NULL 2>&- || kill -9 $2 >$NULL 2>&-
  1924. }
  1925. done
  1926. # AIX ONLY
  1927. [ "$MACHINE" = "AIX" ] && slibclean
  1928. } # End of Kill_ug
  1929.  
  1930.  
  1931.  
  1932. Link_all_products() # RKB Create the symbolic links from bin to prod dirs.
  1933. { # Created: Wed May 16 15:41:38 PDT 1990
  1934. # Updated: Thu Oct 3 00:33:12 PDT 1991 V9 ph 4.
  1935. # RKB updtd: Aug 23 22:19 93 V10.1p3c change to catch .ugii_env on Sun.
  1936. # RKB updtd: Aug 23 22:19 93 V10.1p3c use PRODUCTS for list for links.
  1937. # RKB updtd: Nov 9 17:05 93 V10.2ph2d add special links for shading stuff.
  1938. # RKB updtd: Dec 9 14:34 93 V10.2ph2j change ugshading to ugrender.
  1939. # RKB updtd: Feb 17 17:57 94 V10.3P2B rm logic for eds_reset.
  1940. # RKB updtd: Mar 22 22:33 94 V103P3b add search logic for .dat file.
  1941. # RKB updtd: Apr 6 16:53 94 V103P3D Chng .dat file test for SGI.
  1942. # RKB updtd: Oct 12 23:50 94 V104P09 Chng ugrender to ugphoto.
  1943. # RKB updtd: Mar 25 13:30 96 V111P07 Added 2 uai files for GFEM.
  1944. # RKB updtd: May 5 01:06 99 V160P08 Ck for $BASE_DIR/ugii may not be there.
  1945. # RKB updtd: May 18 11:38 99 V160P09 Rm links for GFEM kit - obsolete.
  1946. # RKB updtd: Jun 15 17:08 99 V160P11 Add case for kits that do NOT need links.
  1947. # RKB updtd: Jun 29 01:31 99 V160P12 Rm util directory.
  1948. # RKB updtd: Jul 12 13:52 99 V160P13 Shorten list for sym links.
  1949. # RKB updtd: Jul 27 16:02 99 V160P14 Add UGMANAGER back to list for links.
  1950. # RKB updtd: Aug 19 17:44 99 V160P16 Rm MACH kit from list for links.
  1951. # RKB Jun 17 04 NX3P18 Chng FSETS logic in prep for multi CD installs.
  1952. # RKB Jun 17 04 NX3P18 Chng PLOT to NXPLOT.
  1953. # RKB May 09 05 NX4P12 Added custom links for TOLSTACKUP.
  1954. # RKB Dec 11 07 NX6P16 Change .ugii_env to ugii_env.dat.
  1955. #
  1956. Check_root_access ${BASE_DIR}/bin || return 0 # Can't do this without root.
  1957. OLD_PWD=`pwd` # Save wherever we are.
  1958. # Create links from list of selected products or product list in dat file.
  1959. if [ "$FSETS" ] ; then # Use FSETS if it's set.
  1960. PRODUCT_LIST=$FSETS # Set PRODUCT_LIST to FSETS.
  1961. elif [ "${PRODUCTS[*]}" ] ; then # If PRODUCTS array is set use that.
  1962. PRODUCT_LIST=${PRODUCTS[*]}
  1963. else # Array wasn't set so search for then source the dat file.
  1964. # Make sure we can find the dat file, in likely directories.
  1965. unset DAT_FILENAME
  1966. for DIR in $SCRIPTDIR $SCRIPTDIR/INSTALL $SCRIPTDIR/install \
  1967. ${BASE_DIR}/INSTALL ${BASE_DIR}/install ${BASE_DIR}/bin \
  1968. $SOURCE $SOURCE/INSTALL $SOURCE/install
  1969. do
  1970. [ -f $DIR/${SCRIPTNAME}.dat ] || continue 1 # Not found, try next.
  1971. DAT_FILENAME=$DIR/${SCRIPTNAME}.dat
  1972. break 1 # found it, we're done.
  1973. done
  1974. # Double check that we found it.
  1975. if [ -f "$DAT_FILENAME" ] ; then
  1976. # Initialize PRODUCTS array by sourcing (dot-spacing) the dat file.
  1977. . "$DAT_FILENAME" || { # Ck we can sucessfully source it.
  1978. print "${ERR}Could not 'source' the ${SCRIPTNAME}.dat file.
  1979. \r\tNo product links created. " >&2
  1980. return 1
  1981. }
  1982. PRODUCT_LIST=${PRODUCTS[*]}
  1983. else
  1984. print "${ERR}Could not find ${SCRIPTNAME}.dat
  1985. \r\tNo product links created. " >&2
  1986. return 1
  1987. fi
  1988. fi
  1989. #
  1990. # Should now have a list of products, create the file links.
  1991. typeset -l PRODUCT_DIR # Make a var for lowercase directory name.
  1992. for PRODUCT_NAME in $PRODUCT_LIST ; do
  1993. #
  1994. # Parse the kit list and make file level links for the kits that need it.
  1995. case $PRODUCT_NAME in # Check the product name. NX3P18 Ren PLOT to NXPLOT.
  1996. ADMIN|MECH|NXPLOT|UGMANAGER|UGII|UGPHOTO) : # LINKS REQD for these.
  1997. ;;
  1998. *) continue 1 # Anything else we skip - they don't need links. V160P13.
  1999. ;;
  2000. esac
  2001. #
  2002. # Now process the rest on the list.
  2003. #
  2004. PRODUCT_DIR=$PRODUCT_NAME # Make it lowercase.
  2005. # See if this kit is actually installed.
  2006. [ -d ${BASE_DIR}/${PRODUCT_DIR} ] || continue # If not, Just skip it.
  2007. #
  2008. # Now go in the kit directory and make a list.
  2009. cd ${BASE_DIR}/${PRODUCT_DIR} || { # Check dir is accessible.
  2010. print "${ERR}could not change directory to $BASE_DIR/${PRODUCT_DIR}
  2011. \r\tNo symbolic links can be created for ${PRODUCT_NAME}." >&2
  2012. continue ; } # Couldn't even get into the directory so skip this one.
  2013. FILELIST=`ls` # Old method - gets every file in the directory.
  2014. cd ${BASE_DIR}/bin # Should be in 'bin' to create relative soft links.
  2015. $VECHO "\r\tCreating symbolic links for $PRODUCT_NAME files in `pwd` ..."
  2016. # Now make the links.
  2017. for FILENAME in $FILELIST ; do
  2018. # Remove the old links.
  2019. [ -f ./$FILENAME -o -h ./$FILENAME ] && rm -rf ./$FILENAME 2>&-
  2020. ln -sf ../${PRODUCT_DIR}/$FILENAME ./$FILENAME || {
  2021. print "${ERR}could not create symbolic link:
  2022. \r\t`pwd`/$FILENAME to ../${PRODUCT_DIR}/$FILENAME" >&2
  2023. }
  2024. done # Done with all the files in this directory.
  2025. #
  2026. #
  2027. # Some special links.
  2028. [ $PRODUCT_NAME = "UGII" -a -d $BASE_DIR/ugii ] && { # links for ugii files.
  2029. cd $BASE_DIR/bin
  2030. rm -rf ugii_env.dat ; ln -sf ../ugii/ugii_env.dat ./ugii_env.dat
  2031. # Create link to textures dir if it exists in ugphoto.
  2032. cd $BASE_DIR/ugii
  2033. [ -d $BASE_DIR/ugphoto/textures -a ! -d ./textures ] && {
  2034. rm -f ./textures 2>&- ; ln -sf ../ugphoto/textures ./textures 2>&-
  2035. }
  2036. }
  2037. #
  2038. # Special cross link for ugphoto.
  2039. [ $PRODUCT_NAME = "UGPHOTO" -a -d $BASE_DIR/ugphoto ] && { # for ugphoto.
  2040. # Create link to materials dir if exists in ugii but not in ugphoto.
  2041. cd $BASE_DIR/ugphoto
  2042. [ -d $BASE_DIR/ugii/materials -a ! -d ./materials ] && {
  2043. rm -f materials 2>&- ; ln -sf ../ugii/materials ./materials 2>&-
  2044. }
  2045. }
  2046. #
  2047. # Custom logic for TOLSTACKUP (a.k.a TSV) sym links. Added 040P12.
  2048. # Check if it is installed then create sym links for eai libs in ugii.
  2049. TSV_LIBS=tolstackup/eailib # TOLSTACKUP library dir.
  2050. [ -d $BASE/$TSV_LIBS ] && ( # Do this in a subshell so we revert to $OLDCWD
  2051. FILELIST=$(ls $BASE/$TSV_LIBS )
  2052. cd $BASE/ugii
  2053. for FILE in $FILELIST ; do
  2054. rm -rf $FILE 1>&- 2>&- # Rm old one first cuz SunOS cant do a ln -sf.
  2055. ln -s ../$TSV_LIBS/$FILE $FILE >$NULL 2>&- || { # Create the link.
  2056. print "${WARN}could not create symbolic link:
  2057. \r\t`pwd`/$FILE to ../$TSV_LIBS/$FILE" >&2
  2058. }
  2059. done
  2060. ) # End TOLSTACKUP stuff.
  2061. #
  2062. done # Done with the PRODUCT_LIST.
  2063. cd $OLD_PWD
  2064. } # End of Link_all_products
  2065.  
  2066.  
  2067.  
  2068. Load_selected_kits() # Controls loading of kits from multiple sources (CD's.)
  2069. { # RKB Jul 8 04 NX030P19 First iteration.
  2070. # RKB Jul 21 04 NX030P20 Chngs to call Detect function in current shell.
  2071. # RKB Jul 29 04 NX030P20 Chng to use Detect_missing_kits[list|test] functions.
  2072. # RKB Aug 30 04 NX030P21a Add the Checking for selected kits message.
  2073. #
  2074. # Initialize flag and control variables.
  2075. KIT_CKLIST=$FSETS # Initially set KIT_CKLIST to $FSETS.
  2076. : ${KIT_CKLIST:?} # Internal var ck.
  2077. unset SOURCE2 # Make sure SOURCE2 is not set yet.
  2078. FIRST_PASS=true # Flag to control message of Ask_source2
  2079. NO_FURTHER_MSG="No further user input required ..." # Message and flag.
  2080. FURTHER_MSG="Further user input will be required ..." # Message.
  2081. #
  2082. # Control loop to copy kits from multiple sources. On the first pass, the
  2083. # SOURCE directory will be the initial value set by Check_source.
  2084. # The KIT_CKLIST is the kits selected by the user (FSETS) in Select_products.
  2085. # If all the kits in KIT_CKLIST are found in SOURCE we proceed to load them
  2086. # all with no further user input. If ANY kits are missing in the SOURCE dir
  2087. # we prompt for a second source (SOURCE2) to look for MISSING_KITS. On the
  2088. # first pass we can ask for SOURCE2 in advance of loading any kits so that
  2089. # the user can walk away. If we don't get a SOURCE2 we have to ask for it
  2090. # again after we load the first batch of kits that we found. The loop will
  2091. # continue until all the MISSING_KITS are found and copied.
  2092.  
  2093. $VECHO "${MSG}Checking for selected kits ..."
  2094.  
  2095. while true ; do # Loop until all the kits are copied.
  2096.  
  2097. # Call Detect_missing_kits_list to see if there are any missing kits. This
  2098. # sets FOUND_KITS and MISSING_KITS. If none missing goto else.
  2099. Detect_missing_kits_list $SOURCE $KIT_CKLIST
  2100.  
  2101. # Test for missing kit. This is set if any kits are missing in SOURCE.
  2102. if [ "$MISSING_KITS" ] ; then # There were some missing kits.
  2103.  
  2104. # We do have some MISSING kits so display missing kits message.
  2105. print "${NOTE}The following selected kits are not located in the source
  2106. \r\tdirectory: $SOURCE
  2107. \r\tkit(s): $MISSING_KITS"
  2108.  
  2109. # On very 1st pass ask for 2nd source in advance of any loading kits.
  2110. [ "$FIRST_PASS" ] && { # This is the first pass thru loop.
  2111. if [ "$SRC_PMT2" ] ; then # 2nd src already set in env/ans file.
  2112. print "${MSG}Using the alternate source directory specified in
  2113. \r\tanswer file or env: $SRC_PMT2"
  2114. SOURCE2=$SRC_PMT2 # Just use 2nd src prompt.
  2115. else # It wasn't set so ask for it.
  2116. Ask_source2 -initial # Ask for another source in advance.
  2117. fi
  2118. # We either asked for 2nd source or it was set in env or ans file.
  2119. if [ "$SOURCE2" ] ; then # Now ck if user entered 2nd source
  2120. # Do a quick go/no go test to see SOURCE2 has the missing kits.
  2121. if Detect_missing_kits_test $SOURCE2 $MISSING_KITS ; then
  2122. print "${MSG}${NO_FURTHER_MSG}"
  2123. unset NO_FURTHER_MSG # Only want to display this msg once.
  2124. else
  2125. print "${MSG}${FURTHER_MSG}"
  2126. fi
  2127. else # We didn't get a second source, inform user it's still needed.
  2128. print "${MSG}${FURTHER_MSG}"
  2129. fi
  2130. } # End of FIRST_PASS ck.
  2131.  
  2132. # We do the rest on ALL passes of the loop.
  2133.  
  2134. # If we have some FOUND_KITS, so copy them from SOURCE dir.
  2135. [ "$FOUND_KITS" ] && Copy_kits $FOUND_KITS
  2136. unset FIRST_PASS # Unset the flag after the 1st copy pass.
  2137.  
  2138. # If we haven't got a 2nd source yet we must ask for it now.
  2139. [ "$SOURCE2" ] || Ask_source2 -next || { # Returns 1 only if user quits.
  2140. print "${WARN}The following kits were not copied: $MISSING_KITS"
  2141. break # Break out of the while loop.
  2142. }
  2143. # If we didn't get a good SOURCE2 we'll keep looping back and
  2144. # failing until a good SOURCE2 is entered. Or user quits.
  2145.  
  2146. SOURCE=$SOURCE2 # Set the source dir to the new source.
  2147. unset SOURCE2 # Unset so we ask again on next pass.
  2148.  
  2149. KIT_CKLIST=$MISSING_KITS # Set kit cklist to the missing kits.
  2150. continue # Loop back and check for MISSING_KITS.
  2151.  
  2152. else # There were NO missing kits, so just do it on 1st pass like normal.
  2153. [ "${NO_FURTHER_MSG}" ] && print "${MSG}${NO_FURTHER_MSG}"
  2154. [ "$FOUND_KITS" ] && Copy_kits $FOUND_KITS && break
  2155. fi
  2156. done
  2157. #
  2158. [ "$MISSING_KITS" ] || print "${MSG}The selected products have been copied. "
  2159. return 0
  2160. #
  2161. } # End Load_selected_kits.
  2162.  
  2163.  
  2164.  
  2165. Log_var() # Simple function to log answers to an answer file.
  2166. { # RKB created Sep 15 16:37:23 1992 for ug_install.
  2167. [ "$L_SWT" ] || return 0 # If logging is not turned on, do nothing.
  2168. # Require 1 global, the log file LOGFILE, Requires 1 arg, the var to log.
  2169. : ${1:?} ; LOGVAR=$1 ; : ${LOGFILE:?}
  2170. [ "`eval echo \\$$1`" ] || return 0 # If nothing in it, don't log it.
  2171. print "${1}=`eval echo \\$$1` # "$2"" >> $LOGFILE
  2172. } # End Log_var
  2173.  
  2174.  
  2175.  
  2176. Make_base() # Create the base directory & some sub directories.
  2177. { # RKB Apr 28 17:20:05 1993
  2178. # RKB Sep 28 23:33 93 V10.1ph3L add ck for load only.
  2179. # RKB Apr 26 16:26 94 V103P4D add chmod 555 for created dirs.
  2180. # RKB Jan 21 02:22 96 V110P22 chng to ck REAL_BASE for /usr/$VNUM.
  2181. # RKB May 22 00:13 98 V150P03 Updated for ugflexlm.
  2182. # RKB Jun 29 00:11 99 V160P12 Rm cgmdef.txt, xhatch, xhatch2 & util dir.
  2183. # RKB Nov 3 15:12 99 NX6P20 Tweaks for license_server install type.
  2184. # RKB Mar 26 08 NX6P21 More chngs for Standalone license.
  2185. #
  2186. # 1 required variable
  2187. : ${BASE_DIR:?} # Internal ck.
  2188. [ "$INS_TYPE" = "load_only" ] && return 0 # Don't do this on load only.
  2189. $VECHO "${MSG}$PRODNAME $NX_VER files will be installed
  2190. \r\tinto subdirectories of: $BASE_DIR "
  2191. # BASE_DIR could be a link name, get the real dir.
  2192. REAL_BASE=`cd $BASE_DIR 2>&- ; echo pwd | csh -fs 2>&-`
  2193. if [ "$REAL_BASE" != "/usr/ugs$VNUM" ] ; then
  2194. [ -h /usr/ugs$VNUM ] && rm -f /usr/ugs$VNUM 2>&- # Delete the old link.
  2195. [ -d /usr/ugs$VNUM ] && { # It's a real dir so rename it.
  2196. $VECHO "${MSG}Saving /usr/ugs$VNUM directory
  2197. \r\tas /usr/ugs${VNUM}.$$"
  2198. mv -f /usr/ugs$VNUM /usr/ugs${VNUM}.$$ 2>&- ;}
  2199. # Can't just delete it.
  2200. ln -sf $REAL_BASE /usr/ugs$VNUM && { # Create the new ugsXXX link.
  2201. $VECHO "${MSG}A symbolic link has been created
  2202. \r\tfrom: /usr/ugs$VNUM
  2203. \r\tto: $REAL_BASE" ;}
  2204. fi
  2205. # O.K. now check and/or create the required subdirectories.
  2206. [ "$INS_TYPE" = "license_server" ] || { # license_servers don't need a 'bin'.
  2207. [ -d ${BASE_DIR}/bin ] || mkdir -p ${BASE_DIR}/bin 2>&-
  2208. chmod 555 ${BASE_DIR}/bin >$NULL 2>&-
  2209. }
  2210. #
  2211. # Make ugflexlm dir if needed and copy the license file to the ugflex dir.
  2212. [ -d ${BASE_DIR}/ugflexlm ] || mkdir -p ${BASE_DIR}/ugflexlm 2>&-
  2213. chmod 555 ${BASE_DIR}/ugflexlm >$NULL 2>&-
  2214. # As of NX6P21 Can't do this cp anymore cuz we're now doing standalone licenses
  2215. # which can't be copied until after customer enters it.
  2216. # This old cp was for the nx install license server install.
  2217. # cp $UGF_FILE $BASE_DIR/ugflexlm >$NULL 2>&-
  2218. #
  2219. return 0
  2220. } # End Make_base.
  2221.  
  2222.  
  2223.  
  2224. Mod_environment_files() # Modify files that set the environment.
  2225. { # RKB Mon Aug 13 22:20:41 PDT 1990
  2226. # Updated Wed Oct 10 21:46:58 PDT 1990
  2227. # RKB updated: May 12 23:45 1993 mv .ugii_env logic to new function. V10ph12g.
  2228. # RKB May 13 23:45 1993 add ck for MODIFY_OK. V10ph12g. rm IGNORE_FPE
  2229. # RKB May 25 23:26 1993 add IGNORE_FPE back in.
  2230. # RKB Jun 2 14:11 1993 rm IGNORE_FPE again, and leave SB_DISPLAY_ADDR for V9.
  2231. # RKB Jul 13 20:39 1993 V10.1 make generic
  2232. # RKB updated: Aug 11 00:53 1993 V10.1p2 fix for variables.
  2233. # RKB updtd: Oct 13 15:31 1993 Add SGI stuff for csh login.
  2234. # RKB updtd: Mar 10 01:06 94 V103P2E Add ck for OSF's lack of csh.login.
  2235. # RKB updtd: Mar 10 01:06 94 V103P2E Rm UGII_FILE_SYSTEM
  2236. # RKB updtd: Mar 23 22:50 94 V103P3B add logic to make sample files in tmp.
  2237. # RKB updtd: Jun 1 13:00 94 V103P6B rm UGII_TERMMOD left from Solaris 9.1S.
  2238. # RKB updtd: Apr 17 23:40 95 V105P07 Add logic for CDE. Create_dt_xsession.
  2239. # RKB Mar 3 17:23 98 V150P01 Rm ACS specific logic. Rm VUE logic.
  2240. # RKB Aug 28 06 NX050P16 Changes for new universal flexlm i.e. ugslmd.
  2241. # RKB Jan 11 07 NX050P23 Changes for Linux profile/login mechanism.
  2242. # RKB Jan 30 07 NX050P24 Rename nx_profile.csh to nx_login.csh.
  2243. #
  2244. [ -d $UGS_TMP ] || mkdir -p $UGS_TMP # Make sure ugs_tmp is there.
  2245. #
  2246. # Do etc profile.
  2247. if [ -f /etc/profile ] ; then # Make sure we can find it, then save it.
  2248. # Found the file now ck mod ok.
  2249. if [ "$MODIFY_OK" = yes ] ; then # OK to modify system files.
  2250. # Do the real etc profile file.
  2251. FILENAME=/etc/profile # simple var to ease programming.
  2252. $VECHO "${MSG}Saving $FILENAME \n\tas $UGS_TMP/profile.$$ ..."
  2253. cp $FILENAME $UGS_TMP/profile.$$
  2254. $VECHO "\r\tModifying ${FILENAME} ..."
  2255. else
  2256. # Do the sample file in tmp.
  2257. FILENAME=$UGS_TMP/profile # simple var to ease programming.
  2258. cp /etc/profile $FILENAME
  2259. $VECHO "\r\tModifying profile file in $UGS_TMP ..."
  2260. fi
  2261. # Build the edit command file to do the actual modifications
  2262. # 1st three are old legacy vars.
  2263. # Next three are current vars.
  2264. Mod_rm_old USER_ $FILENAME # delete lines with USER_ in it.
  2265. Mod_rm_old IGNORE_FPE $FILENAME # delete IGNORE_FPE line.
  2266. Mod_rm_old UGII_TERMMOD $FILENAME # delete UGII_TERMMOD line. (SUN)
  2267. # Next three are current vars.
  2268. Mod_rm_old UGII_BASE $FILENAME # delete any line with UGII_ in it.
  2269. Mod_rm_old UGII_ROOT $FILENAME # delete any line with UGII_ in it.
  2270. Mod_rm_old UGS_LICENSE_SERVER $FILENAME
  2271. # Linux had to do it differently, of course! Added NX050P23
  2272. [[ `uname` = Linux ]] && [ -d /etc/profile.d ] && {
  2273. FILENAME=/etc/profile.d/nx_profile.sh
  2274. [ -f $FILENAME ] || { # If not there already just create it.
  2275. # If it exists just edit, in case it was customer customized.
  2276. print "# UGS NX sh/bash/ksh shell profile." > $FILENAME
  2277. }
  2278. $VECHO "\r\tModifying ${FILENAME} ..."
  2279. }
  2280. Mod_etc_profile UGII_BASE_DIR $BASE_DIR $FILENAME
  2281. Mod_etc_profile UGII_ROOT_DIR $BASE_DIR/bin/ $FILENAME
  2282. [ "$UGF_SERVERS" ] && {
  2283. Mod_etc_profile UGS_LICENSE_SERVER $UGF_SERVERS $FILENAME
  2284. }
  2285. # Now do the actual edit. If we have all the pieces.
  2286. [ -f $FILENAME -a -f $UGS_TMP/ED.$$ ] && {
  2287. ed - $FILENAME < $UGS_TMP/ED.$$ > /dev/null || { # Check ed worked.
  2288. print "${ERR}unable to correctly modify ${FILENAME}. Status $?
  2289. \r\tRestoring original ${FILENAME}." >&2
  2290. mv -f $UGS_TMP/`basename ${FILENAME}`.$$ ${FILENAME}
  2291. }
  2292. rm -f $UGS_TMP/ED.$$ 2>&-
  2293. }
  2294. else
  2295. print "${WARN}could not find ${FILENAME}, it must be edited manually." >&2
  2296. fi
  2297. #
  2298. # Do the csh.login file.
  2299. unset FILENAME # unset from profile.
  2300. [ -f /etc/cshrc ] && FILENAME=/etc/cshrc # IRIX
  2301. [ -f /etc/.login ] && FILENAME=/etc/.login # SVR4
  2302. [ -f /etc/csh.login ] && FILENAME=/etc/csh.login # HP
  2303. if [ -f "$FILENAME" ] ; then # Make sure we can find it, then save it.
  2304. # Found one of the files now ck mod ok.
  2305. if [ "$MODIFY_OK" = yes ] ; then # OK to modify system files.
  2306. # Do the real csh file.
  2307. $VECHO "${MSG}Saving ${FILENAME}
  2308. \r\tas $UGS_TMP/`basename ${FILENAME}`.$$ ..."
  2309. cp ${FILENAME} $UGS_TMP/`basename ${FILENAME}`.$$
  2310. $VECHO "\r\tModifying ${FILENAME} ..."
  2311. else
  2312. # Do the sample file in tmp.
  2313. cp $FILENAME $UGS_TMP/`basename $FILENAME`
  2314. FILENAME=$UGS_TMP/`basename $FILENAME`
  2315. $VECHO "\r\tModifying `basename $FILENAME` file in $UGS_TMP ..."
  2316. fi
  2317. # Build the edit command file to do the actual modifications
  2318. # 1st three are old legacy vars.
  2319. Mod_rm_old USER_ $FILENAME # delete any line with USER_ in it.
  2320. Mod_rm_old IGNORE_FPE $FILENAME # delete any IGNORE_FPE line.
  2321. Mod_rm_old UGII_TERMMOD $FILENAME # delete any UGII_TERMMOD line.
  2322. # Next three are current vars.
  2323. Mod_rm_old UGII_BASE $FILENAME # delete any line with UGII_ in it.
  2324. Mod_rm_old UGII_ROOT $FILENAME # delete any line with UGII_ in it.
  2325. Mod_rm_old UGS_LICENSE_SERVER $FILENAME
  2326. # Linux had to do it differently, of course! Added NX050P23
  2327. [[ `uname` = Linux ]] && [ -d /etc/profile.d ] && {
  2328. FILENAME=/etc/profile.d/nx_login.csh
  2329. # Get rid of the old obsolete name first. NX050P24
  2330. [ -f /etc/profile.d/nx_profile.csh ] && {
  2331. rm /etc/profile.d/nx_profile.csh > $NULL 2>&1
  2332. }
  2333. # If its not there already just create it.
  2334. [ -f $FILENAME ] || { # If its not there already just create it.
  2335. # If it exists just edit, in case it was customer customized.
  2336. print "# UGS NX csh shell login." > $FILENAME
  2337. }
  2338. $VECHO "\r\tModifying ${FILENAME} ..."
  2339. }
  2340. # glob/noglob Disabled NX050P23
  2341. # grep -s "^set noglob" $FILENAME >$NULL || {
  2342. # print "set noglob " >> $FILENAME ;}
  2343. Mod_etc_login UGII_BASE_DIR $BASE_DIR $FILENAME
  2344. Mod_etc_login UGII_ROOT_DIR $BASE_DIR/bin/ $FILENAME
  2345. [ "$UGF_SERVERS" ] && {
  2346. Mod_etc_login UGS_LICENSE_SERVER $UGF_SERVERS $FILENAME
  2347. }
  2348. # Now do the actual edit. If we have all the pieces.
  2349. [ -f $FILENAME -a -f $UGS_TMP/ED.$$ ] && {
  2350. ed - $FILENAME < $UGS_TMP/ED.$$ > /dev/null || { # Check ed worked.
  2351. print "${ERR}unable to correctly modify ${FILENAME}. Status $?
  2352. \r\tRestoring original ${FILENAME}. " >&2
  2353. mv -f $UGS_TMP/`basename ${FILENAME}`.$$ ${FILENAME}
  2354. }
  2355. rm -f $UGS_TMP/ED.$$
  2356. }
  2357. # glob/noglob Disabled NX050P23
  2358. # grep "^unset noglob" $FILENAME > /dev/null || {
  2359. # print "unset noglob " >> $FILENAME ;}
  2360. else
  2361. print "${WARN}could not find ${FILENAME},
  2362. \r\tit must be edited manually." >&2
  2363. fi
  2364. #
  2365. # Do the CDE 'dt/config/Xsession.d' file. If CDE is installed. Added V105P07.
  2366. # Check for CDE by looking for a 'dt/config/Xsession.d' directory.
  2367. unset XSESSION_DIR # Init to be safe.
  2368. [ -d /usr/dt/config/Xsession.d ] && XSESSION_DIR=/usr/dt/config/Xsession.d
  2369. [ -d /etc/dt/config/Xsession.d ] && XSESSION_DIR=/etc/dt/config/Xsession.d
  2370. # Reverse order of precedence. If XSESSION_DIR not set, we don't have CDE.
  2371. [ "$XSESSION_DIR" ] && Create_dt_xsession $XSESSION_DIR xsession.ugs
  2372. #
  2373. # Clean up.
  2374. rm -f $UGS_TMP/ED.$$ 2>&- # Just in case we missed it earlier.
  2375. return 0
  2376. } # End of Mod_environment_files.
  2377.  
  2378.  
  2379.  
  2380. Mod_etc_profile() # Check and/or add/modify the Bourne shell profile script
  2381. { # RKB Mon Aug 13 23:21:40 PDT 1990
  2382. # RKB Updtd: Nov 19 23:35 91
  2383. # RKB Updtd: Mar 23 22:27 94 Use $3 for filename.
  2384. # Check and/or add/modify the /etc/profile file.
  2385. # Requires 3 parameters. $1=variable name $2=variable value $3=filename
  2386. # this function simply adds commands to an 'ed' command file.
  2387. if grep -s "^$1=" $3 > /dev/null ; then
  2388. cat >> $UGS_TMP/ED.$$ <<-END_OF_CAT
  2389. /^$1=/c
  2390. $1=$2 ; export $1
  2391. .
  2392. w
  2393. END_OF_CAT
  2394. [ $? = 0 ] || {
  2395. print "${ERR}unable to create an edit command file in '$UGS_TMP'.
  2396. \r\tThe environment variable: $1 is not set in: $3 " >&2
  2397. return 1 ;}
  2398. else # Wasn't there, so just append it.
  2399. print "$1=$2 ; export $1" >> $3
  2400. fi
  2401. #
  2402. } # End of Mod_etc_profile
  2403.  
  2404.  
  2405.  
  2406. Mod_etc_login() # Check and/or add/modify the C shell login script
  2407. { # RKB Aug 13 23:21:40 PDT 1990
  2408. # RKB Updtd: Oct 13 23:07:06 1992 fix grep line to use $1
  2409. # RKB Updtd: Jul 13 20:53 1993 V10.1 make generic.
  2410. # Check and/or add/modify the global csh login file.
  2411. # this function simply adds commands to an 'ed' command file.
  2412. # Requires 3 parameters. $1=variable name $2=variable value $3=filename
  2413. if grep -s "setenv ${1} " $3 >$NULL ; then
  2414. cat >> $UGS_TMP/ED.$$ <<-END_OF_CAT
  2415. /setenv $1 /c
  2416. setenv $1 $2
  2417. .
  2418. w
  2419. END_OF_CAT
  2420. [ $? = 0 ] || {
  2421. print "${ERR}unable to create an edit command file in ' $UGS_TMP '.
  2422. \r\tThe environment variable: ${1} is not set in: ${3}" >&2
  2423. return 1 ;}
  2424. else # Wasn't there, so just append it.
  2425. print "setenv $1 $2" >> $3
  2426. fi
  2427. } # End of Mod_etc_login.
  2428.  
  2429.  
  2430.  
  2431. Mod_pvision_file() # Create or modify the Product Vision Pseudo Registry file.
  2432. { # RKB Wed Dec 1 11:21 99 Initial version. Written so PV can find UG.
  2433. # RKB Tue Feb 27 11:41 01 V180P08 Added $UG_VER to Unigraphics string.
  2434. #
  2435. # The PV product does not know how to read the $UGII_BASE_DIR env var
  2436. # or follow the symbolic link '/usr/ugs999' - so this file is created
  2437. # to contain the path to the UG startup script.
  2438. #
  2439. # Requires 1 arg - the path to the ugii startup script.
  2440. : ${1:?} # Required arg check, the path to the ugii startup script.
  2441. #
  2442. # The path of the Product Vision 'Pseudo Registry' file.
  2443. PV_FILE=/ugs/installed_programs.dat # Default location.
  2444. #
  2445. # First see if the file is already there AND set correctly. If so we're done.
  2446. grep '^"Unigraphics '$UG_VER'"="'${1}'"' $PV_FILE >$NULL 2>&- && return 0
  2447. #
  2448. # Now check if we even have permission to modifiy system files.
  2449. [ "$MODIFY_OK" = yes ] || { # No we don't
  2450. # So we must use a sample file in tmp.
  2451. PV_FILE=$UGS_TMP/installed_programs.dat
  2452. # Make the UGS_TMP dir if it's not already there.
  2453. [ -d $UGS_TMP ] || mkdir -p $UGS_TMP >$NULL 2>&-
  2454. } # End mod ok ck.
  2455. #
  2456. # Now we know we do need to do something and which file to work with.
  2457. #
  2458. # Now see if the file needs to be created, modified or appended to.
  2459. if [ ! -f $PV_FILE ] ; then # Wasn't there so just create it.
  2460. $VECHO "${MSG}Creating Product Vision file: \n\t$PV_FILE ..."
  2461. mkdir -p $( dirname $PV_FILE ) >$NULL 2>&- # Make the dir.
  2462. echo '[HKEY_LOCAL_MACHINE\Software\Unigraphics \c' > $PV_FILE
  2463. echo 'Solutions\Installed Applications]' >> $PV_FILE
  2464. echo '"Unigraphics '$UG_VER'"="'${1}'"' >> $PV_FILE
  2465. chmod 666 $PV_FILE
  2466. # The file was there, so check if it had any entry for Unigraphics.
  2467. elif grep '^"Unigraphics '$UG_VER'"=' $PV_FILE >$NULL 2>&- ; then
  2468. # True if there was some entry.
  2469. $VECHO "${MSG}Saving $PV_FILE \n\tas $UGS_TMP/$(basename $PV_FILE).$$"
  2470. cp $PV_FILE $UGS_TMP/$(basename $PV_FILE).$$
  2471. $VECHO "\r\tUpdating ${PV_FILE} ..."
  2472. # Do the ed to set it correctly.
  2473. ed - ${PV_FILE} <<-END_OF_ED
  2474. /"Unigraphics $UG_VER"=/c
  2475. "Unigraphics $UG_VER"="$1"
  2476. .
  2477. w
  2478. q
  2479. END_OF_ED
  2480. else # The file was there but there was NO Unigraphics entry - so add it.
  2481. $VECHO "${MSG}Saving $PV_FILE \n\tas $UGS_TMP/$(basename $PV_FILE).$$"
  2482. cp $PV_FILE $UGS_TMP/$(basename $PV_FILE).$$
  2483. $VECHO "\r\tUpdating ${PV_FILE} ..."
  2484. echo '"Unigraphics '$UG_VER'"="'$1'"' >> $PV_FILE
  2485. fi
  2486. return 0
  2487. #
  2488. } # End Mod_pvision_file.
  2489.  
  2490.  
  2491.  
  2492. Mod_rm_old() # Requires 2 parameters. $1=variable name $2=filename
  2493. { # Strips out any line with $1 in it.
  2494. cp $2 ${2}.tmp
  2495. grep -v "^$1" ${2}.tmp |grep -v "export $1" |grep -v "setenv $1" > $2
  2496. [ -f ${2}.tmp ] && rm ${2}.tmp
  2497. }
  2498.  
  2499.  
  2500.  
  2501. Nodename_filter() # converts std in to proper Flex format for UGF_SERVERS.
  2502. { # RKB May 06 98 V150P03 Initial version.
  2503. # RKB May 26 98 V150P03 Partial re-write for quirks in OSF's sed.
  2504. # RKB Jun 17 98 V150P04 Re-write to change to : separators.
  2505. #
  2506. # Use this function as a in-line filter. It will convert standard-in to
  2507. # the proper format for FLEXlm. i.e. @NodeA:@NodeB ...
  2508. # Pipe standard-in "-" thru sed.
  2509. cat - | sed -e '
  2510. s!^.! &!
  2511. s!,! , !g
  2512. s!:! !g
  2513. s! \([0-9|A-z]\)! @\1!g
  2514. s!@\([0-9]*@\)!\1!g
  2515. s!@\([0-9|A-z]*/\)!\1!g
  2516. s! *! !g
  2517. s!^[ |,|:]*!!
  2518. s![ |,|:]*$!!
  2519. s! , !,!g
  2520. s!,,*!,!g
  2521. s! !:!g
  2522. s!,:!,!g
  2523. '
  2524. return $?
  2525. # End of sed. The steps taken, in order, were:
  2526. # 1. Insert a space in first column.
  2527. # 2. Insert spaces around any commas.
  2528. # 3. Change all colons into spaces.
  2529. # 4. Insert at-sign at begining of each word.
  2530. # 5. Rm at-signs from words that already had at-signs. i.e. socket@node
  2531. # 6. Rm at-signs from words that contain slash(s). i.e. a filename.
  2532. # 7. Rm extra spaces i.e. single space it.
  2533. # 8. Rm leading space, comma or colons.
  2534. # 9. Rm trailing space, comma or colons.
  2535. # 10. Rm extra spaces around commas.
  2536. # 11. Rm any extra commas.
  2537. # 12. Change spaces back into colons.
  2538. # 13. Rm any extra colons we may have inserted.
  2539. #
  2540. } # End of Nodename_filter.
  2541.  
  2542.  
  2543.  
  2544. Ping_node() # Ping nodename in arg 1 and return true or false.
  2545. { # RKB written: Aug 5 21:01 1993 V10.1p2 separate function just for ping.
  2546. # RKB updtd: Oct 13 13:21 1993 Add IRIX specific stuff.
  2547. # KDS updtd: Nov 18 18:50 1994 Added IBM AIX support
  2548. # RKB updtd: Wed Apr 20 2005 Added Linux support. NX4P11.
  2549. # RKB Aug 29 06 NX5P16 Change ERR to a WARN.
  2550. # test nodename supplied in arg1 using ping.
  2551. case ${MACHINE:?} in
  2552. HP*) ping $1 -n 2 >$NULL 2>&- && return 0 ;;
  2553. SunOS) ping $1 >$NULL 2>&- && return 0 ;;
  2554. IRIX*) /usr/etc/ping -c2 $1 >$NULL 2>&- && return 0 ;;
  2555. OSF1) ping -c 2 $1 >$NULL 2>&- && return 0 ;;
  2556. AIX) ping -c2 $1 >$NULL 2>&- && return 0 ;;
  2557. Linux) /bin/ping -c 2 $1 >$NULL 2>&- && return 0 ;;
  2558. esac
  2559. # Ping Test failed.
  2560. print "${WARN}could not ping $1 This node may not be up. \c" >&2
  2561. sleep 3 ; return 1
  2562. } # End Ping_node.
  2563.  
  2564.  
  2565.  
  2566. Read_ugf_file() # Read the (Arg 1) FlexLM license file, to get server info.
  2567. { # RKB Mar 3 22:26 98 V150P01 Initial version.
  2568. # RKB May 15 14:53 98 V150P03 Streamlined version.
  2569. #
  2570. # 1 required arg - the filename.
  2571. #
  2572. # Make sure we can find it.
  2573. [ -r ${1:?} ] || { # see if there and readable.
  2574. print "${ERR}cannot find or cannot read: $1 \c"
  2575. sleep 2 ; return 1
  2576. }
  2577. #
  2578. # Initialize vars to be safe.
  2579. unset I LINES SERVERS PORTS
  2580. #
  2581. # Print host names and socket numbers (Fields 2 & 3) of all lines that
  2582. # contain the word SERVER/server in Field 1. Save 'em in array LINES.
  2583. set -A LINES $( awk '$1~/^SERVER$|^server$/ {printf"%s:%0d ",$2,$4}' $1 )
  2584. #
  2585. # Now split the LINES into nodes and socket numbers - for future use.
  2586. while [ ${#LINES[*]} -gt ${I:=0} ] ; do
  2587. SERVERS[$I]=${LINES[$I]%%:*} # Masking out :* leaves hostname.
  2588. PORTS[$I]=${LINES[$I]##*:} # Masking out *: leaves port num.
  2589. ((I+=1)) # Increment the index.
  2590. done
  2591. #
  2592. return 0 # Looks good.
  2593. #
  2594. } # End Read_ugf_file.
  2595.  
  2596.  
  2597.  
  2598. Read_var() # Read in a variable from the env, answer file, or keyboard.
  2599. { # RKB created: Wed Jul 29 16:47:59 PDT 1992
  2600. # Requires 3 args, the var to read, the default & the question text.
  2601. : ${1:?} ; READVAR=$1 ; : ${2:?} ; : ${3:?} # Req arg check.
  2602. # Possible read control switches are D,F,Q (set in Check_switches).
  2603. SWITCH_TEST=$READ_CONTROL_SWITCHES
  2604. # If 2nd time asking for this var, we could be in a loop, so use retry case.
  2605. [ "$READVAR" = "$LAST_READVAR" ] && SWITCH_TEST=retry
  2606. case ${SWITCH_TEST:=interactive} in # If no switches, we're interactive
  2607. interactive) # If no switches then we somehow looped.
  2608. print "$3" ; read $READVAR
  2609. [ -n "`eval echo \\$$READVAR`" ] || eval $READVAR=$2
  2610. ;;
  2611. retry) # If no switches or we somehow looped.
  2612. [ "$Q_SWT" ] && { # A question loop in quiet mode is cause for exit.
  2613. print "${ERR}bad answer for $READVAR caused a loop." >&2
  2614. exit 1 ;}
  2615. print "$3" ; read $READVAR
  2616. [ -n "`eval echo \\$$READVAR`" ] || eval $READVAR=$2
  2617. ;;
  2618. d) # Take the defaults, display question.
  2619. print "$3" ; echo $2 ; eval $READVAR=$2
  2620. ;;
  2621. dq) # Take the defaults, but quietly.
  2622. eval $READVAR=$2
  2623. ;;
  2624. df) # Read from file and or take the defaults, display question.
  2625. env | grep "^${READVAR}=" >$NULL 2>&- || {
  2626. eval `grep "^${READVAR}=" $READFILE 2>&- | tail -1` ;}
  2627. # If the var named by READVAR is not set, set it to the default.
  2628. [ -n "`eval echo \\$$READVAR`" ] || eval $READVAR=$2
  2629. print "$3" # echo the question
  2630. echo `eval echo \\$$READVAR` # echo contents of var named by READVAR.
  2631. ;;
  2632. dfq) # Read from file and or take the defaults, but quietly.
  2633. env | grep "^${READVAR}=" >$NULL 2>&- || {
  2634. eval `grep "^${READVAR}=" $READFILE 2>&- | tail -1` ;}
  2635. # If the var named by READVAR is not set, set it to the default.
  2636. [ -n "`eval echo \\$$READVAR`" ] || eval $READVAR=$2
  2637. ;;
  2638. f) # Read from file and or take the defaults, but quietly.
  2639. env | grep "^${READVAR}=" >$NULL 2>&- || {
  2640. eval `grep "^${READVAR}=" $READFILE 2>&- | tail -1` ;}
  2641. # If the var named by READVAR is not set, set it to the default.
  2642. if [ -n "`eval echo \\$$READVAR`" ] ; then
  2643. # echo the question and the contents of var named by READVAR.
  2644. print "$3" ; echo `eval echo \\$$READVAR`
  2645. else
  2646. # echo the question and read in the contents of var named by READVAR.
  2647. print "$3" ; read $READVAR
  2648. fi
  2649. ;;
  2650. fq) # Read from file and or take the defaults, but quietly.
  2651. env | grep "^${READVAR}=" >$NULL 2>&- || {
  2652. eval `grep "^${READVAR}=" $READFILE 2>&- | tail -1` ;}
  2653. [ -n "`eval echo \\$$READVAR`" ] || { # Must have answer or fail.
  2654. print "${ERR}no valid answer found in: $READFILE
  2655. \n\tcould not answer question:" >&2
  2656. ( print "$3" ; echo ) >&2
  2657. exit 1 ;}
  2658. ;;
  2659. esac
  2660. # Set the requested variable to contents of the var named by READVAR.
  2661. LAST_READVAR=$READVAR # Save the name of last requested variable name.
  2662. } # End Read_var
  2663.  
  2664.  
  2665.  
  2666. Rm_old_files() # Clean up old obsoleted files.
  2667. { # RKB Sep 14 14:45:37 1992
  2668. # RKB updtd: Jul 6 21:20 1993 V10.1.1
  2669. # RKB updtd: Feb 17 22:53 94 V10.3P2B add unigraphics.def_default.
  2670. # RKB updtd: Mar 10 23:39 94 V103P2E added old .pl files & menufile.grs
  2671. # RKB updtd: Oct 13 00:18 94 V104P09 added uguser.dat & rename for ugphoto.
  2672. # RKB updtd: Mar 7 10:54 95 V105P01 rm the old Sun 'lib' dir.
  2673. # RKB updtd: Jun 24 13:35 98 V150P05 rm old eds_reset & rename ugflexlm.
  2674. # RKB updtd: Jun 10 11:37 99 V160P10 Added 10.ugf_mdc
  2675. # Requires one variable BASE_DIR
  2676. : ${BASE_DIR:?} # Internal check.
  2677. for FILENAME in gfem/posexe gfem/posint ugii/refile \
  2678. ugii/Ugraf_mdc ugii/Xconsoles_mdc ugii/X0screens_mdc \
  2679. ugii/Xconsoles ugii/menufile.grs_mdc ugii/10.ugf_mdc \
  2680. ugii/unigraphics.def_default \
  2681. ugii/menufile.grs_default \
  2682. ugii/10.ugf_mdc \
  2683. install/mdc_install install/mdc_install.dat \
  2684. install/mdc_install.arc \
  2685. admin/ug_reset admin/eds_reset ugii/eds_reset \
  2686. ughelp/ughlpdoc/onhelp.pl \
  2687. ughelp/ughlpdoc/onkeys.pl \
  2688. ughelp/ughlpdoc/onwindow.pl \
  2689. ufunc/uguser.dat
  2690. do
  2691. rm -f ${BASE_DIR}/$FILENAME >$NULL 2>&-
  2692. rm -f ${BASE_DIR}/bin/`basename $FILENAME` >$NULL 2>&-
  2693. done
  2694. rm -f $BASE_DIR/*_mdc $BASE_DIR/mdc_install.* >$NULL 2>&-
  2695. mv /tmp/mdc_tmp $UGS_TMP >$NULL 2>&-
  2696. mv $BASE_DIR/ugrender $BASE_DIR/ugphoto >$NULL 2>&- # Added V104P09
  2697. mv $BASE_DIR/ugflex $BASE_DIR/ugflexlm >$NULL 2>&- # Added V150P05
  2698. # V105P01 rm the old Sun 'lib' kit. Now included in uglibs.
  2699. rm -rf $BASE_DIR/lib/libF77 2>&- && rmdir $BASE_DIR/lib 2>&-
  2700. } # End Rm_old_files
  2701.  
  2702.  
  2703.  
  2704. Select() # RKB Select a product to load requires 1 argument.
  2705. { # Updated for ksh arrays: Thu May 10 13:46:04 PDT 1990
  2706. # RKB Updated: Apr 1 17:44:45 1993 V10P11.
  2707. # RKB updtd Jul 8 00:52 1993 V10.1.1 rm swap space logic.
  2708. # RKB updtd Jul 8 19:41 1993 NEW for V10.1 use faster ksh arithmetic.
  2709. # RKB Jun 17 04 NX3P18 Chng FSETS logic in prep for multi CD installs.
  2710. : ${1:?} # Required product name arg check.
  2711. [ "`eval echo \\$$1`" ] || return 0 # If $1 is null var, don't select.
  2712. [ "`eval echo \\${${1}[0]}`" = "$SELECTED" ] && return 0 # Already selected.
  2713. PROD_SIZE=`eval echo \\${${1}[3]}` ; : ${PROD_SIZE:=0}
  2714. PROD_INDEX=`eval echo \\${${1}[5]}` ; : ${PROD_INDEX:=0}
  2715. # Subract product size from free space array.
  2716. let FS_FREE[$PROD_INDEX]=${FS_FREE[$PROD_INDEX]}-$PROD_SIZE
  2717. # Add product size to the needed space array.
  2718. let FS_NEEDED[$PROD_INDEX]=${FS_NEEDED[$PROD_INDEX]}+$PROD_SIZE
  2719. # Add product size to space required var.
  2720. let SPACE_REQUIRED_KB=$SPACE_REQUIRED_KB+$PROD_SIZE
  2721. eval `echo ${1}[0]=\\$SELECTED` # Mark this product selected.
  2722. FSETS="$FSETS ${1}" # Add product name to FSETS var.
  2723. return 0
  2724. } # End of Select
  2725.  
  2726.  
  2727.  
  2728. Select_products() # RKB Selects individual product sets.
  2729. { # RKB Tue May 15 20:40:41 PDT 1990
  2730. # RKB Sep 30 23:40 92 Add multiple selection logic.
  2731. # RKB May 11 11:32 93 V100P12g.
  2732. # RKB Jul 11 01:04 93 V101 rewrite to use indirect vars to selects.
  2733. # RKB Nov 9 15:15 93 V102P02d changed "continue" to "load".
  2734. # RKB Nov 11 00:03 93 V102P02d moved call to Check_space to Main.
  2735. # RKB Mar 7 00:32 95 V105P01 Rm reqd logic for ADMIN & Sun LIB kit.
  2736. # RKB Oct 18 23:36 95 V110P12 Cosmetic changes.
  2737. # RKB Jan 21 02:20 96 V110P22 Add another ck for valid product number.
  2738. # RKB Oct 16 11:20 97 V140P06 Add call to Check_kit_dependencies.
  2739. # RKB May 5 01:21 99 V160P08 Chng to allow NOT loading UGII kit.
  2740. # RKB Apr 15 23:20 02 V190P16 Take out use of 'tr' - HPUX 11i bug.
  2741. # RKB Jun 17 04 NX3P18 Chng FSETS logic in prep for multi CD installs.
  2742. #
  2743. while true ; do # Loop thru menu and selection processs. Break exits.
  2744. # Calculate disk space just for info on the prodmenu screen.
  2745. let SPACE_REQUIRED_MB=${SPACE_REQUIRED_KB:=0}/1024
  2746. # When nothing selected show zero.
  2747. [ $SPACE_REQUIRED_MB -le 1 ] && SPACE_REQUIRED_MB=0
  2748. Display_screen3 # Display the actual choices
  2749. Read_var UGII_SELECTIONS load \
  2750. "\r*\tEnter kit or option number(s): [load] \c"
  2751. UGII_SELECTIONS=`echo $UGII_SELECTIONS | tr "," " "`
  2752. print "\n\tProcessing selection: ${UGII_SELECTIONS} ..."
  2753. for SELECTION in $UGII_SELECTIONS ; do
  2754. # If the product is not selected, select it, if it is, unselect it.
  2755. case ${SELECTION:=load} in
  2756. [1-9]|[1-8][0-9]) # Select/Deselect individual products 1-89.
  2757. # If the PRODUCT number SELECTION is already selected, deselect it,
  2758. # if not, select it. The next line compares element 0 of a product
  2759. # array named by the selected element number in the PRODUCTS array.
  2760. # First check that selection number is even a valid product.
  2761. [ "${PRODUCTS[$SELECTION]}" ] || continue
  2762. # Now see if it's selected or not.
  2763. if [ "`eval echo \\${${PRODUCTS[$SELECTION]}[0]}`" = "$SELECTED" ]
  2764. then
  2765. Deselect ${PRODUCTS[$SELECTION]} # Call Deselect with kit name.
  2766. else
  2767. Select ${PRODUCTS[$SELECTION]} # Call Select with kit name.
  2768. fi
  2769. ;;
  2770. 95) Select_prod_dirs ; continue 2
  2771. ;;
  2772. 96) # Select required files.
  2773. [ "${UGFLEXLM[0]}" = "$SELECTED" ] || Select UGFLEXLM
  2774. [ "${UGII[0]}" = "$SELECTED" ] || Select UGII
  2775. ;;
  2776. 98) # Deselect all files, if already Deselected, does nothing.
  2777. for KIT in ${PRODUCTS[*]} ; do
  2778. [ "`eval echo \\${${KIT}[0]}`" = "$SELECTED" ] && Deselect $KIT
  2779. done
  2780. ;;
  2781. 97) # Deselect all files, if already Selected, does nothing.
  2782. for KIT in ${PRODUCTS[*]} ; do
  2783. [ "`eval echo \\${${KIT}[0]}`" = "$SELECTED" ] || Select $KIT
  2784. done
  2785. ;;
  2786. 99|c*|l*|L*) # Load selected files
  2787. # Make sure we have something selected.
  2788. # Chng grep [A-z] to [A-Z|a-z]. V060P14 for Linux.
  2789. echo $FSETS | grep "[A-Z|a-z]" >$NULL || {
  2790. print "${MSG}no products selected."
  2791. sleep 2 ; continue 2
  2792. [ "$Q_SWT" ] && { print "${ERR}no products selected." ; exit 1 ;}
  2793. } # End empty FSETS ck.
  2794. # Make sure required kits are selected or already loaded.
  2795. [ "${UGFLEXLM[0]}" = "$SELECTED" -o -d $BASE_DIR/ugflexlm ] || {
  2796. print "${MSG}UGFLEXLM not selected and not previously loaded"
  2797. sleep 3 ; continue 2
  2798. }
  2799. # Make sure UG is selected or alread loaded. For FLEX Only, use
  2800. # a different install type. V160P20.
  2801. [ "${UGII[0]}" = "$SELECTED" -o -d $BASE_DIR/ugii ] || { # V160P08
  2802. print "${MSG}UGII not selected and not previously loaded
  2803. \r\tUnigraphics products will NOT run on this node. "
  2804. sleep 3 ; continue 2
  2805. }
  2806. # Now check for known kit dependencies. V140P06
  2807. Check_kit_dependencies || continue 2 # V150P08
  2808. #
  2809. # O.K. we passed the tests, time to check the space.
  2810. let SPACE_REQUIRED_MB=${SPACE_REQUIRED_KB:=0}/1024
  2811. break 2
  2812. ;;
  2813. q*) unset FSETS ; return 1
  2814. ;;
  2815. "!") echo Use ^d to return to $SCRIPTNAME ; $SHELL ; continue 2
  2816. ;;
  2817. "?"|h*) Help_install Select_products ; continue 2
  2818. ;;
  2819. p*) unset FSETS ; return 1 # wants previous menu
  2820. ;;
  2821. esac
  2822. done # end multiple selection loop.
  2823. done # End of while loop, only way out is a break statement.
  2824. UGII_SELECTIONS=`echo $UGII_SELECTIONS | tr " " ","` # Gotta have no spaces.
  2825. Log_var UGII_SELECTIONS "Optional Product selections"
  2826. print "$FSETS" | tr " " "\012" | grep "INSTALL" >$NULL 2>&- || { #Added V10.2p2d
  2827. FSETS="INSTALL $FSETS" ;} # pre-pend INSTALL if not already there.
  2828. } # End of Select_products
  2829.  
  2830.  
  2831.  
  2832. Select_prod_dirs() # Move the product directories.
  2833. { # RKB Jan 31 23:45:43 PST 1991
  2834. # RKB Sep 23 21:38 1993 V10.1ph3k change call to Create_dir to mkdir -p.
  2835. # RKB updtd: Apr 26 16:30 94 V103P4D add chmod for created directories.
  2836. # RKB Apr 15 23:20 02 V190P16 Take out use of 'tr' - HPUX 11i bug.
  2837. while true ; do # Outer question loop. Cycle till all conditions satisfied.
  2838. Display_selected # Display the selected products, their dirs & size.
  2839. echo ${FS_FREE[*]} | grep "\-[0-9]" > /dev/null 2>&1 && {
  2840. print "${WARN}the current selections MAY overflow file system(s)." >&2 ;}
  2841. while true ; do # Product name question loop.
  2842. print "${QUE}Enter product name to move, or <CR> when done. [done]: \c "
  2843. read PRODUCT
  2844. typeset -u PRODUCT=$PRODUCT
  2845. typeset -l LC_PRODUCT=$PRODUCT
  2846. case ${PRODUCT:=DONE} in
  2847. ACS|INSTALL) print "${MSG}this product cannot be moved." ; continue ;;
  2848. Q|QU|QUI|QUIT) return 1 ;;
  2849. "?"|H|HE|HEL|HELP)
  2850. print "${MSG}This prompt is requesting the name of one of the products
  2851. \r\tlisted above. The product you select will moved to a new
  2852. \r\tdestination directory and it's corresponding file system.
  2853. \n\tYou will be prompted for destination directory."
  2854. continue ;;
  2855. "!") echo Use ^d to return to $SCRIPTNAME ; $SHELL ; continue 1 ;;
  2856. D|DO|DON|DONE) echo # Cosmetic line feed.
  2857. for PRODUCT in $CHANGED_PRODUCTS ; do
  2858. PRODUCT_DIR=`eval echo \\${${PRODUCT}[4]}`
  2859. [ $PRODUCT_DIR = ${BASE_DIR}/${LC_PRODUCT} ] && continue
  2860. Create_prod_link $PRODUCT_DIR ${BASE_DIR}/${LC_PRODUCT} || {
  2861. print "${ERR}could not sucessfully move $PRODUCT" >&2
  2862. sleep 3 ; continue 2 ;}
  2863. [ -d $PRODUCT_DIR ] || {
  2864. mkdir -p $PRODUCT_DIR 2>&- || {
  2865. print "${ERR}could not sucessfully move $PRODUCT" >&2
  2866. rm -f $PRODUCT_DIR >$NULL 2>&-
  2867. sleep 3 ; continue 2
  2868. }
  2869. chmod 555 $PRODUCT_DIR >$NULL 2>&- # in case of weird umask
  2870. }
  2871. done
  2872. return 0 # Finally out of here.
  2873. ;;
  2874. esac
  2875. # Now Check that the entry is a known product
  2876. ( [ -n "`eval echo \\${${PRODUCT}[2]}`" ] ) 2>&-|| {
  2877. print "${ERR}the name ${PRODUCT} is not a known product." >&2
  2878. continue 1 ;}
  2879. # Check that the entry is a valid product.
  2880. ( [ "`eval echo \\${${PRODUCT}[2]}`" = "$PRODUCT" ] ) 2>&- || {
  2881. print "${ERR}the name ${PRODUCT} is not a valid product." >&2
  2882. continue 1 ;}
  2883. # Now check that the entry is a selected product.
  2884. ( [ "`eval echo \\${${PRODUCT}[0]}`" = "$SELECTED" ] ) 2>&- || {
  2885. print "${ERR}the product $PRODUCT has not been selected." >&2
  2886. continue 1 ;}
  2887. break
  2888. done # End of product question loop.
  2889. #
  2890. while true ; do # Pathname question loop.
  2891. print "${QUE}Enter full pathname for ${PRODUCT} [help]: \c "
  2892. read DIRNAME ; typeset -l DIRNAME=$DIRNAME
  2893. case ${DIRNAME:=help} in
  2894. "?"|h|he|hel|help)
  2895. print "${MSG}Enter the full pathname that will be used for the target
  2896. \r\tdirectory when loading ${PRODUCT}. When you enter a pathname
  2897. \r\tother than ${BASE_DIR}/${LC_PRODUCT} a symbolic link will be
  2898. \r\tcreated in ${BASE_DIR} to point to the new directory.
  2899. \n\tYour entry must be a full & real pathname, i.e. no links.
  2900. \n\tThe file systems are listed showing the amount of free disk
  2901. \r\tspace that will be available after loading has completed.
  2902. \n\tOnly file system that are writeable and allow root access are
  2903. \r\tlisted. (i.e. NFS mounted systems may NOT appear on the list.)
  2904. \n\tTo escape to the shell by enter '!'.
  2905. \r\tTo return to the previous question enter 'q'."
  2906. continue ;;
  2907. "!") echo Use ^d to return to $SCRIPTNAME ; $SHELL ; continue 1 ;;
  2908. q|qu|qui|quit) continue 2 ;;
  2909. esac
  2910. echo $DIRNAME | grep "^/" >$NULL 2>&- || {
  2911. print "${ERR}the pathname: $DIRNAME must begin at the root." >&2
  2912. continue 1 ; }
  2913. DIRNAME=`echo $DIRNAME | sed 's/\/$//p'` # Strip any trailing slash.
  2914. [ `basename $DIRNAME` = `echo $LC_PRODUCT` ] || { # Add prod dir name.
  2915. DIRNAME="${DIRNAME}/$LC_PRODUCT" ; }
  2916. Change_prod_dir $PRODUCT $DIRNAME || continue # Got info, now change dir.
  2917. print "$CHANGED_PRODUCTS" | grep -s "${PRODUCT} " >$NULL 2>&- || {
  2918. CHANGED_PRODUCTS="$CHANGED_PRODUCTS $PRODUCT" ;}
  2919. continue 2 # Did the change, now back to outer loop.
  2920. done # End of pathname question loop.
  2921. done # End of outer loop.
  2922. } # End of Select_prod_dirs
  2923.  
  2924.  
  2925.  
  2926. Set_main_defaults() # Get or set all the possible defaults for future use.
  2927. { # RKB Tue Apr 6 16:20:09 PDT 1993
  2928. # RKB updtd: Aug 24 15:05 93 V10.1ph3c read ans file for defaults.
  2929. # RKB updtd: Nov 9 22:11 93 allow use of link name for base dir prompt.
  2930. # RKB updtd: Apr 20 11:17 94 V103P4B save initial prompts as a defaults.
  2931. # RKB updtd: Mar 7 00:34 95 V105P01 rm ADMIN from reqd list.
  2932. # RKB Aug 8 18:08 95 V110P04 Chng UGFF_PMT default for remote nodes.
  2933. # RKB 06DEC95 V110P19 Correct -f logic for UGII_MODIFY_OK & remote ACS nodes.
  2934. # RKB 23JAN96 V110P22 Chng UGII_MODIFY_OK to MODIFY_SYSTEM_FILES_OK.
  2935. # RKB 17OCT97 V140P06 Unset ACS master & alternate when using -f.
  2936. # RKB Mar 3 17:30 98 V150P01 Rm ACS specific logic.
  2937. # RKB Nov 3 17:46 99 V160P20 Tweaks for license_server install type.
  2938. # RKB Jul 13 17:12 00 V170P13 Add rev ck for BASE_PMT.
  2939. # RKB Mar 10 13:29 03 V020P13 Add logic to check for tar.Z files.
  2940. # RKB May 26 04 NX3P16 Add OLDSCRIPTDIR to look in original script dir.
  2941. # RKB Jul 28 04 NX3P20 Add logic for a 2nd Source dir.
  2942. # RKB Aug 11 04 NX3P21 Correction for logic to get BASE_PMT.
  2943. # RKB Aug 28 06 NX050P16 Changes for new universal flexlm i.e. ugslmd.
  2944. # RKB Dec 11 06 NX050P22 Temporaily default to client-only install.
  2945. # RKB Feb 15 07 NX5P25 Permanently for to client-only install.
  2946. #
  2947. # 2 required variable: MACHINE, HOST
  2948. : ${MACHINE:?} # Reqd var Int ck.
  2949. : ${HOST:?} # Reqd var Int ck.
  2950. #
  2951. # Unset all the prompts
  2952. unset SRC_PMT SRC_PMT2 BASE_PMT MOD_PMT OVER_PMT
  2953. unset UGFT_PMT UGFS_PMT UGFF_PMT DAT_PMT
  2954. #
  2955. # If using -f get prompts out of answer file. else figure out defaults.
  2956. if [ "$F_SWT" ] ; then
  2957. for READVAR in UGII_INSTALL_TYPE UGII_SOURCE UGII_SOURCE2 \
  2958. UGII_BASE_DIR_ANSWER MODIFY_SYSTEM_FILES_OK \
  2959. FLEX_LIC_TYPE FLEX_LIC_FILE FLEX_LIC_SERVERS \
  2960. UGII_SELECTIONS
  2961. do
  2962. # Ck the env then the file for each var, so env setting takes priority
  2963. # Can't just source all of them from file cuz it would overwrite env.
  2964. env | grep "^${READVAR}=" >$NULL 2>&- || {
  2965. eval `grep "^${READVAR}=" $READFILE 2>&- | tail -1` ;}
  2966. done
  2967. #
  2968. # Set the prompts.
  2969. INS_TYPE=${UGII_INSTALL_TYPE:=load+configure}
  2970. SRC_PMT=${UGII_SOURCE:=$OLDSCRIPTDIR}
  2971. SRC_PMT2=${UGII_SOURCE2} # Added NX3P20 for multi cd's.
  2972. BASE_PMT=${UGII_BASE_DIR_ANSWER:=help}
  2973. MOD_PMT=${MODIFY_SYSTEM_FILES_OK:=help}
  2974. UGFT_PMT=${FLEX_LIC_TYPE:=both}
  2975. UGFF_PMT=${FLEX_LIC_FILE:=${BASE_PMT}/ugflexlm/ugnx4.lic}
  2976. UGFS_PMT=${FLEX_LIC_SERVERS:=${UGS_LICENSE_SERVER:=28000@$HOST}}
  2977. # Reformat this one for FLEXlm
  2978. UGFS_PMT=$( print " $UGFS_PMT" | Nodename_filter )
  2979. #
  2980. else # Figure out internal defaults.
  2981. # Set the default INS_TYPE
  2982. [ "$C_SWT" ] && INS_TYPE="configure_only" || INS_TYPE="load+configure"
  2983. #
  2984. # Attempt to set the SRC_PMT by looking in some known places.
  2985. # `dirname $OLDSCRIPTDIR` \
  2986. for SRC_PMT in $SCRIPTDIR \
  2987. $OLDSCRIPTDIR \
  2988. `dirname $SCRIPTDIR` \
  2989. /cdrom/ugii$VNUM \
  2990. /CDROM/ugii$VNUM
  2991. do
  2992. typeset -l PRODUCT_LC # Make a lower case kit name.
  2993. for PRODUCT in INSTALL UGFLEXLM UGII ; do # Check for base kits.
  2994. PRODUCT_LC=$PRODUCT
  2995. [ -f $SRC_PMT/${PRODUCT}.tar.Z -o \
  2996. -d $SRC_PMT/$PRODUCT -o \
  2997. -d $SRC_PMT/$PRODUCT_LC ] || {
  2998. unset SRC_PMT
  2999. continue 2
  3000. }
  3001. done
  3002. [ "$SRC_PMT" ] && break
  3003. done
  3004. #
  3005. case ${SRC_PMT:=help} in
  3006. ".") SRC_PMT=`pwd` ;;
  3007. "..") SRC_PMT=`cd .. ; pwd ` ;;
  3008. esac
  3009. #
  3010. # Set the BASE_PMT Updated NX030P21.
  3011. if [ -n "$UGII_BASE_DIR" -a -x "$UGII_BASE_DIR/ugii/env_print" ] ; then
  3012. # Use UGII_BASE_DIR if its already set to this rev.
  3013. # Get the rev of $UGII_BASE_DIR by running env_print. Updt 030P21
  3014. UGREV=$($UGII_BASE_DIR/ugii/env_print -n 2>&- ) # Get the rev.
  3015. UGREV=${UGREV##*[A-z| ]} # Strip leading letters or space.
  3016. UGREV="${UGREV%%.*}" # Strip all but 1st digit.
  3017. # Compare the 1st digits with a leading "V" added.
  3018. if [ "V$UGREV" = "${NX_VER%%.*}" ] ; then
  3019. BASE_PMT=$UGII_BASE_DIR
  3020. else # If not, we fall back to the ugs$VNUM default.
  3021. BASE_PMT=/usr/ugs$VNUM
  3022. fi
  3023. elif [ -h /usr/ugs$VNUM -a -d /usr/ugs$VNUM ] ; then
  3024. # if not set check for a link then get the real dir.
  3025. BASE_PMT=`cd /usr/ugs$VNUM ; echo pwd | /bin/csh -fs 2>&-`
  3026. else
  3027. # If no pre-existing var or link, just use /usr/ugs$VNUM
  3028. BASE_PMT=/usr/ugs$VNUM
  3029. fi
  3030. #
  3031. # Set the MOD_PMT
  3032. MOD_PMT=yes
  3033. #
  3034. # Set the UG FLEX licensing TYPE prompt.
  3035. # Force to client only. Flex Server install now done by
  3036. # ugslicensing_install only.
  3037. UGFT_PMT="client"
  3038. #
  3039. # Set the UGS_LICENSE_SERVER prompt.
  3040. UGFS_PMT=${UGS_LICENSE_SERVER:="28000@$HOST"} # Chng socket NX050P16.
  3041. #
  3042. fi
  3043. #
  3044. # Final tweaks to UGFS_PMT to add socket to plain hostname. Added V160P10
  3045. case $UGFS_PMT in
  3046. "$HOST") UGFS_PMT="28000@$UGFS_PMT" ;;
  3047. "@$HOST") UGFS_PMT="28000$UGFS_PMT" ;;
  3048. esac
  3049. #
  3050. # Now save all the prompts as an original default for possible use
  3051. # in resorting to defaults.
  3052. INS_TYPE_DEF=$INS_TYPE
  3053. SRC_PMT_DEF=$SRC_PMT
  3054. SRC_PMT2_DEF=$SRC_PMT2 # Added NX3P20.
  3055. BASE_PMT_DEF=$BASE_PMT
  3056. UGFT_PMT_DEF=$UGFT_PMT
  3057. UGFF_PMT_DEF=$UGFF_PMT
  3058. UGFS_PMT_DEF=$UGFS_PMT
  3059. #
  3060. # Now re-set the UGF prompts based UGF Licensing type.
  3061. case $UGFT_PMT in
  3062. cli*|CLI*) UGFF_PMT=n/a ;; # Client only.
  3063. ser*|SER*) UGFS_PMT=n/a ;; # Server only.
  3064. esac
  3065. #
  3066. # Now re-set some of the prompts based on the installation type.
  3067. case ${INS_TYPE} in
  3068. 1|load+c*) INS_TYPE="load+configure" ;;
  3069. 2|load_o*) INS_TYPE="load_only"
  3070. MOD_PMT=n/a # Not modifying system files.
  3071. UGFT_PMT=n/a # Won't be doing any FLEX setup.
  3072. UGFS_PMT=n/a # Don't need any server names.
  3073. UGFF_PMT=n/a # Don't need a license file.
  3074. ;;
  3075. 3|config*) INS_TYPE="configure_only"
  3076. SRC_PMT=n/a # Not loading any files.
  3077. SRC_PMT2=n/a # Not loading any files. # Added NX3P20
  3078. ;;
  3079. 4|license*) INS_TYPE="license_server" # V160P20
  3080. UGFT_PMT=server # Must be a server for this install type.
  3081. UGFS_PMT=n/a # Don't need any server names.
  3082. esac
  3083. return 0
  3084. } # End Set_main_defaults.
  3085.  
  3086.  
  3087.  
  3088. Start_ug() # RKB Starts or re-starts the UG processes
  3089. { # RKB rewritten Mar 10 1993 for V10 phase 10 to use new rc.eds.xxx scheme.
  3090. # RKB updtd: Jan 17 15:46 95 V104P23 Added new case for V10 HP-UX.
  3091. # RKB updtd: Mar 1 12:51 95 V105P01 clean up, merge AIX & HP SVR4.
  3092. # RKB updtd: Jun 25 11:46 98 V150P05 change for ugflexlm, use RC_LNK_DIR.
  3093. # RKB Jul 22 01:02 98 V150P07 Correction for IBM's lack of RC_LNK_DIR.
  3094. #
  3095. # Requires 1 variable: MACHINE
  3096. : ${MACHINE:?} # Reqd var int chk.
  3097. #
  3098. print "${MSG}Initializing NX background processes ... "
  3099. OLDCWD=`pwd`
  3100. case $MACHINE in
  3101. AIX) cd /etc ; RC_LIST=rc.ugs ;; # On AIX, we only use rc.ugs.
  3102. *) cd ${RC_LNK_DIR:?} ; RC_LIST=`ls S*rc.eds.* S*rc.ugs.* 2>&-` ;;
  3103. esac
  3104. #
  3105. # Run the list of rc script(s).
  3106. for SCRIPT in $RC_LIST ; do
  3107. [ -x $SCRIPT ] || continue # Ck it's there & executable.
  3108. if [ "$V_SWT" ] ; then
  3109. ./$SCRIPT 2>&1 # Run the script with full output.
  3110. else
  3111. ./$SCRIPT >$NULL # Run the script but quietly.
  3112. fi
  3113. done
  3114. cd $OLDCWD ; return
  3115. } # End of Start_ug
  3116.  
  3117.  
  3118.  
  3119. Size_filesystems() # Size & qualify the mounted filesystems, save to a file.
  3120. { # RKB Thu Jan 31 23:13:24 PST 1991
  3121. # RKB Updtd: Sep 14 15:44:26 1992 for mdc -> eds.
  3122. # RKB Updtd: Sep 28 15:23:57 PDT 1992
  3123. # RKB Updtd V9.1 ph 11 use bdf-awk-expr to prevent big number overflows.
  3124. # RKB Updtd: Jun 30 11:15 93 V10.1 make generic.
  3125. # RKB Updtd: Aug 10 23:41 93 V10.1p2 switch to 1024 byte blocks.
  3126. # RKB updtd: Oct 13 13:21 93 Add IRIX specific stuff.
  3127. # RKB updtd: Feb 17 22:40 94 V10.3P2B Add OSF1 specific stuff.
  3128. # RKB updtd: Mar 8 22:28 94 V103P2E minor streamlining.
  3129. # KDS updtd: Nov 18 18:53 94 V104 Add IBM AIX support
  3130. # RKB updtd: Mar 1 11:06 95 V105P1. cleanup & add owner id check.
  3131. # RKB updtd: Wed Apr 20 2005 Added Linux support. NX4P11.
  3132. # This function is designed to run in the background. It will size
  3133. # and qualify all the mounted file systems and write the results to a file.
  3134. # Two required global variables.
  3135. : ${AWK_CMD:?} # Internal check.
  3136. : ${DF_CMD:?} # Internal check.
  3137. #
  3138. # Make the UGS_TMP dir if not already there.
  3139. [ -d $UGS_TMP ] || mkdir -p $UGS_TMP >$NULL 2>&-
  3140. #
  3141. FS_FILE="$UGS_TMP/filesystem_info" # File name to write the results to.
  3142. TEST_FNAME="UgsWriteTestFile678901234567890.$$" # A Test filename, 30+ chars.
  3143. rm -f ${FS_FILE} >$NULL 2>&- # Get rid of any old ${FS_FILE}.
  3144. #
  3145. # Set machine specific variables for mount rpt field containing filesystem.
  3146. case ${MACHINE:=`uname`} in
  3147. IRIX*|OSF1) GROUP_ID=0 # Group id for 'system'.
  3148. FILE_SYSTEMS=`mount | grep -iv "read only" | $AWK_CMD '{print $3}'`
  3149. ;;
  3150. AIX) GROUP_ID=0 # Group id for 'system'.
  3151. FILE_SYSTEMS=`mount | grep -iv "ro," | $AWK_CMD 'BEGIN { getline getline } { if ( substr($1,1,1) == "/" ) { print $2 } else { print $3 } }'`
  3152. ;;
  3153. Linux) GROUP_ID=0 # Group id for 'system'.
  3154. FILE_SYSTEMS=`mount | grep -iv "ro," | $AWK_CMD '{print $3}'`
  3155. ;;
  3156. *) GROUP_ID=3 # Group id for 'sys'.
  3157. FILE_SYSTEMS=`mount | grep -iv "read only" | $AWK_CMD '{print $1}'`
  3158. ;;
  3159. esac
  3160. #
  3161. # Make a list of mounted filesystems and check each one.
  3162. for FS in $FILE_SYSTEMS ; do
  3163. touch ${FS}/$TEST_FNAME 2>&- || continue # Test if it's writeable
  3164. # Check that owner of created file is id 0.
  3165. [[ `ls -lon ${FS}/$TEST_FNAME | $AWK_CMD '{print $3}'` = 0 ]] || {
  3166. rm -f ${FS}/$TEST_FNAME 2>&-
  3167. continue
  3168. }
  3169. chown root ${FS}/$TEST_FNAME 2>&- || { # Test chown priviledge
  3170. rm -f ${FS}/$TEST_FNAME 2>&-
  3171. continue
  3172. }
  3173. chgrp $GROUP_ID ${FS}/$TEST_FNAME 2>&- || { # Test chgrp priviledge
  3174. rm -f ${FS}/$TEST_FNAME 2>&-
  3175. continue
  3176. }
  3177. ACTUAL_FNAME=`ls -l ${FS}/${TEST_FNAME}* 2>&- | $AWK_CMD '{print $NF}'`
  3178. ACTUAL_FNAME=`basename $ACTUAL_FNAME`
  3179. [ "$ACTUAL_FNAME" = "$TEST_FNAME" ] || { # Check long filenames.
  3180. rm -f ${FS}/$TEST_FNAME 2>&-
  3181. continue
  3182. }
  3183. #
  3184. # Now get 2nd to last field of last line of machine specific "df" output.
  3185. SPACE=`$DF_CMD $FS | tail -1 | $AWK_CMD '{printf("%d",$(NF-2))}'`
  3186. #
  3187. rm -f ${FS}/$TEST_FNAME 2>&- # Cleanup.
  3188. print "${FS}\t${SPACE:=0}" >> ${FS_FILE} # Looks O.K. write it out.
  3189. done
  3190. #
  3191. } # End of Size_filesystems.
  3192.  
  3193.  
  3194.  
  3195. Lmstat_node() # Ck we can talk to the ugslmd daemon running on nodename in arg1.
  3196. { # RKB Jul 9 15:33 98 V150P06
  3197. # RKB May 4 23:28 99 V160P08 Chng to accept socket@host formatted args.
  3198. # RKB updtd: Aug 28 06 NX050P16 Changes for new universal flexlm i.e. ugslmd.
  3199. # RKB Aug 29 06 NX5P16 Change ERR to a WARN.
  3200. #
  3201. # This function is called by Test_ugf_nodenames.
  3202. : ${1:?} # Required arg check, must be at least one arg.
  3203. [ "$UGF_WKDIR" ] || return 0 # Couldn't find lmutil so no-op this test.
  3204. #
  3205. # Do the lmstat test. Set LM_LICENSE_FILE to arg1 then call lmutil.
  3206. LM_LICENSE_FILE="$1" $UGF_WKDIR/lmutil lmstat -s ugslmd >&- || {
  3207. print "${WARN}The ugslmd daemon did NOT respond on: $1"
  3208. sleep 2 ; return 1
  3209. }
  3210. #
  3211. # Looks like it passed, so return 0.
  3212. return 0
  3213. #
  3214. } # End Lmstat_node.
  3215.  
  3216.  
  3217.  
  3218. Test_ugf_nodenames() # Test the nodenames supplied as arguments.
  3219. { # RKB May 18 16:44 98 V150P03.
  3220. # RKB May 5 00:26 99 V160P08 Chng to allow custom socket entries.
  3221. # RKB Oct 29 11:56 99 V160P20 Add specific check for "this_host".
  3222. #
  3223. # This function is called by Check_license_servers.
  3224. #
  3225. : ${1:?} # Required arg check, must be at least one arg.
  3226. #
  3227. # Init vars to be safe.
  3228. unset SERVER BAD_NAMES BAD_PINGS BAD_TESTS
  3229. GOOD_SERVERS=0 # Count how many good ones we find.
  3230. #
  3231. # Now loop through the names supplied as paramaters.
  3232. for SERVER_ID in "$@" ; do
  3233. #
  3234. # SERVER_ID is full socket@host or @host format. V160P08
  3235. # SERVER is just the host name.
  3236. SERVER=${SERVER_ID##*@} # Mask out '@' and all to left - just leave host.
  3237. [ "$SERVER" ] || continue 1 # If it's empty, we just had a socket num.
  3238. #
  3239. # Pre-screen for file names. Cant check those yet - future maybe.
  3240. # If it either Is a file or has a "/" in the name - skip it.
  3241. [[ "$SERVER" = *"/"* ]] || [ -f "$SERVER" ] && {
  3242. ((GOOD_SERVERS+=1)) # Inc. the good servers counter.
  3243. continue 1
  3244. }
  3245. #
  3246. # Pre-screen for non-node locked host fields.
  3247. case "$SERVER" in
  3248. "this_host")
  3249. print "${NOTE}For best performance you should change the \"SERVER\"
  3250. \r\tentry in the license file $UGFF_PMT
  3251. \r\tfrom \"$SERVER\" to your actual hostname \"${HOST}\". "
  3252. ((GOOD_SERVERS+=1)) # Increment the good servers counter.
  3253. sleep 3 ; continue 1
  3254. ;;
  3255. YourHost*|Yourhost*|ChangeThis*)
  3256. print "${WARN}invalid field: $SERVER must be edited before use.
  3257. \r\tThe installation may continue, but $SERVER must be changed
  3258. \r\tBEFORE running Unigraphics."
  3259. sleep 3 ; continue 1
  3260. ;;
  3261. esac
  3262. #
  3263. # O.K. Now were ready to actually check it as a nodename.
  3264. #
  3265. $VECHO "${MSG}Checking license server: ${SERVER} ... \c"
  3266. #
  3267. # Check if it's a valid hostname via etc/hosts, NIS or DNS.
  3268. Check_hostname $SERVER || { # Set a flag if it fails.
  3269. BAD_NAMES="$BAD_NAMES $SERVER"
  3270. continue 1 # Cant find host, skip to next one.
  3271. }
  3272. #
  3273. # Check the hostname using ping.
  3274. Ping_node $SERVER || {
  3275. BAD_PINGS="$BAD_PINGS $SERVER"
  3276. continue 1 # Cant ping host, skip to next one.
  3277. }
  3278. #
  3279. # If node IS the local host, set the flag and skip to next one.
  3280. # cuz cant test local ugflex - it may not be installed yet.
  3281. [ $SERVER = "$HOST" ] && { # True if local node.
  3282. UGF_LOCAL_SERVER=TRUE # Flag this is a local server.
  3283. ((GOOD_SERVERS+=1)) # Increment the good servers counter.
  3284. continue 1 # Skip to next server name.
  3285. }
  3286. #
  3287. # Check the full server_id (i.e. socket@host) using lmstat. V160P08.
  3288. [ $SERVER_ID = $SERVER ] && SERVER_ID="@$SERVER_ID" # Add an '@" if needed.
  3289. Lmstat_node $SERVER_ID || {
  3290. BAD_TESTS="$BAD_TESTS $SERVER"
  3291. continue 1 # Cant pass lmstat test, skip to next one.
  3292. }
  3293. #
  3294. # Got this far, must be o.k.
  3295. ((GOOD_SERVERS+=1)) # Increment the good servers counter.
  3296. done
  3297. #
  3298. return 0
  3299. #
  3300. } # End Test_ugf_nodenames
  3301.  
  3302.  
  3303.  
  3304. Updt_custom_files() # Passively copy and rename the customizable files.
  3305. { # These files are only updated if not already updated. i.e. passively.
  3306. # RKB Tue May 22 90
  3307. # RKB May 11 23:21 93 V10ph12g. Mv Ugraf10 logic to another function.
  3308. # RKB Jul 6 21:53 93 V1011 add lines to create links in bin.
  3309. # RKB Feb 17 17:15 94 V103 rm logic for menufile.grs
  3310. # RKB Apr 26 16:32 94 V103P4D add chmod 555 for ugplot dir.
  3311. # RKB Oct 13 00:10 94 V104P09 removed logic for uguser.dat
  3312. # RKB Jun 2 13:42 97 V130P17 Add xhatch2.chx, rm ufunc/xhatch.chx.
  3313. # RKB Jun 20 15:18 97 V130P18 Correct typo on xhatch2.chx.
  3314. # RKB Sep 9 13:20 97 V140P03 Remove logic for 10.ugf - obsoleted.
  3315. # RKB Dec 2 17:14 97 V140P09 Restore logic for 10.ugf - reinstated.
  3316. # RKB Jun 10 17:45 99 V160P11 Add logic for custom_dirs.dat_default.
  3317. # RKB Jun 10 17:45 99 V160P11 Add logic for custom_dirs.dat_default.
  3318. # RKB Jun 29 00:11 99 V160P12 Rm logic for cgmdef.txt, xhatch & xhatch2.
  3319. # RKB Aug 09 00:11 99 V160P12 Rm logic for cgmdef.txt, xhatch & xhatch2.
  3320. # RKB Aug 10 04 030P21 Rm obsolete logic for old plot queues.
  3321. #
  3322. OCWD=`pwd` ; cd ${BASE_DIR}
  3323. #
  3324. # Take care of 10.ugf
  3325. [ -f ugii/10.ugf_default -a ! -f ugii/10.ugf ] && {
  3326. cp ugii/10.ugf_default ugii/10.ugf ; }
  3327. chmod 777 ugii/10.ugf 2>&- # Make sure it's read/write/exec.
  3328. ( cd $BASE_DIR/bin ; ln -s ../ugii/10.ugf 10.ugf >$NULL 2>&- )
  3329. #
  3330. # Take care of blockfont.txt
  3331. [ -f ugii/blockfont.txt_default -a ! -f ugii/blockfont.txt ] && {
  3332. cp ugii/blockfont.txt_default ugii/blockfont.txt ; }
  3333. chmod 777 ugii/blockfont.txt 2>&- # Make sure it's read/write/exec.
  3334. ( cd $BASE_DIR/bin ; ln -s ../ugii/blockfont.txt blockfont.txt >$NULL 2>&- )
  3335. #
  3336. # Take care of custom_dirs.dat # Added V160P11
  3337. [ -f ugii/custom_dirs.dat_default -a ! -f ugii/custom_dirs.dat ] && {
  3338. cp ugii/custom_dirs.dat_default ugii/custom_dirs.dat ; }
  3339. ( cd $BASE_DIR/bin ; ln -s ../ugii/custom_dirs.dat custom_dirs.dat >$NULL 2>&- )
  3340. #
  3341. cd $OCWD
  3342. } # End of Updt_custom_files.
  3343.  
  3344.  
  3345.  
  3346. Updt_ug_files() # Update the .ugii_env file & customer default files.
  3347. { # These files are ALWAYS updated even if already updated. i.e. forced.
  3348. # RKB May 12 23:39 93 extracted from Mod_environment_files. V10ph12g
  3349. # RKB May 25 23:21 93 add handling for unigraphics.def to this function.
  3350. # RKB Feb 17 17:28 94 V10.3P2B chng logic to for loop & add ug_metric.def
  3351. # RKB Oct 12 00:05 94 V104P09 Added ug_cam.def & ugsmd_def.std
  3352. # RKB Nov 16 11:46 94 V104P15 Added ugmenu.dat
  3353. # RKB Feb 27 17:51 96 V111P03 Add logic for CAM *_default files.
  3354. # RKB Nov 20 13:08 97 V140P08 Add logic for ug_shops.def file.
  3355. # RKB Jun 15 16:37 99 V160P11 Rm logic for ugshops, comment out mach logic.
  3356. # RKB Jun 20 00 V170P11 Add ug_smd.def to the list.
  3357. # RKB Jan 10 01 V180P05 Add ug_bodydes.def to the list.
  3358. # RKB Feb 07 01 V180P07 Add ug_modeling.def to the list.
  3359. # RKB Jan 08 02 V190P09 Add ug_die.def to the list
  3360. # RKB Feb 12 03 V20P11 Add ug_cae_motion.def
  3361. # RKB Aug 10 04 030P21 Rm _default logic for a list of .def files.
  3362. # RKB Dec 11 07 NX6P16 Change .ugii_env to ugii_env.dat.
  3363. #
  3364. Check_root_access ${BASE_DIR}/ugii && { # Can't do it w/o root.
  3365. #
  3366. # Following list of files were removed in 030P21: ug_english.def
  3367. # ug_metric.def ug_modeling.def ug_cam.def ug_smd.def ug_die.def
  3368. # ug_cae_motion.def ug_bodydes.def
  3369. #
  3370. for FILENAME in ugii_env.dat ugmenu.dat ugsmd_def.std
  3371. do
  3372. FILENAME=$BASE_DIR/ugii/$FILENAME # prepend the ugii directory.
  3373. [ -f ${FILENAME} ] || $VECHO && { # Save the customer's original.
  3374. $VECHO "${MSG}Saving ${FILENAME}
  3375. \r\tas $UGS_TMP/`basename ${FILENAME}`.$$ ..."
  3376. cp ${FILENAME} $UGS_TMP/`basename ${FILENAME}`.$$ 2>&-
  3377. }
  3378. $VECHO "\r\tUpdating ${FILENAME} ..."
  3379. # This copy may not work on NFS clients, but it'll work on the server.
  3380. cp ${FILENAME}_default $FILENAME >$NULL 2>&-
  3381. done
  3382. } # End Check_root_access check for ugii.
  3383. #
  3384. #
  3385. return 0
  3386. } # End Updt_ug_files.
  3387.  
  3388.  
  3389.  
  3390. Updt_resource_files() # Update the X resource file in app-defaults.
  3391. { # RKB May 11 23:32 93. V10ph12g. Replaces Mod_ugraf function.
  3392. # RKB Jun 10 21:34 93. V10ph13g. Add XKeysymDB & Iview.
  3393. # RKB Aug 11 00:56 93 V10.1ph2 rm XKeysymDB, add Ugmenu10
  3394. # RKB Aug 23 23:24 93 V10.1p3c force replace Ugraf10 & Ugmenu10.
  3395. # RKB Oct 7 14:25 93 V10.1p3l fix save customer Ugraf10 & Ugmenu10.
  3396. # RKB Feb 17 23:27 94 V10.3P2B add ck for root access.
  3397. # RKB Mar 22 23:38 94 V103P3B add copies in UGS_TMP.
  3398. # RKB Apr 26 16:39 94 V103P4D add chmod 555 for created dirs.
  3399. # KDS Nov 18 18:30 94 V10.4 Change filenames to uppercase for IBM
  3400. # RKB Mar 6 23:44 95 V105P01. Merge in IBM & streamline.
  3401. # RKB Jun 21 22:14 95 V110P01. Change Ugraf10 file to Ugraf110.
  3402. # RKB Jun 21 23:15 95 V110P01. Rm Iview resource file. Obsoleted.
  3403. # RKB Oct 18 22:41 95 V110P12. Add Xessu resource file.
  3404. # RKB Oct 18 22:52 95 V110P12. Change logic to 'for' loop.
  3405. # RKB Feb 27 17:23 96 V111P03. Change Ugraf110 to Ugraf111.
  3406. # RKB Jul 29 14:05 96 V120P06. Change Ugraf111 to Ugraf${VNUM}.
  3407. # RKB Feb 10 17:09 98 V140P13. Change Xessu to Xessu4.
  3408. # RKB Jul 19 13:37 00 V170P14 Add Xessu5, rewrite to use $UPDT_LIST. Rm Iview.
  3409. # RKB Jun 27 17:16 01 V180P16 Add Xessu6 to the list.
  3410. # RKB Oct 31 11:51 02 V020P04 Change Ugraf$VNUM to Ugnx$FNUM.
  3411. # RKB Aug 10 04 030P21 Rm Xessu4 and Xessu5.
  3412. #
  3413. # 3 required variables.
  3414. : ${X11_DIR:?} # Internal ck.
  3415. : ${UGS_TMP:?} # Internal ck.
  3416. : ${FNUM:?} # Internal ck.
  3417. #
  3418. UPDT_LIST="Ugnx${FNUM} Ugmenu10 Xessu6" # File list. 030P21
  3419. #
  3420. # Either modify the system files or just put a new copy in UGS_TMP.
  3421. if [ "$MODIFY_OK" = yes ] && Check_root_access ${X11_DIR}
  3422. then # Installer said O.K. to modify system files. AND we have root access.
  3423. for FILE in $UPDT_LIST ; do
  3424. # Ck if the file is even there. If so Forcibly replace it.
  3425. [ -f $BASE_DIR/ugii/${FILE}_default ] || continue # Not there.
  3426. LONGNAME=$X11_DIR/app-defaults/$FILE
  3427. # Save customer's copy if present in app-defaults.
  3428. [ -f $LONGNAME ] && {
  3429. $VECHO "${MSG}Saving $LONGNAME
  3430. \r\tas $UGS_TMP/${FILE}.$$ ...\c"
  3431. cp $LONGNAME $UGS_TMP/${FILE}.$$ 2>&-
  3432. }
  3433. $VECHO "${MSG}Updating $LONGNAME ..."
  3434. cp $BASE_DIR/ugii/${FILE}_default $LONGNAME >$NULL 2>&-
  3435. chmod 444 $LONGNAME >$NULL 2>&-
  3436. done
  3437. else # Didn't want to mod system files. So just make copies.
  3438. for FILE in $UPDT_LIST ; do
  3439. [ -f $BASE_DIR/ugii/${FILE}_default ] && {
  3440. cp $BASE_DIR/ugii/${FILE}_default $UGS_TMP/$FILE >$NULL 2>&-
  3441. chmod 444 $UGS_TMP/$FILE 2>&-
  3442. }
  3443. done
  3444. fi
  3445. #
  3446. # Workaround kludge for IBM.
  3447. if [ "${MACHINE}" = "AIX" ] # Copy xterm to ugterm for IBM
  3448. then
  3449. cp /usr/lpp/X11/bin/xterm $BASE_DIR/ugii/ugterm 2>&-
  3450. chmod 555 $BASE_DIR/ugii/ugterm 2>&-
  3451. fi
  3452. #
  3453. return 0
  3454. } # End of Updt_resource_files
  3455.  
  3456.  
  3457.  
  3458. # ****************************************************************************
  3459. # MAIN ***********************************************************************
  3460. # ****************************************************************************
  3461.  
  3462.  
  3463. # Verify user is root
  3464. [ `id | cut -c5` = "0" ] || {
  3465. print "\r\tmust be root to run ${SCRIPTNAME}." ; exit 1
  3466. }
  3467.  
  3468. Check_runpath || exit 1 # Check SCRIPTDIR for '#' character.
  3469. Check_switches # Check for command line switches.
  3470. Set_main_defaults # Set defaults for main screen.
  3471.  
  3472. # Make the UGS_TMP dir if it's not already there.
  3473. [ -d "$UGS_TMP" ] || mkdir -p $UGS_TMP >$NULL 2>&-
  3474.  
  3475.  
  3476. while true ; do # Outer control loop.
  3477. Ask_main_screen || continue 1 # Ask all questions for the main screen.
  3478. # Main screen checking # Now check all the answers.
  3479. Check_source # Check the source directory.
  3480. Check_base # Check the base directory.
  3481. Check_modify_ok # Check ok to modify system files.
  3482. if [[ "$UGFS_PMT" = *"/"* ]] ; then # Check license file or server(s).
  3483. Check_license_file # UGFS_PMT had a slash so must be file.
  3484. else
  3485. Check_license_servers # Check user supplied servers. V150P03
  3486. fi
  3487.  
  3488. # Now ck if ANY error flags are set. If so, we loop.
  3489. print "$SRC_FLAG $BASE_FLAG $MOD_FLAG $UGFS_FLAG $UGFF_FLAG" | \
  3490. grep '\*\*\*' >$NULL && {
  3491. print "\n\n*\tEnter CR after reading errors. \c" ; read CR
  3492. continue 1
  3493. } # End error flag check.
  3494.  
  3495. # Size filesystems in background. Must be done after Check_base.
  3496. $VECHO # Cosmetic line feed.
  3497. $VECHO "${MSG}Sizing mounted File Systems ..."
  3498. Size_filesystems &
  3499. SIZE_FS_PID=$!
  3500.  
  3501. UGII_INSTALL_TYPE=$INS_TYPE # Log INS_TYPE if -l switch.
  3502. Log_var UGII_INSTALL_TYPE "UG Installation type"
  3503.  
  3504. Make_base # Make base dir if it doesn't exist.
  3505.  
  3506. # Now do the UNIQUE steps for the various installation types.
  3507. case ${INS_TYPE} in # Now take appropriate actions based on Install type.
  3508. load+configure) # Doing load AND config install. Install type 1.
  3509. Kill_ug # Kill the UG daemons.
  3510. [ "$V_SWT" ] || print "${MSG}Initializing product menu..."
  3511. Init_fs_arrays # Init file system arrays.
  3512. Init_prod_arrays # Init product arrays.
  3513. # If doing a load+configure, pre-select ALL kits. V150P07.
  3514. for KIT in ${PRODUCTS[*]} ; do
  3515. [ "`eval echo \\${${KIT}[0]}`" = "$SELECTED" ] || Select $KIT
  3516. done
  3517. #
  3518. # Allow installer to Select products to load.
  3519. while true ; do # Select products/check space loop.
  3520. Select_products || continue 2 # Select/Deselect products manually.
  3521. Check_space ; RTN_CODE=$? # Check space and save the return code.
  3522. case ${RTN_CODE:=0} in # Do not proceed till enough space.
  3523. 0) break 1 ;; # had enough, good status, break out.
  3524. 1) continue 1 ;; # not enough space re-sel prods.
  3525. 2) continue 2 ;; # not enough space re-sel base dir.
  3526. esac
  3527. done
  3528. Check_openfiles || continue 1 # Make sure there's no open files.
  3529. Load_selected_kits # Process & load kits NX030P19.
  3530. # load+configure only install continues below.
  3531. ;;
  3532. load_only) # Doing a load ONLY install. Install type 2.
  3533. [ "$V_SWT" ] || print "${MSG}Initializing product menu..."
  3534. Init_fs_arrays # Init file system arrays.
  3535. Init_prod_arrays # Init product arrays.
  3536. # Allow installer to Select products to load.
  3537. while true ; do # Select products/check space loop.
  3538. Select_products || continue 2 # Select/Deselect products manually.
  3539. Check_space ; RTN_CODE=$? # Check space and save the return code.
  3540. case ${RTN_CODE:=0} in # Do not proceed till enough space.
  3541. 0) break 1 ;; # had enough, good status, break out.
  3542. 1) continue 1 ;; # not enough space re-sel prods.
  3543. 2) continue 2 ;; # not enough space re-sel base dir.
  3544. esac
  3545. done
  3546. Check_openfiles || continue 1 # Make sure there's no open files.
  3547. Load_selected_kits # Process & load kits NX030P19.
  3548. print "\n\n\t${SCRIPTNAME} $INS_TYPE completed `date` "
  3549. exit 0 # Load_only install stops here.
  3550. ;;
  3551. configure_only) # Doing a configure ONLY install. Install type 3.
  3552. Kill_ug # Kill the UG daemons.
  3553. : # No-op. Nothing else to do here - mostly shown for readability.
  3554. # configure only install continues below.
  3555. ;;
  3556. esac
  3557.  
  3558.  
  3559. # The configure only AND the load+configure installs continue from here.
  3560. # _________________________________________________________________
  3561.  
  3562.  
  3563. $VECHO "\n\n\tENVIRONMENT CONFIGURATION "
  3564. [ "$V_SWT" ] || print "\n\tModifying environment files ...\c"
  3565. Mod_environment_files # Modify the environment config files.
  3566. Updt_ug_files # Update .ugii_env & cutomer def files.
  3567. Updt_resource_files # Update X resource files.
  3568. Mod_pvision_file ${BASE_DIR}/ugii/ugii # Added for Product Vision V160P22.
  3569.  
  3570. $VECHO "\n\n\tFILE CONFIGURATION \n"
  3571. [ "$V_SWT" ] || print "\n\tCreating links and custom files ...\c"
  3572. Rm_old_files # Remove obsoleted files.
  3573. Updt_custom_files # Passively update customizable files.
  3574. Link_all_products # Create the appropriate soft links.
  3575. Copy_license_file # If file, copy it. if servers no-op.
  3576. [ "$V_SWT" ] || echo # cosmetic echo
  3577.  
  3578.  
  3579. print "${NOTE}Some System requirements such as patch levels are NOT
  3580. \r\tchecked by this installation. Please review the Release Letter
  3581. \r\tinformation before running Unigraphics."
  3582.  
  3583. if [ "$MODIFY_OK" = yes ] ; then
  3584. Start_ug # Start the UG background processes.
  3585. print "${NOTE}To implement changes, log out/in of $HOST"
  3586. else
  3587. print "\n${NOTE}System files were NOT modified. This node: $HOST
  3588. \r\t is NOT yet configured to run $PRODNAME."
  3589. fi
  3590.  
  3591. # Completion message.
  3592. print "${MSG}${SCRIPTNAME} $INS_TYPE completed `date` "
  3593. exit 0
  3594.  
  3595. done # outer control loop.
  3596.  
  3597. # End of ug_install.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement