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