installCDE.src 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043
  1. XCOMM! KORNSHELL
  2. XCOMM $XConsortium: installCDE.src /main/20 1996/11/25 14:21:13 drk $
  3. XCOMM
  4. XCOMM This script uses the 'CDE' databases to install either the Desktop
  5. XCOMM environment on a specified machine or creates a tar ball to be used
  6. XCOMM in an install process.
  7. XCOMM
  8. XCOMM this script accepts the following parameters:
  9. XCOMM -s <source> -- The top of build tree where the files are
  10. XCOMM gathered from.
  11. XCOMM -z <package> -- The desktop install package
  12. XCOMM
  13. XCOMM Optional parameters:
  14. XCOMM
  15. XCOMM -t <package destination> -- where to store install package
  16. XCOMM -pI <actual install location> -- where CDE_INSTALLATION_TOP will be linked to.
  17. XCOMM -pC <actual config location> -- where CDE_CONFIGURATION_TOP will be linked to.
  18. XCOMM -pV <actual var location> -- where CDE_LOGFILES_TOP will be linked to.
  19. XCOMM -a <alternate udb directory>
  20. XCOMM -f <filesets> -- a quoted, space-separated list of
  21. XCOMM filesets to load. The .udb extension
  22. XCOMM is not required.
  23. XCOMM
  24. XCOMM -clean -- remove the temporary, configuration and installation
  25. XCOMM directories
  26. XCOMM -cleanTwo-- remove the temporary and installation directories
  27. XCOMM but NOT the configuration directory
  28. XCOMM -cleanEtc-- remove the configuration directories
  29. XCOMM -prog -- load only the development environment
  30. XCOMM -runtime -- load only the runtime environment
  31. XCOMM -pack -- create packing list
  32. XCOMM -pseudo -- don't configure the desktop
  33. XCOMM -nocompress -- don't compress the tarball (-t only)
  34. XCOMM
  35. XCOMM -Lang -- load the localized filesets
  36. XCOMM -LinkStepOnly -- set up the -pI, -pC, and -pV links
  37. XCOMM then exit
  38. XCOMM -DontRunScripts -- stop after installation
  39. XCOMM -RunScriptsOnly -- only execute the scripts
  40. XCOMM -configureOnly -- only configure the desktop
  41. XCOMM
  42. XCOMM ##########################################################################
  43. #define HASH #
  44. #define STAR *
  45. LOGFILE="installCDE.$$.log"
  46. REVISION="$(echo "$Revision: /main/20 $" | awk '{print $2}')"
  47. Log()
  48. {
  49. /bin/echo "$1" | tee -a $LOGFILE
  50. }
  51. MakeTarball()
  52. {
  53. Log "\nGenerating UNIX Desktop install package $DATE in $TARBALL_LOCATION"
  54. HASH
  55. HASH create installable tarball
  56. HASH
  57. Log "Creating tarball..."
  58. if [ $PLATFORM = "usl" -o "$PLATFORM" = "uxp" ]
  59. then
  60. ulimit -f unlimited
  61. fi
  62. DIRNAME=build.$DATE
  63. mkdir -p $TARBALL_LOCATION/$DIRNAME
  64. cd /
  65. echo $DATE >$LOGFILES_LOCATION/.build.$DATE
  66. chown bin $LOGFILES_LOCATION/.build.$DATE
  67. if [ "$COMPRESS_TARBALL" = "yes" ]; then
  68. tar -cf - $INSTALL_LOCATION/STAR \
  69. 2>$TARBALL_LOCATION/$DIRNAME/extract.err |
  70. compress -c >$TARBALL_LOCATION/$DIRNAME/dttar.Z
  71. else
  72. tar -cf $TARBALL_LOCATION/$DIRNAME/dt.tar \
  73. $INSTALL_LOCATION/STAR \
  74. 2>$TARBALL_LOCATION/$DIRNAME/extract.err 2>&1
  75. fi
  76. if [ "$ACTUAL_INSTALLATION_LOC" = "" ]; then
  77. actualInstallDir=$INSTALL_LOCATION
  78. else
  79. actualInstallDir=$ACTUAL_INSTALLATION_LOC
  80. fi
  81. let size=$(du -s $actualInstallDir | awk '{print $1}')*512
  82. HASH load installation fileset *after* tarball generated
  83. LoadFileSet "" "CDE-INSTALL"
  84. HASH create config dir
  85. destPost=$TARBALL_LOCATION/$DIRNAME/config
  86. mkdir $destPost
  87. HASH copy config and platform config scripts
  88. src=$INSTALL_LOCATION/install/$PLATFORM_SCRIPT_DIR
  89. cp $src/config/STAR.cfg $destPost
  90. HASH copy this script and install.dt platform overrides
  91. cp $src/install.dto $TARBALL_LOCATION/$DIRNAME/install.dto
  92. cp $src/install.cde $TARBALL_LOCATION/$DIRNAME/install.cde
  93. chmod 755 $TARBALL_LOCATION/$DIRNAME/install.cde
  94. cd /
  95. Log "done."
  96. cat >$TARBALL_LOCATION/$DIRNAME/dt.pkg <<FIN
  97. PLATFORM: $PLATFORM
  98. VERSION: $REVISION
  99. TS: $DATE
  100. COMPRESSED: $COMPRESS_TARBALL
  101. SIZE: $size
  102. CL: $ORIGINAL_COMMAND_LINE
  103. FILESETS: $DATABASE_FILES
  104. FIN
  105. cat >$TARBALL_LOCATION/$DIRNAME/build.status <<FIN
  106. The UNIX Desktop
  107. BUILD: $DATE
  108. OVERALL STATUS: <not yet tested>
  109. OVERALL PERFORMANCE: <not yet tested>
  110. MAJOR PROBLEMS: <not yet tested>
  111. FIN
  112. chmod g+w $TARBALL_LOCATION/$DIRNAME/build.status
  113. }
  114. DoFilesetScript()
  115. {
  116. typeset ScriptName
  117. FilesetName=$1
  118. if [ "$BUILD_TREE" = "" ]; then
  119. ScriptName=$3 # use short config file name (foo.cfg)
  120. else
  121. ScriptName=$2 # use long config file name (configFoo)
  122. fi
  123. if [ $CDECONFIGDIR = "CONFIG" ]; then
  124. typeset -u ScriptName
  125. fi
  126. test_string=${DATABASE_FILES#*$FilesetName}
  127. if (( ${#DATABASE_FILES} > ${#test_string} ))
  128. then
  129. if [ -x $POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName ]
  130. then
  131. Log "Executing $PLATFORM specific $FilesetName customize script"
  132. KORNSHELL $POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName -e 2>&1 | \
  133. tee -a $LOGFILE
  134. elif [ -x $POST_INSTALL_DIR/$ScriptName ]
  135. then
  136. Log "Executing $FilesetName customize script"
  137. KORNSHELL $POST_INSTALL_DIR/$ScriptName -e 2>&1 | tee -a $LOGFILE
  138. fi
  139. fi
  140. }
  141. DoScripts()
  142. {
  143. Log " "
  144. DoFilesetScript CDE-TT configTT tt.cfg
  145. DoFilesetScript CDE-MIN configMin min.cfg
  146. DoFilesetScript CDE-SHLIBS configShlibs shlibs.cfg
  147. DoFilesetScript CDE-RUN configRun run.cfg
  148. }
  149. CreatePackingList()
  150. {
  151. Log " "
  152. Log "Creating packing list."
  153. touch $INSTALL_LOCATION/Packing_list
  154. for i in `echo $DATABASE_FILES`
  155. do
  156. Log " for $i"
  157. KORNSHELL $TOOL_DIR/udbToAny.ksh -toDB -ReleaseStream $PLATFORM $DATABASE_DIR/${i}.udb > /tmp/${i}.db
  158. if [ -r /tmp/${i}.db ]
  159. then
  160. for file in `fgrep install_target /tmp/${i}.db | cut -sf 2 -d \: `
  161. do
  162. echo "$file" >>$INSTALL_LOCATION/Packing_list
  163. done
  164. fi
  165. done
  166. }
  167. CleanDaemons()
  168. {
  169. HASH kill these processes so that they can be removed and new ones
  170. HASH installed
  171. for i in inetd rpc.ttdbserver rpc.cmsd
  172. do
  173. if [ "$PLATFORM" = "aix" -a $i = "inetd" ]
  174. then
  175. lssrc -s inetd >/dev/null 2>&1
  176. if [ $? = "0" ]
  177. then
  178. stopsrc -s inetd >>$LOGFILE 2>&1
  179. fi
  180. elif [ "$PLATFORM" = "openbsd" ]
  181. then
  182. ps axo pid,comm | grep $i > /tmp/tmppsout
  183. if [ -s /tmp/tmppsout ]
  184. then
  185. awk '{print "kill " $1}' /tmp/tmppsout | /bin/csh -f
  186. sleep 2
  187. fi
  188. elif [ "$PLATFORM" = "freebsd" ]
  189. then
  190. ps axo pid,comm | grep $i > /tmp/tmppsout
  191. if [ -s /tmp/tmppsout ]
  192. then
  193. awk '{print "kill " $1}' /tmp/tmppsout | /bin/csh -f
  194. sleep 2
  195. fi
  196. elif [ "$PLATFORM" = "netbsd" ]
  197. then
  198. ps axo pid,comm | grep $i > /tmp/tmppsout
  199. if [ -s /tmp/tmppsout ]
  200. then
  201. awk '{print "kill " $1}' /tmp/tmppsout | /bin/csh -f
  202. sleep 2
  203. fi
  204. elif [ "$PLATFORM" = "linux" ]
  205. then
  206. ps axo pid,comm | grep $i > /tmp/tmppsout
  207. if [ -s /tmp/tmppsout ]
  208. then
  209. awk '{print "kill " $1}' /tmp/tmppsout | /bin/sh -f
  210. sleep 2
  211. fi
  212. else
  213. ps -ef | grep $i | grep -v grep >/tmp/tmppsout
  214. if [ -s /tmp/tmppsout ]
  215. then
  216. awk '{print "kill " $2}' /tmp/tmppsout | /bin/csh -f
  217. sleep 2
  218. fi
  219. fi
  220. done
  221. rm -f /tmp/tmppsout
  222. }
  223. RestartInetd()
  224. {
  225. HASH now restart inetd
  226. OLDPWD=`pwd`
  227. cd /
  228. if [ "$PLATFORM" = "usl" -o "$PLATFORM" = "uxp" ]
  229. then
  230. /usr/sbin/inetd -s
  231. elif [ "$PLATFORM" = "sun" ]
  232. then
  233. /usr/sbin/svcadm refresh svc:/network/inetd:default
  234. /usr/sbin/svcadm restart svc:/network/inetd:default
  235. elif [ "$PLATFORM" = "aix" ]
  236. then
  237. startsrc -s inetd >>$LOGFILE 2>&1
  238. elif [ "$PLATFORM" = "dec" ]
  239. then
  240. /usr/sbin/inetd
  241. elif [ "$PLATFORM" = "openbsd" ]
  242. then
  243. /etc/rc.d/inetd start >/dev/null
  244. elif [ "$PLATFORM" = "freebsd" ]
  245. then
  246. /etc/rc.d/inetd onestart
  247. elif [ "$PLATFORM" = "netbsd" ]
  248. then
  249. /etc/rc.d/inetd start >/dev/null
  250. elif [ "$PLATFORM" = "linux" ]
  251. then
  252. /etc/init.d/openbsd-inetd start >/dev/null 2>&1
  253. else
  254. #ifdef hpV4
  255. /usr/sbin/inetd
  256. #else
  257. /etc/inetd
  258. #endif
  259. fi
  260. cd $OLDPWD
  261. }
  262. CheckForActualLocations()
  263. {
  264. XCOMM
  265. XCOMM if different actual locations specified, set up the links
  266. XCOMM
  267. if [ "$CLEAN_DAEMONS" = "yes" ]
  268. then
  269. CleanDaemons
  270. fi
  271. HASH remove the contents of the installation directory then the directory
  272. HASH itself
  273. if [ "$CLEANING" = "yes" ]
  274. then
  275. Log "Removing $INSTALL_LOCATION contents... "
  276. if [ -d $INSTALL_LOCATION ]
  277. then
  278. rm -rf $INSTALL_LOCATION/STAR
  279. if [ "$LeaveLinks" = "yes" ]
  280. then
  281. if [ ! -L $INSTALL_LOCATION ]
  282. then
  283. rm -rf $INSTALL_LOCATION
  284. fi
  285. else
  286. if [ -L $INSTALL_LOCATION ]
  287. then
  288. rm -f $INSTALL_LOCATION
  289. else
  290. rm -rf $INSTALL_LOCATION
  291. fi
  292. fi
  293. fi
  294. fi
  295. if [ "$CONFIGURE_ONLY" = "no" ]
  296. then
  297. if [ "$ACTUAL_INSTALLATION_LOC" != "" ]
  298. then
  299. HASH
  300. HASH first create the actual directory - if not there
  301. HASH
  302. if [ ! -d $ACTUAL_INSTALLATION_LOC ]
  303. then
  304. mkdir -p $ACTUAL_INSTALLATION_LOC
  305. if [ ! -d $ACTUAL_INSTALLATION_LOC ]
  306. then
  307. Log "cannot create $ACTUAL_INSTALLATION_LOC directory"
  308. exit 1
  309. fi
  310. fi
  311. ln -s $ACTUAL_INSTALLATION_LOC $INSTALL_LOCATION
  312. else
  313. if [ ! -d $INSTALL_LOCATION -a ! -L $INSTALL_LOCATION ];
  314. then
  315. mkdir -p $INSTALL_LOCATION
  316. fi
  317. fi
  318. fi
  319. if [ "$CLEAN_DAEMONS" = "yes" ]
  320. then
  321. RestartInetd
  322. fi
  323. HASH remove the contents of the configuration directory
  324. if [ "$CLEANING_ETC" = "yes" ]
  325. then
  326. Log "Removing $CONFIGURE_LOCATION contents... "
  327. if [ -d $CONFIGURE_LOCATION ]
  328. then
  329. rm -rf $CONFIGURE_LOCATION/STAR
  330. if [ "$LeaveLinks" = "yes" ]
  331. then
  332. if [ ! -L $CONFIGURE_LOCATION ]
  333. then
  334. rm -rf $CONFIGURE_LOCATION
  335. fi
  336. else
  337. if [ -L $CONFIGURE_LOCATION ]
  338. then
  339. rm -f $CONFIGURE_LOCATION
  340. else
  341. rm -rf $CONFIGURE_LOCATION
  342. fi
  343. fi
  344. fi
  345. fi
  346. if [ "$ACTUAL_CONFIGURATION_LOC" != "" ]
  347. then
  348. if [ ! -d $ACTUAL_CONFIGURATION_LOC ]
  349. then
  350. mkdir -p $ACTUAL_CONFIGURATION_LOC
  351. if [ ! -d $ACTUAL_CONFIGURATION_LOC ]
  352. then
  353. Log "cannot create $ACTUAL_CONFIGURATION_LOC directory"
  354. exit 1
  355. fi
  356. fi
  357. ln -s $ACTUAL_CONFIGURATION_LOC $CONFIGURE_LOCATION
  358. else
  359. if [ ! -d $CONFIGURE_LOCATION -a ! -L $CONFIGURE_LOCATION ];
  360. then
  361. mkdir -p $CONFIGURE_LOCATION
  362. fi
  363. fi
  364. if [ "$CLEANING" = "yes" ]
  365. then
  366. Log "Removing $LOGFILES_LOCATION contents... "
  367. if [ -d $LOGFILES_LOCATION ]
  368. then
  369. rm -rf $LOGFILES_LOCATION/STAR
  370. if [ "$LeaveLinks" = "yes" ]
  371. then
  372. if [ ! -L $LOGFILES_LOCATION ]
  373. then
  374. rm -rf $LOGFILES_LOCATION
  375. fi
  376. else
  377. if [ -L $LOGFILES_LOCATION ]
  378. then
  379. rm -f $LOGFILES_LOCATION
  380. else
  381. rm -rf $LOGFILES_LOCATION
  382. fi
  383. fi
  384. fi
  385. fi
  386. if [ "$ACTUAL_VAR_LOC" != "" ]
  387. then
  388. if [ ! -d $ACTUAL_VAR_LOC ]
  389. then
  390. mkdir -p $ACTUAL_VAR_LOC
  391. if [ ! -d $ACTUAL_VAR_LOC ]
  392. then
  393. Log "cannot create $ACTUAL_VAR_LOC directory"
  394. exit 1
  395. fi
  396. fi
  397. ln -s $ACTUAL_VAR_LOC $LOGFILES_LOCATION
  398. else
  399. if [ ! -d $LOGFILES_LOCATION -a ! -L $LOGFILES_LOCATION ];
  400. then
  401. mkdir -p $LOGFILES_LOCATION
  402. fi
  403. fi
  404. Log " "
  405. }
  406. USAGE()
  407. {
  408. echo -e "Usage: $(basename $0) {-s <source>|-z <package>} [options]"
  409. echo -e ""
  410. echo -e "\t-s <source>\t\t\tthe top of the build tree"
  411. echo -e "\t-z <package>\t\tthe desktop install package"
  412. echo -e ""
  413. echo -e "\tOptions:"
  414. echo -e ""
  415. echo -e "\t[-t <package_destination>]\tif specified create an"
  416. echo -e "\t\t\t\t\tinstall package and store it in the"
  417. echo -e "\t\t\t\t\tdestination."
  418. echo -e "\t[-pI <actual install location>]\twhere" CDE_INSTALLATION_TOP "will be linked to."
  419. echo -e "\t[-pC <actual config location>]\twhere" CDE_CONFIGURATION_TOP "will be linked to."
  420. echo -e "\t[-pV <actual var location>]\twhere" CDE_LOGFILES_TOP "will be linked to."
  421. echo -e ""
  422. echo -e "\t[-a <udb directory>]\t\talternate place to get the"
  423. echo -e "\t\t\t\t\tudb files from."
  424. echo -e "\t[-f <filesets>]\t\t\tspecify filesets to be loaded."
  425. echo -e "\t\t\t\t\tThe list should be double-quoted,"
  426. echo -e "\t\t\t\t\tspace-separated, with no .udb"
  427. echo -e "\t\t\t\t\textensions."
  428. echo -e ""
  429. echo -e "\t[-clean]\t\t\tremove the temporary, configuration, and"
  430. echo -e "\t\t\t\t\tinstallation directory"
  431. echo -e "\t[-cleanTwo]\t\t\tremove the temporary and installation "
  432. echo -e "\t\t\t\t\tdirectory, but NOT the configuration directory"
  433. echo -e "\t[-cleanEtc]\t\t\tremove the configuration directory, but "
  434. echo -e "\t\t\t\t\NOT the temporary and installation directories"
  435. echo -e "\t[-prog]\t\t\t\tload only the development environment"
  436. echo -e "\t[-runtime]\t\t\tload only the runtime environment"
  437. echo -e "\t[-relative]\t\t\trun the relative-located config scripts"
  438. echo -e "\t[-pack]\t\t\t\tcreate a packing list"
  439. echo -e "\t[-pseudo]\t\t\tdo not configure desktop when installing"
  440. echo -e "\t[-nocompress]\t\t\tdo not compress tarball when creating package"
  441. echo -e "\t[-lang LANG]\t\t\tspecify LANG to load appropriate localized"
  442. echo -e "\t\t\t\t\tfilesets"
  443. echo -e "\t[-LeaveLinks]\t\t\t\tdo not delete the links after cleaning"
  444. echo -e ""
  445. echo -e "\t[-LinkStepOnly]\t\t\tset up the -pI, -pC, and -pV links"
  446. echo -e "\t\t\t\t\tthen exit"
  447. echo -e "\t[-DontRunScripts]\t\tstop after installation"
  448. echo -e "\t[-RunScriptsOnly]\t\tonly execute the scripts"
  449. echo -e "\t[-configureOnly]\t\tonly configure the desktop"
  450. echo -e ""
  451. echo -e "\tExamples:"
  452. echo -e ""
  453. echo -e "\tinstallCDE -s /x/cde_hp700_90"
  454. echo -e "\tinstallCDE -s /x/cde_aix_32 -f \"CDE_MIN CDE-SHLIBS\""
  455. echo -e "\tinstallCDE -s /x/cde_sun_52 -pI /bigdisk/opt/dt -clean"
  456. echo -e "\tinstallCDE -s /x/cde_sun_52 -pI /dtinstall -clean\\"
  457. echo -e "\t\t-pseudo -t /dtpackages -nocompress"
  458. }
  459. XCOMM
  460. XCOMM LoadFileSet() - load a UDB file
  461. XCOMM $1 - fileset number
  462. XCOMM $2 - fileset name
  463. XCOMM
  464. LoadFileSet()
  465. {
  466. if [ "$1" = "" ]; then
  467. num=""
  468. else
  469. num="$1."
  470. fi
  471. XCOMM don't bother if the fileset doesn't exist
  472. if [ ! -e $DATABASE_DIR/${2}.udb ]
  473. then
  474. return
  475. fi
  476. Log " $num installing database $2"
  477. Log " - creating ${2}.lst file"
  478. KORNSHELL $TOOL_DIR/udbToAny.ksh -toLst -ReleaseStream $PLATFORM \
  479. $DATABASE_DIR/${2}.udb > /tmp/${2}.lst
  480. Log " - installing ... "
  481. KORNSHELL $TOOL_DIR/mkProd -D / -S $BUILD_TREE /tmp/${2}.lst \
  482. 2>/tmp/${2}.err 1>/tmp/${2}.good
  483. Log " done."
  484. Log " - checking for errors ..."
  485. rm -f /tmp/${2}.missing
  486. awk '{if ($1 == "ERROR:") print " " $4}' \
  487. /tmp/${2}.err >> /tmp/${2}.missing
  488. if [ -s /tmp/${2}.missing ]
  489. then
  490. Log " - missing files:"
  491. cat /tmp/${2}.missing | tee -a $LOGFILE
  492. fi
  493. }
  494. ORIGINAL_COMMAND_LINE="$*"
  495. XCOMM Set which system we are on
  496. BUILDSYSTEM=$(uname)
  497. PLATFORM=""
  498. PLATFORM_SCRIPT_DIR=""
  499. XCOMM
  500. XCOMM Set system
  501. XCOMM
  502. if [ $BUILDSYSTEM = "AIX" ];
  503. then
  504. PLATFORM=aix
  505. PLATFORM_SCRIPT_DIR=ibm
  506. elif [ $BUILDSYSTEM = "SunOS" ];
  507. then
  508. PLATFORM=sun
  509. PLATFORM_SCRIPT_DIR=sun
  510. elif [ $BUILDSYSTEM = "UNIX_SV" ];
  511. then
  512. PLATFORM=usl
  513. PLATFORM_SCRIPT_DIR=usl
  514. elif [ $BUILDSYSTEM = "UNIX_System_V" ];
  515. then
  516. PLATFORM=uxp
  517. PLATFORM_SCRIPT_DIR=uxp
  518. elif [ $BUILDSYSTEM = "OSF1" ];
  519. then
  520. PLATFORM=dec
  521. PLATFORM_SCRIPT_DIR=dec
  522. elif [ $BUILDSYSTEM = "Linux" ];
  523. then
  524. PLATFORM="linux"
  525. PLATFORM_SCRIPT_DIR="linux"
  526. elif [ $BUILDSYSTEM = "FreeBSD" ];
  527. then
  528. PLATFORM="freebsd"
  529. PLATFORM_SCRIPT_DIR="freebsd"
  530. elif [ $BUILDSYSTEM = "OpenBSD" ];
  531. then
  532. PLATFORM="openbsd"
  533. PLATFORM_SCRIPT_DIR="openbsd"
  534. elif [ $BUILDSYSTEM = "NetBSD" ];
  535. then
  536. PLATFORM="netbsd"
  537. PLATFORM_SCRIPT_DIR="netbsd"
  538. else # Build system = HP
  539. PLATFORM=hp-ux
  540. PLATFORM_SCRIPT_DIR=hp
  541. fi
  542. if [ "$PLATFORM" = "aix" ];
  543. then
  544. USER=`/bin/whoami`
  545. elif [ "$PLATFORM" = "usl" -o "$PLATFORM" = "uxp" ];
  546. then
  547. USER=`/usr/ucb/whoami`
  548. else
  549. USER=`/usr/bin/whoami`
  550. fi
  551. if [ "$USER" != "root" ];
  552. then
  553. echo ""
  554. echo "You should be root to run this script. Continuing anyway."
  555. echo ""
  556. fi
  557. if [ "$PLATFORM" = "usl" -o "$PLATFORM" = "uxp" ]
  558. then
  559. umask 000
  560. fi
  561. unset TMPDIR
  562. CLEANING="no"
  563. CLEANING_ETC="no"
  564. TARBALL="no"
  565. COMPRESS_TARBALL="yes"
  566. USE_ALTERNATE_UDB_DIR="no"
  567. DEVELOP_ENV="no"
  568. RUNTIME_ENV="no"
  569. USE_RELATIVE="no"
  570. STARTING_DIR=$PWD
  571. ACTUAL_INSTALLATION_LOC=""
  572. ACTUAL_CONFIGURATION_LOC=""
  573. ACTUAL_VAR_LOC=""
  574. CREATE_PACKING_LIST="no"
  575. DO_LINK_STEP_ONLY="no"
  576. DO_INSTALL_ONLY="no"
  577. RUN_SCRIPTS="yes"
  578. RUN_SCRIPTS_ONLY="no"
  579. DATABASE_FILES=""
  580. BUILD_TREE=""
  581. TAR_DIR=""
  582. LeaveLinks="no"
  583. REMOVE_LINKS="no"
  584. CLEAN_DAEMONS="yes"
  585. theLang=""
  586. CONFIGURE_ONLY="no"
  587. rm -f $LOGFILE
  588. Log "Options specified..."
  589. while [ $# -ne 0 ]; do
  590. case $1 in
  591. -s) Log " - get the build tree to extract from"
  592. shift;
  593. [ $# -ne 0 ] || {
  594. USAGE
  595. exit 1;
  596. }
  597. BUILD_TREE=$1
  598. shift;
  599. ;;
  600. -z) Log " - get the install package to extract from"
  601. shift;
  602. [ $# -ne 0 ] || {
  603. USAGE
  604. exit 1;
  605. }
  606. TAR_TREE=$1
  607. shift;
  608. ;;
  609. -t) Log " - where to put the install package"
  610. shift;
  611. [ $# -ne 0 ] || {
  612. USAGE
  613. exit 1;
  614. }
  615. if [ "$SOURCE_TAR_FILE" = "" ]
  616. then
  617. TARBALL="yes"
  618. TARBALL_LOCATION=$1
  619. fi
  620. shift;
  621. ;;
  622. -a) Log " - alternate place to get the udb files from"
  623. shift;
  624. [ $# -ne 0 ] || {
  625. USAGE
  626. exit 1;
  627. }
  628. ALTERNATE_UDB_DIR=$1
  629. USE_ALTERNATE_UDB_DIR="yes"
  630. shift;
  631. ;;
  632. -f) Log " - load specific filesets"
  633. shift;
  634. [ $# -ne 0 ] || {
  635. USAGE
  636. exit 1;
  637. }
  638. DATABASE_FILES=$1
  639. shift;
  640. ;;
  641. -p) Log " - get all locations"
  642. shift;
  643. [ $# -ne 0 ] || {
  644. USAGE
  645. exit 1;
  646. }
  647. ACTUAL_INSTALLATION_LOC=$1
  648. ACTUAL_CONFIGURATION_LOC=$1
  649. ACTUAL_VAR_LOC=$1
  650. shift;
  651. ;;
  652. -pI) Log " - get actual installation location"
  653. shift;
  654. [ $# -ne 0 ] || {
  655. USAGE
  656. exit 1;
  657. }
  658. ACTUAL_INSTALLATION_LOC=$1
  659. shift;
  660. ;;
  661. -pC) Log " - get actual configuration location"
  662. shift;
  663. [ $# -ne 0 ] || {
  664. USAGE
  665. exit 1;
  666. }
  667. ACTUAL_CONFIGURATION_LOC=$1
  668. shift;
  669. ;;
  670. -pV) Log " - get actual var location"
  671. shift;
  672. [ $# -ne 0 ] || {
  673. USAGE
  674. exit 1;
  675. }
  676. ACTUAL_VAR_LOC=$1
  677. shift;
  678. ;;
  679. -clean) Log " - delete all three cde directories"
  680. CLEANING="yes"
  681. CLEANING_ETC="yes"
  682. shift;
  683. ;;
  684. -cleanTwo) Log " - delete only temporary and installation directories"
  685. CLEANING="yes"
  686. shift;
  687. ;;
  688. -cleanEtc) Log " - delete only the configuration directory"
  689. CLEANING_ETC="yes"
  690. shift;
  691. ;;
  692. -prog) Log " - load only the development environment"
  693. DEVELOP_ENV="yes"
  694. RUNTIME_ENV="no"
  695. shift;
  696. ;;
  697. -runtime) Log " - load only the runtime environment"
  698. RUNTIME_ENV="yes"
  699. DEVELOP_ENV="no"
  700. shift;
  701. ;;
  702. -relative) Log " - run the relative-located config scripts"
  703. USE_RELATIVE="yes"
  704. shift;
  705. ;;
  706. -pack) Log " - create a packing list"
  707. CREATE_PACKING_LIST="yes"
  708. shift;
  709. ;;
  710. -LeaveLinks) Log " - do not remove the links"
  711. LeaveLinks="yes"
  712. shift;
  713. ;;
  714. -LinkStepOnly) Log " - do link step only"
  715. DO_LINK_STEP_ONLY="yes"
  716. shift;
  717. ;;
  718. -DontRunScripts) Log " - stop after installation"
  719. DO_INSTALL_ONLY="yes"
  720. shift;
  721. ;;
  722. -RunScriptsOnly) Log " - only run scripts"
  723. RUN_SCRIPTS_ONLY="yes"
  724. shift;
  725. ;;
  726. -pseudo) Log " - pseudo install"
  727. RUN_SCRIPTS="no"
  728. REMOVE_LINKS="yes"
  729. CLEAN_DAEMONS="no"
  730. shift;
  731. ;;
  732. -nocompress) Log " - do not compress tarball"
  733. COMPRESS_TARBALL="no"
  734. shift;
  735. ;;
  736. -lang) Log " - load localized filesets"
  737. shift;
  738. [ $# -ne 0 ] || {
  739. USAGE
  740. exit 1;
  741. }
  742. theLang=$1
  743. shift;
  744. ;;
  745. -configureOnly) Log " - Configure only"
  746. CONFIGURE_ONLY="yes"
  747. CLEAN_DAEMONS="yes"
  748. shift;
  749. ;;
  750. *) Log " - unknown option"
  751. USAGE
  752. exit 1;
  753. ;;
  754. esac
  755. done
  756. echo ""
  757. if [ -z "$BUILD_TREE" -a -z "$TAR_TREE" ]
  758. then
  759. USAGE
  760. exit 1
  761. fi
  762. if [ "$BUILD_TREE" != "" -a ! -d "$BUILD_TREE" ]
  763. then
  764. Log "Build tree does not exist."
  765. exit 1
  766. fi
  767. if [ "$TAR_TREE" != "" -a ! -d "$TAR_TREE" ]
  768. then
  769. Log "Tar tree does not exist."
  770. exit 1
  771. fi
  772. CDEPACKAGE=dt.pkg
  773. CDETARFILE=dt.tar
  774. CDETARFILEZ=dttar.Z
  775. CDECONFIGDIR=config
  776. XCOMM
  777. XCOMM get the current time stamp if going to create a tarball
  778. XCOMM
  779. if [ $TARBALL = "yes" ];
  780. then
  781. set -- `/bin/date`
  782. DATE=$2_$3_$4_$6
  783. fi
  784. if [ -z "$BUILD_TREE" -a ${0##STAR/} = INSTALL.CDE ]; then
  785. typeset -u CDEPACKAGE
  786. typeset -u CDETARFILE
  787. typeset -u CDETARFILEZ
  788. typeset -u CDECONFIGDIR
  789. fi
  790. TOOL_DIR=$BUILD_TREE/admin/IntegTools/dbTools
  791. if [ "$USE_RELATIVE" = "yes" ]
  792. then
  793. POST_INSTALL_DIR=../post_install
  794. else
  795. if [ -z "$BUILD_TREE" ]
  796. then
  797. POST_INSTALL_DIR=$TAR_TREE/$CDECONFIGDIR
  798. else
  799. POST_INSTALL_DIR=$BUILD_TREE/admin/IntegTools/post_install
  800. fi
  801. fi
  802. if [ "$USE_ALTERNATE_UDB_DIR" = "yes" ]
  803. then
  804. DATABASE_DIR=$ALTERNATE_UDB_DIR/databases
  805. else
  806. DATABASE_DIR=$BUILD_TREE/databases
  807. fi
  808. if [ "$DATABASE_FILES" = "" ]
  809. then
  810. if [ "$DEVELOP_ENV" = "yes" ]
  811. then
  812. DATABASE_FILES="CDE-HELP-PRG CDE-PRG CDE-INC CDE-DEMOS \
  813. CDE-MAN-DEV CDE-SHLIBS"
  814. elif [ "$RUNTIME_ENV" = "yes" ]
  815. then
  816. DATABASE_FILES="CDE-RUN CDE-MIN CDE-TT CDE-MAN CDE-HELP-RUN CDE-C \
  817. CDE-HELP-C CDE-MSG-C CDE-SHLIBS CDE-ICONS CDE-FONTS \
  818. CDE-INFO CDE-INFOLIB-C"
  819. else
  820. DATABASE_FILES="CDE-RUN CDE-MIN CDE-TT CDE-MAN CDE-HELP-RUN CDE-C \
  821. CDE-MSG-C CDE-HELP-C CDE-SHLIBS CDE-HELP-PRG \
  822. CDE-PRG CDE-INC CDE-DEMOS CDE-MAN-DEV CDE-ICONS \
  823. CDE-FONTS CDE-INFO CDE-INFOLIB-C"
  824. fi
  825. HASH now load any localized filesets
  826. if [ "$DEVELOP_ENV" != "yes" ]
  827. then
  828. if [ "$theLang" != "" ]
  829. then
  830. DATABASE_FILES="$DATABASE_FILES CDE-$theLang CDE-MSG-$theLang \
  831. CDE-HELP-$theLang"
  832. else
  833. HASH load all current (working) languages
  834. DATABASE_FILES="$DATABASE_FILES \
  835. CDE-DE \
  836. CDE-MSG-DE \
  837. CDE-HELP-DE \
  838. CDE-ES \
  839. CDE-MSG-ES \
  840. CDE-HELP-ES \
  841. CDE-FR \
  842. CDE-MSG-FR \
  843. CDE-HELP-FR \
  844. CDE-IT \
  845. CDE-MSG-IT \
  846. CDE-HELP-IT "
  847. fi
  848. fi
  849. fi
  850. [ -z "$INSTALL_LOCATION" ] && INSTALL_LOCATION=CDE_INSTALLATION_TOP
  851. [ -z "$CONFIGURE_LOCATION" ] && CONFIGURE_LOCATION=CDE_CONFIGURATION_TOP
  852. [ -z "$LOGFILES_LOCATION" ] && LOGFILES_LOCATION=CDE_LOGFILES_TOP
  853. if [ -L $INSTALL_LOCATION -a "$CONFIGURE_ONLY" != "yes" ]
  854. then
  855. touch $INSTALL_LOCATION/foo >/dev/null 2>/dev/null
  856. if [ ! -f $INSTALL_LOCATION/foo ]
  857. then
  858. Log "Insufficient permissions to install CDE files in $INSTALL_LOCATION"
  859. exit 1
  860. fi
  861. if [ ! -O $INSTALL_LOCATION/foo ]
  862. then
  863. Log "Root access to $INSTALL_LOCATION is required for CDE installation."
  864. exit 1
  865. fi
  866. rm $INSTALL_LOCATION/foo
  867. fi
  868. if [ -d $INSTALL_LOCATION ]
  869. then
  870. if [ -x $INSTALL_LOCATION/bin -a ! -d $INSTALL_LOCATION/bin ]
  871. then
  872. rm -f $INSTALL_LOCATION/bin
  873. fi
  874. fi
  875. if [ "$CONFIGURE_ONLY" = "yes" ]
  876. then
  877. CheckForActualLocations
  878. DoScripts
  879. Log "Configuration completed."
  880. exit 0
  881. fi
  882. if [ "$RUN_SCRIPTS_ONLY" = "yes" ]
  883. then
  884. DoScripts
  885. exit 0
  886. fi
  887. CheckForActualLocations
  888. if [ "$DO_LINK_STEP_ONLY" = "yes" ]
  889. then
  890. exit 0
  891. fi
  892. if [ "$CREATE_PACKING_LIST" = "yes" ]
  893. then
  894. CreatePackingList
  895. exit 0
  896. fi
  897. XCOMM
  898. XCOMM we are ready to load the environment ...
  899. XCOMM
  900. if [ "$BUILD_TREE" != "" ]
  901. then
  902. Log "Load the Desktop from $BUILD_TREE"
  903. cd $STARTING_DIR
  904. let j=1
  905. for i in `echo $DATABASE_FILES`
  906. do
  907. LoadFileSet "$j" "$i"
  908. let j=j+1
  909. done
  910. else
  911. Log "Load the Desktop from $TAR_TREE"
  912. compressed=$(awk '/COMPRESSED: /{print $2}' $TAR_TREE/$CDEPACKAGE)
  913. if [ "$compressed" = "yes" ]; then
  914. uncompress <$TAR_TREE/$CDETARFILEZ | tar xvf - $INSTALL_LOCATION
  915. else
  916. tar -xvf $TAR_TREE/$CDETARFILE $INSTALL_LOCATION
  917. fi
  918. DATABASE_FILES=$(awk 'BEGIN {FS=":"} /FILESETS: /{print $2}' $TAR_TREE/$CDEPACKAGE)
  919. fi
  920. Log " "
  921. Log "Desktop installed in $INSTALL_LOCATION"
  922. if [ "$DO_INSTALL_ONLY" = "yes" ]
  923. then
  924. exit 0
  925. fi
  926. if [ $TARBALL = "yes" ];
  927. then
  928. MakeTarball
  929. fi
  930. cd $STARTING_DIR
  931. if [ "$RUN_SCRIPTS" = "yes" ]
  932. then
  933. DoScripts
  934. fi
  935. if [ "$REMOVE_LINKS" = "yes" ]
  936. then
  937. [ -L /usr/dt ] && rm /usr/dt
  938. [ -L /etc/dt ] && rm /etc/dt
  939. [ -L /var/dt ] && rm /var/dt
  940. fi
  941. echo "Done."
  942. echo ""
  943. echo "See $LOGFILE for a log of this install session."
  944. echo ""