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