2 XCOMM $XConsortium: installCDE.src /main/20 1996/11/25 14:21:13 drk $
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.
9 XCOMM this script accepts the following parameters:
10 XCOMM -s <source> -- The top of build tree where the files are
12 XCOMM -z <package> -- The desktop install package
14 XCOMM Optional parameters:
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.
25 XCOMM -clean -- remove the temporary, configuration and installation
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)
36 XCOMM -Lang -- load the localized filesets
37 XCOMM -LinkStepOnly -- set up the -pI, -pC, and -pV links
39 XCOMM -DontRunScripts -- stop after installation
40 XCOMM -RunScriptsOnly -- only execute the scripts
41 XCOMM -configureOnly -- only configure the desktop
43 XCOMM ##########################################################################
48 LOGFILE="installCDE.$$.log"
50 REVISION="$(echo "$Revision: /main/20 $" | awk '{print $2}')"
54 echo "$1" | tee -a $LOGFILE
59 Log "\nGenerating UNIX Desktop install package $DATE in $TARBALL_LOCATION"
61 HASH create installable tarball
63 Log "Creating tarball..."
65 if [ $PLATFORM = "usl" -o "$PLATFORM" = "uxp" ]
71 mkdir -p $TARBALL_LOCATION/$DIRNAME
73 echo $DATE >$LOGFILES_LOCATION/.build.$DATE
74 chown bin $LOGFILES_LOCATION/.build.$DATE
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
81 tar -cf $TARBALL_LOCATION/$DIRNAME/dt.tar \
82 $INSTALL_LOCATION/STAR \
83 2>$TARBALL_LOCATION/$DIRNAME/extract.err 2>&1
86 if [ "$ACTUAL_INSTALLATION_LOC" = "" ]; then
87 actualInstallDir=$INSTALL_LOCATION
89 actualInstallDir=$ACTUAL_INSTALLATION_LOC
91 let size=$(du -s $actualInstallDir | awk '{print $1}')*512
93 HASH load installation fileset *after* tarball generated
94 LoadFileSet "" "CDE-INSTALL"
96 HASH create config dir
97 destPost=$TARBALL_LOCATION/$DIRNAME/config
100 HASH copy config and platform config scripts
101 src=$INSTALL_LOCATION/install/$PLATFORM_SCRIPT_DIR
102 cp $src/config/STAR.cfg $destPost
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
113 cat >$TARBALL_LOCATION/$DIRNAME/dt.pkg <<FIN
117 COMPRESSED: $COMPRESS_TARBALL
119 CL: $ORIGINAL_COMMAND_LINE
120 FILESETS: $DATABASE_FILES
123 cat >$TARBALL_LOCATION/$DIRNAME/build.status <<FIN
127 OVERALL STATUS: <not yet tested>
128 OVERALL PERFORMANCE: <not yet tested>
129 MAJOR PROBLEMS: <not yet tested>
133 chmod g+w $TARBALL_LOCATION/$DIRNAME/build.status
141 if [ "$BUILD_TREE" = "" ]; then
142 ScriptName=$3 # use short config file name (foo.cfg)
144 ScriptName=$2 # use long config file name (configFoo)
147 if [ $CDECONFIGDIR = "CONFIG" ]; then
148 typeset -u ScriptName
151 test_string=${DATABASE_FILES#*$FilesetName}
152 if (( ${#DATABASE_FILES} > ${#test_string} ))
154 if [ -x $POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName ]
156 Log "Executing $PLATFORM specific $FilesetName customize script"
157 $POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName -e 2>&1 | \
159 elif [ -x $POST_INSTALL_DIR/$ScriptName ]
161 Log "Executing $FilesetName customize script"
162 $POST_INSTALL_DIR/$ScriptName -e 2>&1 | tee -a $LOGFILE
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
180 Log "Creating packing list."
181 touch $INSTALL_LOCATION/Packing_list
182 for i in `echo $DATABASE_FILES`
185 $TOOL_DIR/udbToAny.ksh -toDB -ReleaseStream $PLATFORM $DATABASE_DIR/${i}.udb > /tmp/${i}.db
186 if [ -r /tmp/${i}.db ]
188 for file in `fgrep install_target /tmp/${i}.db | cut -sf 2 -d \: `
190 echo "$file" >>$INSTALL_LOCATION/Packing_list
198 HASH kill these processes so that they can be removed and new ones
201 for i in inetd rpc.ttdbserver rpc.cmsd
203 if [ "$PLATFORM" = "aix" -a $i = "inetd" ]
205 lssrc -s inetd >/dev/null 2>&1
208 stopsrc -s inetd >>$LOGFILE 2>&1
211 ps -ef | grep $i | grep -v grep >/tmp/tmppsout
212 if [ -s /tmp/tmppsout ]
214 awk '{print "kill " $2}' /tmp/tmppsout | /bin/csh -f
224 HASH now restart inetd
228 if [ "$PLATFORM" = "sun" -o "$PLATFORM" = "usl" -o "$PLATFORM" = "uxp" ]
231 elif [ "$PLATFORM" = "aix" ]
233 startsrc -s inetd >>$LOGFILE 2>&1
234 elif [ "$PLATFORM" = "dec" ]
247 CheckForActualLocations()
250 XCOMM if different actual locations specified, set up the links
254 if [ "$CLEAN_DAEMONS" = "yes" ]
259 HASH remove the contents of the installation directory then the directory
262 if [ "$CLEANING" = "yes" ]
264 Log "Removing $INSTALL_LOCATION contents... "
265 if [ -d $INSTALL_LOCATION ]
267 rm -rf $INSTALL_LOCATION/STAR
268 if [ "$LeaveLinks" = "yes" ]
270 if [ ! -L $INSTALL_LOCATION ]
272 rm -rf $INSTALL_LOCATION
275 if [ -L $INSTALL_LOCATION ]
277 rm -f $INSTALL_LOCATION
279 rm -rf $INSTALL_LOCATION
285 if [ "$CONFIGURE_ONLY" = "no" ]
287 if [ "$ACTUAL_INSTALLATION_LOC" != "" ]
291 HASH first create the actual directory - if not there
294 if [ ! -d $ACTUAL_INSTALLATION_LOC ]
296 mkdir -p $ACTUAL_INSTALLATION_LOC
297 if [ ! -d $ACTUAL_INSTALLATION_LOC ]
299 Log "cannot create $ACTUAL_INSTALLATION_LOC directory"
304 ln -s $ACTUAL_INSTALLATION_LOC $INSTALL_LOCATION
307 if [ ! -d $INSTALL_LOCATION -a ! -L $INSTALL_LOCATION ];
309 mkdir -p $INSTALL_LOCATION
314 if [ "$CLEAN_DAEMONS" = "yes" ]
319 HASH remove the contents of the configuration directory
321 if [ "$CLEANING_ETC" = "yes" ]
323 Log "Removing $CONFIGURE_LOCATION contents... "
324 if [ -d $CONFIGURE_LOCATION ]
326 rm -rf $CONFIGURE_LOCATION/STAR
327 if [ "$LeaveLinks" = "yes" ]
329 if [ ! -L $CONFIGURE_LOCATION ]
331 rm -rf $CONFIGURE_LOCATION
334 if [ -L $CONFIGURE_LOCATION ]
336 rm -f $CONFIGURE_LOCATION
338 rm -rf $CONFIGURE_LOCATION
344 if [ "$ACTUAL_CONFIGURATION_LOC" != "" ]
346 if [ ! -d $ACTUAL_CONFIGURATION_LOC ]
348 mkdir -p $ACTUAL_CONFIGURATION_LOC
349 if [ ! -d $ACTUAL_CONFIGURATION_LOC ]
351 Log "cannot create $ACTUAL_CONFIGURATION_LOC directory"
356 ln -s $ACTUAL_CONFIGURATION_LOC $CONFIGURE_LOCATION
359 if [ ! -d $CONFIGURE_LOCATION -a ! -L $CONFIGURE_LOCATION ];
361 mkdir -p $CONFIGURE_LOCATION
365 if [ "$CLEANING" = "yes" ]
367 Log "Removing $LOGFILES_LOCATION contents... "
368 if [ -d $LOGFILES_LOCATION ]
370 rm -rf $LOGFILES_LOCATION/STAR
371 if [ "$LeaveLinks" = "yes" ]
373 if [ ! -L $LOGFILES_LOCATION ]
375 rm -rf $LOGFILES_LOCATION
378 if [ -L $LOGFILES_LOCATION ]
380 rm -f $LOGFILES_LOCATION
382 rm -rf $LOGFILES_LOCATION
388 if [ "$ACTUAL_VAR_LOC" != "" ]
390 if [ ! -d $ACTUAL_VAR_LOC ]
392 mkdir -p $ACTUAL_VAR_LOC
393 if [ ! -d $ACTUAL_VAR_LOC ]
395 Log "cannot create $ACTUAL_VAR_LOC directory"
400 ln -s $ACTUAL_VAR_LOC $LOGFILES_LOCATION
403 if [ ! -d $LOGFILES_LOCATION -a ! -L $LOGFILES_LOCATION ];
405 mkdir -p $LOGFILES_LOCATION
414 echo -e "Usage: $(basename $0) {-s <source>|-z <package>} [options]"
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"
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."
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."
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"
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"
457 echo -e "\tExamples:"
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"
467 XCOMM LoadFileSet() - load a UDB file
468 XCOMM $1 - fileset number
469 XCOMM $2 - fileset name
473 if [ "$1" = "" ]; then
479 XCOMM don't bother if the fileset doesn't exist
480 if [ ! -e $DATABASE_DIR/${2}.udb ]
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
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 ]
500 Log " - missing files:"
501 cat /tmp/${2}.missing | tee -a $LOGFILE
505 ORIGINAL_COMMAND_LINE="$*"
507 XCOMM Set which system we are on
511 PLATFORM_SCRIPT_DIR=""
516 if [ $BUILDSYSTEM = "AIX" ];
519 PLATFORM_SCRIPT_DIR=ibm
520 elif [ $BUILDSYSTEM = "SunOS" ];
523 PLATFORM_SCRIPT_DIR=sun
524 elif [ $BUILDSYSTEM = "UNIX_SV" ];
527 PLATFORM_SCRIPT_DIR=usl
528 elif [ $BUILDSYSTEM = "UNIX_System_V" ];
531 PLATFORM_SCRIPT_DIR=uxp
532 elif [ $BUILDSYSTEM = "OSF1" ];
535 PLATFORM_SCRIPT_DIR=dec
536 elif [ $BUILDSYSTEM = "Linux" ];
539 PLATFORM_SCRIPT_DIR=""
540 else # Build system = HP
542 PLATFORM_SCRIPT_DIR=hp
545 if [ "$PLATFORM" = "aix" ];
548 elif [ "$PLATFORM" = "sun" -o "$PLATFORM" = "usl" -o "$PLATFORM" = "uxp" ];
550 USER=`/usr/ucb/whoami`
552 USER=`/usr/bin/whoami`
555 if [ "$USER" != "root" ];
558 echo "You should be root to run this script. Continuing anyway."
562 if [ "$PLATFORM" = "usl" -o "$PLATFORM" = "uxp" ]
569 PATH=/bin:/usr/bin:/etc:/usr/bin/X11:
575 COMPRESS_TARBALL="yes"
576 USE_ALTERNATE_UDB_DIR="no"
581 ACTUAL_INSTALLATION_LOC=""
582 ACTUAL_CONFIGURATION_LOC=""
584 CREATE_PACKING_LIST="no"
585 DO_LINK_STEP_ONLY="no"
588 RUN_SCRIPTS_ONLY="no"
600 Log "Options specified..."
601 while [ $# -ne 0 ]; do
603 -s) Log " - get the build tree to extract from"
612 -z) Log " - get the install package to extract from"
621 -t) Log " - where to put the install package"
627 if [ "$SOURCE_TAR_FILE" = "" ]
634 -a) Log " - alternate place to get the udb files from"
641 USE_ALTERNATE_UDB_DIR="yes"
644 -f) Log " - load specific filesets"
653 -p) Log " - get all locations"
659 ACTUAL_INSTALLATION_LOC=$1
660 ACTUAL_CONFIGURATION_LOC=$1
664 -pI) Log " - get actual installation location"
670 ACTUAL_INSTALLATION_LOC=$1
673 -pC) Log " - get actual configuration location"
679 ACTUAL_CONFIGURATION_LOC=$1
682 -pV) Log " - get actual var location"
691 -clean) Log " - delete all three cde directories"
696 -cleanTwo) Log " - delete only temporary and installation directories"
700 -cleanEtc) Log " - delete only the configuration directory"
704 -prog) Log " - load only the development environment"
709 -runtime) Log " - load only the runtime environment"
714 -relative) Log " - run the relative-located config scripts"
718 -pack) Log " - create a packing list"
719 CREATE_PACKING_LIST="yes"
722 -LeaveLinks) Log " - do not remove the links"
726 -LinkStepOnly) Log " - do link step only"
727 DO_LINK_STEP_ONLY="yes"
730 -DontRunScripts) Log " - stop after installation"
731 DO_INSTALL_ONLY="yes"
734 -RunScriptsOnly) Log " - only run scripts"
735 RUN_SCRIPTS_ONLY="yes"
738 -pseudo) Log " - pseudo install"
744 -nocompress) Log " - do not compress tarball"
745 COMPRESS_TARBALL="no"
748 -lang) Log " - load localized filesets"
757 -configureOnly) Log " - Configure only"
762 *) Log " - unknown option"
771 if [ -z "$BUILD_TREE" -a -z "$TAR_TREE" ]
777 if [ "$BUILD_TREE" != "" -a ! -d "$BUILD_TREE" ]
779 Log "Build tree does not exist."
783 if [ "$TAR_TREE" != "" -a ! -d "$TAR_TREE" ]
785 Log "Tar tree does not exist."
795 XCOMM get the current time stamp if going to create a tarball
798 if [ $TARBALL = "yes" ];
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
811 TOOL_DIR=$BUILD_TREE/admin/IntegTools/dbTools
812 if [ "$USE_RELATIVE" = "yes" ]
814 POST_INSTALL_DIR=../post_install
816 if [ -z "$BUILD_TREE" ]
818 POST_INSTALL_DIR=$TAR_TREE/$CDECONFIGDIR
820 POST_INSTALL_DIR=$BUILD_TREE/admin/IntegTools/post_install
824 if [ "$USE_ALTERNATE_UDB_DIR" = "yes" ]
826 DATABASE_DIR=$ALTERNATE_UDB_DIR/databases
828 DATABASE_DIR=$BUILD_TREE/databases
831 if [ "$DATABASE_FILES" = "" ]
833 if [ "$DEVELOP_ENV" = "yes" ]
835 DATABASE_FILES="CDE-HELP-PRG CDE-PRG CDE-INC CDE-DEMOS \
836 CDE-MAN-DEV CDE-SHLIBS"
837 elif [ "$RUNTIME_ENV" = "yes" ]
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"
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"
849 HASH now load any localized filesets
850 if [ "$DEVELOP_ENV" != "yes" ]
852 if [ "$theLang" != "" ]
854 DATABASE_FILES="$DATABASE_FILES CDE-$theLang CDE-MSG-$theLang \
857 HASH load all current (working) languages
858 DATABASE_FILES="$DATABASE_FILES \
875 INSTALL_LOCATION=CDE_INSTALLATION_TOP
876 CONFIGURE_LOCATION=CDE_CONFIGURATION_TOP
877 LOGFILES_LOCATION=CDE_LOGFILES_TOP
879 if [ -L $INSTALL_LOCATION -a "$CONFIGURE_ONLY" != "yes" ]
881 touch $INSTALL_LOCATION/foo >/dev/null 2>/dev/null
882 if [ ! -f $INSTALL_LOCATION/foo ]
884 Log "Insufficient permissions to install CDE files in $INSTALL_LOCATION"
887 if [ ! -O $INSTALL_LOCATION/foo ]
889 Log "Root access to $INSTALL_LOCATION is required for CDE installation."
892 rm $INSTALL_LOCATION/foo
895 if [ -d $INSTALL_LOCATION ]
897 if [ -x $INSTALL_LOCATION/bin -a ! -d $INSTALL_LOCATION/bin ]
899 rm -f $INSTALL_LOCATION/bin
903 if [ "$CONFIGURE_ONLY" = "yes" ]
905 CheckForActualLocations
907 Log "Configuration completed."
911 if [ "$RUN_SCRIPTS_ONLY" = "yes" ]
917 CheckForActualLocations
919 if [ "$DO_LINK_STEP_ONLY" = "yes" ]
924 if [ "$CREATE_PACKING_LIST" = "yes" ]
931 XCOMM we are ready to load the environment ...
934 if [ "$BUILD_TREE" != "" ]
936 Log "Load the Desktop from $BUILD_TREE"
940 for i in `echo $DATABASE_FILES`
942 LoadFileSet "$j" "$i"
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
951 tar -xvf $TAR_TREE/$CDETARFILE $INSTALL_LOCATION
953 DATABASE_FILES=$(awk 'BEGIN {FS=":"} /FILESETS: /{print $2}' $TAR_TREE/$CDEPACKAGE)
957 Log "Desktop installed in $INSTALL_LOCATION"
959 if [ "$DO_INSTALL_ONLY" = "yes" ]
964 if [ $TARBALL = "yes" ];
971 if [ "$RUN_SCRIPTS" = "yes" ]
976 if [ "$REMOVE_LINKS" = "yes" ]
978 [ -L /usr/dt ] && rm /usr/dt
979 [ -L /etc/dt ] && rm /etc/dt
980 [ -L /var/dt ] && rm /var/dt
985 echo "See $LOGFILE for a log of this install session."