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