install.dt.src 26 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157
  1. XCOMM!/bin/ksh
  2. XCOMM $XConsortium: install.dt.src /main/6 1996/04/23 11:19:05 drk $
  3. XCOMM ==========================================================================
  4. XCOMM ==========================================================================
  5. XCOMM install.dt
  6. XCOMM
  7. XCOMM Script to install the April 1994 Snapshot Desktop on
  8. XCOMM HP, IBM, Sun, UXP, USL, or DEC Unix systems from a CDROM
  9. XCOMM
  10. XCOMM ==========================================================================
  11. XCOMM ==========================================================================
  12. XCOMM ==========================================================================
  13. XCOMM ==========================================================================
  14. XCOMM
  15. XCOMM This script does the following:
  16. XCOMM
  17. XCOMM - verifies user is root
  18. XCOMM - displays welcome screen
  19. XCOMM - displays license agreement screen
  20. XCOMM - verifies system configuration
  21. XCOMM - checks for 10/93 snapshot
  22. XCOMM - displays .dt directory warning
  23. XCOMM - gathers alternate installation directories
  24. XCOMM - verifies free space
  25. XCOMM - displays one last chance screen
  26. XCOMM - calls install.cde
  27. XCOMM - displays install complete screen
  28. XCOMM
  29. XCOMM ==========================================================================
  30. XCOMM ==========================================================================
  31. XCOMM ==========================================================================
  32. XCOMM ==========================================================================
  33. XCOMM
  34. XCOMM Override functions
  35. XCOMM
  36. XCOMM These routines might have a platform override
  37. XCOMM
  38. XCOMM DtiClearScreen
  39. XCOMM DtiFreeSpace
  40. XCOMM DtiVerifyConfiguration
  41. XCOMM DtiWhoami
  42. XCOMM
  43. XCOMM ==========================================================================
  44. XCOMM ==========================================================================
  45. #define HASH #
  46. #define STAR *
  47. XCOMM ==========================================================================
  48. XCOMM
  49. XCOMM DtiClearScreen - clears the screen
  50. XCOMM
  51. XCOMM Input - none
  52. XCOMM Output - none
  53. XCOMM Return -none
  54. XCOMM ==========================================================================
  55. DtiClearScreen() {
  56. clear 1>&2
  57. HASH DtiPrint "clear"
  58. }
  59. XCOMM ==========================================================================
  60. XCOMM
  61. XCOMM DtiFreeSpace
  62. XCOMM
  63. XCOMM Input - none
  64. XCOMM Output - none
  65. XCOMM Return -none
  66. XCOMM
  67. XCOMM ==========================================================================
  68. DtiFreeSpace()
  69. {
  70. DtiReturn "100000000"
  71. }
  72. XCOMM ==========================================================================
  73. XCOMM
  74. XCOMM DtiVerifyConfiguration
  75. XCOMM
  76. XCOMM Input - none
  77. XCOMM Output - none
  78. XCOMM Return -none
  79. XCOMM
  80. XCOMM ==========================================================================
  81. DtiVerifyConfiguration()
  82. {
  83. DtiReturn "yes"
  84. }
  85. XCOMM ==========================================================================
  86. XCOMM
  87. XCOMM DtiWhoami
  88. XCOMM
  89. XCOMM Input - none
  90. XCOMM Output - none
  91. XCOMM Return
  92. XCOMM result of system 'whoami' command
  93. XCOMM
  94. XCOMM ==========================================================================
  95. DtiWhoami()
  96. {
  97. whoami
  98. }
  99. XCOMM ==========================================================================
  100. XCOMM ==========================================================================
  101. XCOMM
  102. XCOMM Internal functions
  103. XCOMM
  104. XCOMM These routines do not have a platform override
  105. XCOMM
  106. XCOMM ==========================================================================
  107. XCOMM ==========================================================================
  108. XCOMM ==========================================================================
  109. XCOMM ==========================================================================
  110. XCOMM
  111. XCOMM Utility functions
  112. XCOMM
  113. XCOMM These routines are not expected to have a platform override
  114. XCOMM
  115. XCOMM Exit - log and exit
  116. XCOMM GetPlatform - identify platform
  117. XCOMM Log - echo to log
  118. XCOMM Main - main routine
  119. XCOMM NewState - specify new state
  120. XCOMM DtiPrint - echo to stdout and log
  121. XCOMM DtiReturn - write string to stdout
  122. XCOMM UnknownState - unexpected state
  123. XCOMM
  124. XCOMM ==========================================================================
  125. XCOMM ==========================================================================
  126. XCOMM ==========================================================================
  127. XCOMM
  128. XCOMM Exit - log and exit
  129. XCOMM
  130. XCOMM Input
  131. XCOMM $1 - data to echo to log
  132. XCOMM Output - none
  133. XCOMM Return -none
  134. XCOMM ==========================================================================
  135. Exit()
  136. {
  137. Log "\n\n*"
  138. Log "* $(date) $(DtiWhoami)"
  139. Log "* $1"
  140. Log "*"
  141. exit 0
  142. }
  143. XCOMM ==========================================================================
  144. XCOMM
  145. XCOMM GetPlatform
  146. XCOMM
  147. XCOMM Input - none
  148. XCOMM Output - none
  149. XCOMM Return
  150. XCOMM "hpux"
  151. XCOMM "aix"
  152. XCOMM "sun"
  153. XCOMM "uxp"
  154. XCOMM "usl"
  155. XCOMM "dec"
  156. XCOMM ==========================================================================
  157. GetPlatform()
  158. {
  159. if [ -z "$getPlatform" ]; then
  160. os=`uname -s`
  161. case $os in
  162. *HP-UX*) getPlatform=hp;;
  163. *AIX*) getPlatform=ibm;;
  164. *SunOS*) getPlatform=sun;;
  165. *UNIX_System_V*) getPlatform=uxp;;
  166. *UNIX_SV*) getPlatform=usl;;
  167. *OSF1*) getPlatform=dec;;
  168. esac
  169. fi
  170. DtiReturn $getPlatform
  171. }
  172. XCOMM ==========================================================================
  173. XCOMM
  174. XCOMM GetSpaceNeeded
  175. XCOMM
  176. XCOMM Input - none
  177. XCOMM Output - none
  178. XCOMM Return - bytes needed for /usr/dt directory
  179. XCOMM ==========================================================================
  180. GetSpaceNeeded()
  181. {
  182. DtiReturn "$(awk '/SIZE: / {print $2}' $(pwd)/$DTIPLATFORMDIR/$DTIPACKAGE)"
  183. }
  184. XCOMM ==========================================================================
  185. XCOMM
  186. XCOMM Log - echo to log
  187. XCOMM
  188. XCOMM Input
  189. XCOMM $1 - data to echo to log
  190. XCOMM Output - none
  191. XCOMM Return -none
  192. XCOMM ==========================================================================
  193. Log()
  194. {
  195. printf "$1" $2 $3 $4 $5 $6 $7 $8 $9 >>$dtiLogFile
  196. }
  197. XCOMM ==========================================================================
  198. XCOMM
  199. XCOMM Main
  200. XCOMM
  201. XCOMM Input - none
  202. XCOMM Output - none
  203. XCOMM Return - none
  204. XCOMM
  205. XCOMM
  206. XCOMM
  207. XCOMM State transitions
  208. XCOMM
  209. XCOMM 0) entry point
  210. XCOMM -> 1
  211. XCOMM
  212. XCOMM 1) verify user is root
  213. XCOMM user is root -> 3
  214. XCOMM user is not root -> 2.1
  215. XCOMM
  216. XCOMM 2.*) display message and exit
  217. XCOMM -> 99.1
  218. XCOMM 2.1) user must be root
  219. XCOMM 2.2) unsupported platform
  220. XCOMM 2.4) could not find desktop install image
  221. XCOMM 2.5) desktop install complete without error
  222. XCOMM 2.6) desktop install complete with error
  223. XCOMM
  224. XCOMM 3) verify platform is supported
  225. XCOMM supported platform -> 4.1
  226. XCOMM unsupported platform -> 2.2
  227. XCOMM
  228. XCOMM 4.*) display a message
  229. XCOMM 4.1) display welcome message
  230. XCOMM user selects continue "0" -> 4.2
  231. XCOMM user selects exit "99" -> 99.1
  232. XCOMM
  233. XCOMM 4.2) display disclaimer
  234. XCOMM user selects continue "0" -> 5
  235. XCOMM user selects exit "99" -> 99.1
  236. XCOMM
  237. XCOMM 4.3) display destinations
  238. XCOMM user selects change installation root "1" -> 8
  239. XCOMM user selects continue "0" -> 12
  240. XCOMM user selects exit "99" -> 99.1
  241. XCOMM
  242. XCOMM 4.4) display free space warning
  243. XCOMM user selects continue "0" -> 12
  244. XCOMM user selects exit "99" -> 99.1
  245. XCOMM
  246. XCOMM 4.5) display system configuration warning
  247. XCOMM user selects continue "0" -> 6
  248. XCOMM user selects exit "99" -> 99.1
  249. XCOMM
  250. XCOMM 4.6) display 10/93 bits exist message
  251. XCOMM user selects erase "1" -> 13
  252. XCOMM user selects continue "0" -> 4.3
  253. XCOMM user selects exit "99" -> 99.1
  254. XCOMM
  255. XCOMM 5) verify configuration
  256. XCOMM configuration ok -> 6
  257. XCOMM configuration not ok -> 4.5
  258. XCOMM
  259. XCOMM 6) verify CDROM
  260. XCOMM platform dir found -> 4.3
  261. XCOMM platform dir not found -> 2.4
  262. XCOMM
  263. XCOMM 7) check for 10/93 bits
  264. XCOMM 10/93 bits exist -> 4.6
  265. XCOMM 10/93 bits don't exist -> 4.3
  266. XCOMM
  267. XCOMM 8.*) obtain altername directory names
  268. XCOMM 8.usr) obtain alternate /usr/dt directory name
  269. XCOMM user enters "" or "/" -> 4.3 (revert to default)
  270. XCOMM user enters "/*" -> 10.usr
  271. XCOMM user enters anything else -> 8.usr
  272. XCOMM 8.etc) obtain alternate /etc/dt directory name
  273. XCOMM user enters "" or "/" -> 4.3 (revert to default)
  274. XCOMM user enters "/*" -> 10.etc
  275. XCOMM user enters anything else -> 8.etc
  276. XCOMM 8.var) obtain alternate /var/dt directory name
  277. XCOMM user enters "" or "/" -> 4.3 (revert to default)
  278. XCOMM user enters "/*" -> 10.var
  279. XCOMM user enters anything else -> 8.var
  280. XCOMM
  281. XCOMM 11) check available space
  282. XCOMM space available -> 12
  283. XCOMM space not available -> 4.4
  284. XCOMM
  285. XCOMM 12) run install script
  286. XCOMM desktop install ok -> 2.5
  287. XCOMM desktop install not ok -> 2.6
  288. XCOMM
  289. XCOMM 13) erase 10/93 bits
  290. XCOMM -> 4.3
  291. XCOMM
  292. XCOMM 99.1) exit
  293. XCOMM
  294. XCOMM ==========================================================================
  295. Main()
  296. {
  297. date >$dtiLogFile
  298. laststate=0
  299. state=0
  300. while :
  301. do
  302. case $state in
  303. 0)
  304. HASH
  305. HASH 0) entry point
  306. HASH
  307. NewState 1
  308. ;;
  309. 1)
  310. HASH
  311. HASH 1) verify user is 'root'
  312. HASH
  313. if [ $(DtiWhoami) = "root" ]; then
  314. NewState 3
  315. else
  316. HASH NewState 3 # for debugging
  317. NewState 2.1
  318. fi
  319. ;;
  320. 2.*)
  321. HASH
  322. HASH 2.*) display a message and exit
  323. HASH
  324. DtiClearScreen
  325. DtiPrint "$msg_2"
  326. case ${state##*.} in
  327. 1)
  328. HASH
  329. HASH 2.1) user must be root
  330. HASH
  331. DtiPrint "$msg_2_1"
  332. ;;
  333. 2)
  334. HASH
  335. HASH 2.2) unsupported platform
  336. HASH
  337. DtiPrint "$msg_2_2" $dtiPlatform
  338. ;;
  339. 4)
  340. HASH
  341. HASH 2.4) no desktop install image
  342. HASH
  343. DtiPrint "$msg_2_4" $dtiPlatform
  344. ;;
  345. 5)
  346. HASH
  347. HASH 2.5) desktop install complete without error
  348. HASH
  349. DtiPrint "$msg_2_5"
  350. ;;
  351. 6)
  352. HASH
  353. HASH 2.6) desktop install complete with error
  354. HASH
  355. DtiPrint "$msg_2_6"
  356. ;;
  357. 7)
  358. HASH
  359. HASH 2.7) not enough space
  360. HASH
  361. DtiPrint "$msg_2_7" $dtiRoot/$dtiUsrDt \
  362. $dtiSpaceAvail \
  363. $dtiSpaceNeeded
  364. ;;
  365. *)
  366. HASH
  367. HASH 2.*) unexpected state
  368. HASH
  369. UnknownState
  370. ;;
  371. esac
  372. NewState 99.1
  373. ;;
  374. 3)
  375. HASH
  376. HASH 3) verify platform is supported
  377. HASH
  378. case "$dtiPlatform" in
  379. hp|ibm|sun|uxp|usl|dec)
  380. NewState 4.1
  381. ;;
  382. *)
  383. NewState 2.2
  384. ;;
  385. esac
  386. ;;
  387. 4.*)
  388. HASH
  389. HASH 4.*) display a message and allow user to continue
  390. HASH
  391. DtiClearScreen
  392. DtiPrint "$msg_4"
  393. case ${state##*.} in
  394. 1)
  395. HASH
  396. HASH 4.1) display welcome message
  397. HASH
  398. let meg=$(GetSpaceNeeded)/$dtiMeg+1
  399. DtiPrint "$msg_4_1" " $meg"
  400. read response
  401. case $response in
  402. 0) NewState 4.2;;
  403. 99) NewState 99.1;;
  404. *) NewState $laststate;;
  405. esac
  406. ;;
  407. 2)
  408. HASH
  409. HASH 4.2) display disclaimer
  410. HASH
  411. DtiPrint "$msg_4_2"
  412. read response
  413. case $response in
  414. 0) NewState 5;;
  415. 99) NewState 99.1;;
  416. *) NewState $laststate;;
  417. esac
  418. ;;
  419. 3)
  420. HASH
  421. HASH 4.3) display destinations
  422. HASH
  423. DtiPrint "$msg_4_3" ${dtiRoot:-$dtiDefaultRoot} \
  424. $dtiRoot/$dtiUsrDt \
  425. $dtiRoot/$dtiEtcDt \
  426. $dtiRoot/$dtiVarDt
  427. read response
  428. case $response in
  429. 0) NewState 11;;
  430. 1) NewState 8;;
  431. 99) NewState 99.1;;
  432. *) NewState $state;;
  433. esac
  434. ;;
  435. 4)
  436. HASH
  437. HASH 4.4) not enough space warning
  438. HASH
  439. DtiPrint "$msg_4_4" $dtiRoot/$dtiUsrDt \
  440. $dtiSpaceAvail \
  441. $dtiSpaceNeeded
  442. read response
  443. case $response in
  444. 0) NewState 4.7;;
  445. 99) NewState 99.1;;
  446. *) NewState $laststate;;
  447. esac
  448. ;;
  449. 5)
  450. HASH
  451. HASH 4.5) unsupported system configuration warning
  452. HASH
  453. DtiPrint "$msg_4_5"
  454. read response
  455. case $response in
  456. 0) NewState 6;;
  457. 99) NewState 99.1;;
  458. *) NewState $laststate;;
  459. esac
  460. ;;
  461. 6)
  462. HASH
  463. HASH 4.6) 10/93 bits exist
  464. HASH
  465. DtiPrint "$msg_4_6"
  466. if [ "$dti9310dirs" != "" ]; then
  467. DtiPrint "$msg_4_6a"
  468. for i in $dti9310dirs
  469. do
  470. DtiPrint " $i\n"
  471. done
  472. fi
  473. if [ "$dti9310links" != "" ]; then
  474. DtiPrint "$msg_4_6b"
  475. for i in $dti9310links
  476. do
  477. DtiPrint " $i\n"
  478. done
  479. fi
  480. DtiPrint "$msg_4_6c"
  481. read response
  482. case $response in
  483. 1) NewState 13;;
  484. 0) NewState 4.8;;
  485. 99) NewState 99.1;;
  486. *) NewState $laststate;;
  487. esac
  488. ;;
  489. 7)
  490. HASH
  491. HASH 4.7) display one last chance warning
  492. HASH
  493. DtiPrint "$msg_4_7"
  494. dti9404dirs=""
  495. dti9404links=""
  496. for i in $dtiUsrDt $dtiEtcDt $dtiVarDt
  497. do
  498. if [ -L /$i ]; then
  499. dti9404links="$dti9404links /$i"
  500. elif [ -d /$i ]; then
  501. dti9404dirs="$dti9404dirs /$i"
  502. fi
  503. done
  504. if [ "$dti9404dirs" != "" ]; then
  505. DtiPrint "$msg_4_7a"
  506. for i in $dti9404dirs
  507. do
  508. DtiPrint " $i\n"
  509. done
  510. fi
  511. if [ "$dti9404links" != "" ]; then
  512. DtiPrint "$msg_4_7b"
  513. for i in $dti9404links
  514. do
  515. DtiPrint " $i\n"
  516. done
  517. fi
  518. DtiPrint "$msg_4_7c"
  519. read response
  520. case $response in
  521. 0) NewState 12;;
  522. 99) NewState 99.1;;
  523. *) NewState $laststate;;
  524. esac
  525. ;;
  526. 8)
  527. HASH
  528. HASH 4.8) display .dt directory warning
  529. HASH
  530. DtiPrint "$msg_4_8" $DTIREADME
  531. read response
  532. case $response in
  533. 0) NewState 4.3;;
  534. 99) NewState 99.1;;
  535. *) NewState $laststate;;
  536. esac
  537. ;;
  538. *)
  539. HASH
  540. HASH 4.*) unexpected state
  541. HASH
  542. UnknownState
  543. ;;
  544. esac
  545. ;;
  546. 5)
  547. HASH
  548. HASH 5) verify configuration
  549. HASH
  550. verifyConfig="$(DtiVerifyConfiguration)"
  551. if [ "$verifyConfig" = "yes" ]; then
  552. NewState 6
  553. else
  554. if [ "$verifyConfig" != "no" ]; then
  555. msg_4_5="$verifyConfig"
  556. fi
  557. NewState 4.5
  558. fi
  559. ;;
  560. 6)
  561. HASH
  562. HASH 6) verify CDROM
  563. HASH
  564. if [ -d "$(pwd)/$DTIPLATFORMDIR" ]; then
  565. NewState 7
  566. else
  567. NewState 2.4
  568. fi
  569. ;;
  570. 7)
  571. HASH
  572. HASH 7) check for 10/93 bits
  573. HASH
  574. dti9310dirs=""
  575. dti9310links=""
  576. for i in /opt/dt /etc/opt/dt /var/opt/dt
  577. do
  578. if [ -d "$i" -a -L "$i" ]; then
  579. dti9310dirs="$dti9310dirs $(ResolvePathName $i)"
  580. dti9310links="$dti9310links $i"
  581. elif [ -d "$i" ]; then
  582. dti9310dirs="$dti9310dirs $i"
  583. fi
  584. done
  585. if [ -z "$dti9310dirs" -a -z "$dti9310links" ]; then
  586. NewState 4.3
  587. else
  588. NewState 4.6
  589. fi
  590. ;;
  591. 8)
  592. HASH
  593. HASH 8) obtain alternate installation root
  594. HASH
  595. DtiClearScreen
  596. DtiPrint "$msg_2"
  597. let meg=$(GetSpaceNeeded)/$dtiMeg+1
  598. DtiPrint "$msg_8" ${dtiRoot:-$dtiDefaultRoot} \
  599. $dtiRoot/$dtiUsrDt \
  600. $dtiRoot/$dtiEtcDt \
  601. $dtiRoot/$dtiVarDt \
  602. " $meg"
  603. if [ "$msg_8_error" != "" ]; then
  604. DtiPrint " ${msg_8_error}\n\n"
  605. msg_8_error=""
  606. fi
  607. DtiPrint "$msg_8b"
  608. read response
  609. case $response in
  610. "")
  611. HASH blank, no change
  612. NewState 4.3
  613. ;;
  614. "/")
  615. HASH root, revert to default
  616. dtiRoot=""
  617. NewState 4.3
  618. ;;
  619. /usr/dt|/usr/dt/STAR|/etc/dt|/etc/dt/STAR|/var/dt|/var/dt/STAR)
  620. HASH can't use these
  621. msg_8_error="Please specify something other than '$response'."
  622. NewState $state;;
  623. /STAR)
  624. HASH absolute path is ok, continue verification
  625. dtiProposedRoot=$response
  626. if [ -d $dtiProposedRoot ]; then
  627. dtiRoot=$dtiProposedRoot
  628. NewState 4.3
  629. else
  630. msg_8_error="Directory '$response' does not exist."
  631. NewState $state
  632. fi
  633. ;;
  634. *)
  635. HASH anything else is not
  636. msg_8_error="The directory you specify must start with a '/'."
  637. NewState $state;;
  638. esac
  639. ;;
  640. 11)
  641. HASH
  642. HASH check available space
  643. HASH
  644. dir=$dtiRoot/$dtiUsrDt
  645. while [[ ! -z "$dir" && ! -d $dir ]]
  646. do
  647. dir=${dir%/STAR}
  648. done
  649. [ -z "$dir" ] && dir="/"
  650. dtiSpaceAvail=$(DtiFreeSpace $dir)
  651. dtiSpaceNeeded=$(GetSpaceNeeded)
  652. if [[ "$dtiSpaceAvail" -lt "$dtiSpaceNeeded" ]]; then
  653. NewState 4.4
  654. else
  655. NewState 4.7
  656. fi
  657. ;;
  658. 12)
  659. HASH
  660. HASH start install script
  661. HASH
  662. DtiClearScreen
  663. DtiPrint "$msg_2"
  664. DtiPrint "Installing the Desktop..."
  665. options="-clean -z $(pwd)/$DTIPLATFORMDIR"
  666. if [ "$dtiRoot" != "" ]; then
  667. options="$options -pI $dtiRoot/$dtiUsrDt"
  668. options="$options -pC $dtiRoot/$dtiEtcDt"
  669. options="$options -pV $dtiRoot/$dtiVarDt"
  670. fi
  671. $DTIPLATFORMDIR/$DTIINSTALLCDE $options
  672. if [ "$?" = "0" ]; then
  673. NewState 2.5
  674. else
  675. NewState 2.6
  676. fi
  677. ;;
  678. 13)
  679. HASH
  680. HASH 13) erase 10/93 bits
  681. HASH
  682. DtiClearScreen
  683. DtiPrint "$msg_2"
  684. DtiPrint "Erasing the October 1993 Snapshot ..."
  685. if [ "$dti9310dirs" != "" ]; then
  686. for i in $dti9310dirs
  687. do
  688. DtiPrint "\nErasing $i ..."
  689. rm -rf $i 2>&1 >>$dtiLogFile
  690. done
  691. fi
  692. if [ "$dti9310links" != "" ]; then
  693. for i in $dti9310links
  694. do
  695. DtiPrint "\nErasing $i ..."
  696. rm $i 2>&1 >>$dtiLogFile
  697. done
  698. fi
  699. NewState 4.8
  700. ;;
  701. 99.*)
  702. HASH
  703. HASH 99.*) exit
  704. HASH
  705. Exit "exit"
  706. ;;
  707. *)
  708. HASH
  709. HASH *) unexpected state
  710. HASH
  711. UnknownState
  712. esac
  713. done
  714. }
  715. XCOMM ==========================================================================
  716. XCOMM
  717. XCOMM Message text
  718. XCOMM
  719. XCOMM ==========================================================================
  720. msg_2="\
  721. The Common Open Systems Environment Desktop\n\
  722. April 1994 Snapshot CDROM Installation\n\n"
  723. msg_2_1="\
  724. You must be logged in as 'root' to install the Desktop\n"
  725. msg_2_2="\
  726. This CD does not contain a Desktop install image for %s.\n"
  727. msg_2_4="\
  728. This CD does not contain a Desktop install image for %s.\n"
  729. msg_2_5="\
  730. The Desktop installation is complete.\n\
  731. Please refer to your Getting Started guide for information
  732. about how to start the Desktop.\n\n"
  733. msg_2_6="\
  734. The Desktop installation completed with errors.\n\
  735. Please browse the /tmp/installCDE.log file for information
  736. regarding the problem.\n\n"
  737. msg_4="\
  738. The Common Open Systems Environment Desktop\n\
  739. April 1994 Snapshot CDROM Installation\n\n"
  740. msg_4_1="\
  741. This script will guide you through the installation of
  742. the Desktop onto your system.\n\
  743. You will need approximately %sMB of available space in
  744. which to install the Desktop.
  745. \n\n\
  746. 0) Continue with Desktop Installation\n\
  747. 99) Exit Desktop Installation\n
  748. \
  749. Please enter selection: "
  750. msg_4_2="\
  751. Important: You must sign and return the enclosed Software License
  752. Agreement before you can use this Software!
  753. WARNING: Use of CD-ROM Code is Time Limited: This software is
  754. not intended for use beyond the time limitations detailed in
  755. the Software License Agreement.
  756. 0) Continue with Desktop Installation
  757. 99) Exit Desktop Installation
  758. Please enter selection: "
  759. msg_4_3="\
  760. The current installation 'root' for the desktop is '%s',
  761. which means the desktop will be installed in the following directories:
  762. %s
  763. %s
  764. %s
  765. You may specify an alternate installation root by selecting (1) below.
  766. \n\
  767. 1) Select alternate installation root\n\
  768. \n\
  769. 0) Continue with Desktop Installation\n\
  770. 99) Exit Desktop Installation\n\
  771. \n\
  772. Please enter selection: "
  773. msg_4_4="\
  774. WARNING! There is not enough free space available in which to
  775. install the Desktop.
  776. Directory: %s
  777. Space available: %s
  778. Space needed: %s
  779. It is recommended that you Exit Desktop Installation (99) to
  780. correct the problem.
  781. 0) Continue with Desktop Installation\n\
  782. 99) Exit Desktop Installation\n
  783. \
  784. Please enter selection: "
  785. msg_4_5="\
  786. WARNING! The Desktop does not support this system configuration.
  787. It is recommended that you install the desktop on a supported
  788. system configuration.
  789. 0) Continue with Desktop Installation
  790. 99) Exit Desktop Installation
  791. Please enter selection: "
  792. msg_4_6="\
  793. The October 1993 Snapshot installation has been detected on this
  794. system. You may select (1) to erase the October 1993 Snapshot from
  795. your system. Selecting (1) will:\n"
  796. msg_4_6a="\
  797. \nErase the following directories and their contents:\n\n"
  798. msg_4_6b="\
  799. \nRemove the following symbolic links:\n\n"
  800. msg_4_6c="\
  801. \n\
  802. 1) Erase the October 1993 Snapshot from your system\n\
  803. \n\
  804. 0) Continue with Desktop Installation\n\
  805. 99) Exit Desktop Installation\n\
  806. \n\
  807. Please enter selection: "
  808. msg_4_7="\
  809. The April 1994 Snapshot will now be installed on your system.\n"
  810. msg_4_7a="\
  811. The contents of the following existing directories will be completely replaced:
  812. \n"
  813. msg_4_7b="\
  814. \nThe following existing symbolic links will be replaced:\n\n"
  815. msg_4_7c="\
  816. \n\
  817. 0) Continue with Desktop Installation\n\
  818. 99) Exit Desktop Installation\n\
  819. \n\
  820. Please enter selection: "
  821. msg_4_8="\
  822. WARNING! Advise all CDE users on the system to remove or rename their
  823. \$HOME/.dt directory and their \$HOME/.dtprofile. The April 1994 Desktop
  824. is not compatible with the October 1993 Desktop versions of these files.
  825. If users have customized the \$HOME/.dt/dtwmrc file and want to keep
  826. it, they will need to cut and paste the appropriate pieces into the new
  827. dtwmrc provided.
  828. Please see the '%s' file on this CDROM for more information.
  829. 0) Continue with Desktop Installation
  830. 99) Exit Desktop Installation
  831. Please enter selection: "
  832. msg_8="\
  833. The current installation 'root' for the desktop is '%s',
  834. which means the desktop will be installed in the following directories:
  835. %s
  836. %s
  837. %s
  838. To specify a different directory, enter a full directory pathname
  839. below. Simply press enter to keep the current installation root.
  840. The directory you specify must:
  841. * Be an absolute path (i.e. start with a '/')
  842. * Be an existing directory
  843. * Have approximately %sMB of free space\n\n"
  844. msg_8b="\
  845. Please enter directory name or leave blank to keep the current name
  846. > "
  847. XCOMM ==========================================================================
  848. XCOMM
  849. XCOMM NewState
  850. XCOMM
  851. XCOMM Input
  852. XCOMM $1 - new state
  853. XCOMM $state - current state
  854. XCOMM Output - none
  855. XCOMM $laststate - saved current state
  856. XCOMM $state - new state
  857. XCOMM Return - none
  858. XCOMM
  859. XCOMM ==========================================================================
  860. NewState()
  861. {
  862. laststate=$state;
  863. state=$1
  864. }
  865. XCOMM ==========================================================================
  866. XCOMM
  867. XCOMM DtiPrint - echo to stderr and log
  868. XCOMM
  869. XCOMM Input
  870. XCOMM $1 - data to echo to stdout and log
  871. XCOMM Output - none
  872. XCOMM Return -none
  873. XCOMM ==========================================================================
  874. DtiPrint()
  875. {
  876. printf "$1" $2 $3 $4 $5 $6 $7 $8 $9 >&2
  877. Log "$1" $2 $3 $4 $5 $6 $7 $8 $9
  878. }
  879. XCOMM =========================================================================
  880. XCOMM
  881. XCOMM ResolvePathName
  882. XCOMM
  883. XCOMM Input - none
  884. XCOMM Output - none
  885. XCOMM Return
  886. XCOMM
  887. XCOMM =========================================================================
  888. ResolvePathName() {
  889. if [ "/" = "$1" ]; then
  890. echo $1$2
  891. elif [ -L $1 ]; then
  892. ResolvePathName `/bin/ls -l $1 | awk '{print $NF}'` $2
  893. else ResolvePathName `dirname $1` `basename $1`${2+/}$2
  894. fi
  895. }
  896. XCOMM ==========================================================================
  897. XCOMM
  898. XCOMM DtiReturn - return a string to stdout
  899. XCOMM
  900. XCOMM Input
  901. XCOMM $1 - data to return
  902. XCOMM Output - none
  903. XCOMM Return -none
  904. XCOMM ==========================================================================
  905. DtiReturn()
  906. {
  907. echo "$1"
  908. }
  909. XCOMM ==========================================================================
  910. XCOMM
  911. XCOMM UnknownState
  912. XCOMM
  913. XCOMM Input
  914. XCOMM $laststate - previous state
  915. XCOMM $state - current state
  916. XCOMM Output - none
  917. XCOMM Return - none
  918. XCOMM
  919. XCOMM ==========================================================================
  920. UnknownState()
  921. {
  922. DtiPrint "Fatal error: unexpected state transition $laststate --> $state\n"
  923. Exit "Fatal error: unexpected state transition $laststate --> $state\n"
  924. }
  925. XCOMM ==========================================================================
  926. XCOMM
  927. XCOMM entry point
  928. XCOMM
  929. XCOMM Input - none
  930. XCOMM Output - none
  931. XCOMM Return -none
  932. XCOMM ==========================================================================
  933. umask 0
  934. DTIINSTALLDT=install.dt
  935. DTIINSTALLCDE=install.cde
  936. DTIPACKAGE=dt.pkg
  937. DTIINSTALLDTO=install.dto
  938. DTICONFIGDIR=config
  939. dtiUsrDt="usr/dt"
  940. dtiEtcDt="etc/dt"
  941. dtiVarDt="var/dt"
  942. dtiDefaultRoot="/"
  943. dtiRoot=""
  944. dtiPlatform=$(GetPlatform)
  945. DTIPLATFORMDIR=$dtiPlatform
  946. DTIREADME=config/config.$dtiPlatform
  947. dtiSpaceAvail="0"
  948. dtiSpaceNeeded="0"
  949. dtiLogFile="/tmp/install.dt.log"
  950. dtiMeg=1048576
  951. XCOMM
  952. XCOMM change directories to install.dt location as all
  953. XCOMM installation packages are relative to this
  954. XCOMM
  955. if [ ${0##STAR/} != $DTIINSTALLDT ]; then
  956. HASH
  957. HASH CDROM driver folds filenames to uppercase
  958. HASH
  959. typeset -u DTIINSTALLDT
  960. typeset -u DTIINSTALLCDE
  961. typeset -u DTIPACKAGE
  962. typeset -u DTIINSTALLDTO
  963. typeset -u DTICONFIGDIR
  964. typeset -u DTIPLATFORMDIR
  965. typeset -u DTIREADME
  966. fi
  967. if [ ${0%/STAR} != $DTIINSTALLDT ]; then
  968. cd ${0%/STAR}
  969. fi
  970. XCOMM
  971. XCOMM source in possible platform overrides for certain functions
  972. XCOMM
  973. XCOMM DtiClearScreen
  974. XCOMM DtiFreeSpace
  975. XCOMM DtiVerifyConfiguration
  976. XCOMM DtiWhoami
  977. XCOMM
  978. if [ -d "$(pwd)/$DTIPLATFORMDIR" ]; then
  979. if [ -f $(pwd)/$DTIPLATFORMDIR/$DTIINSTALLDTO ]; then
  980. . $(pwd)/$DTIPLATFORMDIR/$DTIINSTALLDTO
  981. fi
  982. fi
  983. XCOMM
  984. XCOMM ready to go
  985. XCOMM
  986. Main