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