2 XCOMM $XConsortium: install.dt.src /main/6 1996/04/23 11:19:05 drk $
4 XCOMM ==========================================================================
5 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
11 XCOMM ==========================================================================
12 XCOMM ==========================================================================
14 XCOMM ==========================================================================
15 XCOMM ==========================================================================
17 XCOMM This script does the following:
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
31 XCOMM ==========================================================================
32 XCOMM ==========================================================================
34 XCOMM ==========================================================================
35 XCOMM ==========================================================================
37 XCOMM Override functions
39 XCOMM These routines might have a platform override
43 XCOMM DtiVerifyConfiguration
46 XCOMM ==========================================================================
47 XCOMM ==========================================================================
52 XCOMM ==========================================================================
54 XCOMM DtiClearScreen - clears the screen
59 XCOMM ==========================================================================
66 XCOMM ==========================================================================
74 XCOMM ==========================================================================
81 XCOMM ==========================================================================
83 XCOMM DtiVerifyConfiguration
89 XCOMM ==========================================================================
91 DtiVerifyConfiguration()
96 XCOMM ==========================================================================
103 XCOMM result of system 'whoami' command
105 XCOMM ==========================================================================
112 XCOMM ==========================================================================
113 XCOMM ==========================================================================
115 XCOMM Internal functions
117 XCOMM These routines do not have a platform override
119 XCOMM ==========================================================================
120 XCOMM ==========================================================================
122 XCOMM ==========================================================================
123 XCOMM ==========================================================================
125 XCOMM Utility functions
127 XCOMM These routines are not expected to have a platform override
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
138 XCOMM ==========================================================================
139 XCOMM ==========================================================================
141 XCOMM ==========================================================================
143 XCOMM Exit - log and exit
146 XCOMM $1 - data to echo to log
149 XCOMM ==========================================================================
154 Log "* $(date) $(DtiWhoami)"
160 XCOMM ==========================================================================
173 XCOMM ==========================================================================
177 if [ -z "$getPlatform" ]; then
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;;
188 DtiReturn $getPlatform
191 XCOMM ==========================================================================
197 XCOMM Return - bytes needed for /usr/dt directory
198 XCOMM ==========================================================================
202 DtiReturn "$(awk '/SIZE: / {print $2}' $(pwd)/$DTIPLATFORMDIR/$DTIPACKAGE)"
205 XCOMM ==========================================================================
207 XCOMM Log - echo to log
210 XCOMM $1 - data to echo to log
213 XCOMM ==========================================================================
217 printf "$1" $2 $3 $4 $5 $6 $7 $8 $9 >>$dtiLogFile
220 XCOMM ==========================================================================
230 XCOMM State transitions
235 XCOMM 1) verify user is root
236 XCOMM user is root -> 3
237 XCOMM user is not root -> 2.1
239 XCOMM 2.*) display message and exit
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
247 XCOMM 3) verify platform is supported
248 XCOMM supported platform -> 4.1
249 XCOMM unsupported platform -> 2.2
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
256 XCOMM 4.2) display disclaimer
257 XCOMM user selects continue "0" -> 5
258 XCOMM user selects exit "99" -> 99.1
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
265 XCOMM 4.4) display free space warning
266 XCOMM user selects continue "0" -> 12
267 XCOMM user selects exit "99" -> 99.1
269 XCOMM 4.5) display system configuration warning
270 XCOMM user selects continue "0" -> 6
271 XCOMM user selects exit "99" -> 99.1
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
278 XCOMM 5) verify configuration
279 XCOMM configuration ok -> 6
280 XCOMM configuration not ok -> 4.5
282 XCOMM 6) verify CDROM
283 XCOMM platform dir found -> 4.3
284 XCOMM platform dir not found -> 2.4
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
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
304 XCOMM 11) check available space
305 XCOMM space available -> 12
306 XCOMM space not available -> 4.4
308 XCOMM 12) run install script
309 XCOMM desktop install ok -> 2.5
310 XCOMM desktop install not ok -> 2.6
312 XCOMM 13) erase 10/93 bits
317 XCOMM ==========================================================================
339 HASH 1) verify user is 'root'
341 if [ $(DtiWhoami) = "root" ]; then
344 HASH NewState 3 # for debugging
351 HASH 2.*) display a message and exit
360 HASH 2.1) user must be root
366 HASH 2.2) unsupported platform
368 DtiPrint "$msg_2_2" $dtiPlatform
372 HASH 2.4) no desktop install image
374 DtiPrint "$msg_2_4" $dtiPlatform
378 HASH 2.5) desktop install complete without error
384 HASH 2.6) desktop install complete with error
390 HASH 2.7) not enough space
392 DtiPrint "$msg_2_7" $dtiRoot/$dtiUsrDt \
398 HASH 2.*) unexpected state
408 HASH 3) verify platform is supported
410 case "$dtiPlatform" in
411 hp|ibm|sun|uxp|usl|dec)
422 HASH 4.*) display a message and allow user to continue
431 HASH 4.1) display welcome message
433 let meg=$(GetSpaceNeeded)/$dtiMeg+1
434 DtiPrint "$msg_4_1" " $meg"
441 *) NewState $laststate;;
446 HASH 4.2) display disclaimer
455 *) NewState $laststate;;
460 HASH 4.3) display destinations
462 DtiPrint "$msg_4_3" ${dtiRoot:-$dtiDefaultRoot} \
478 HASH 4.4) not enough space warning
480 DtiPrint "$msg_4_4" $dtiRoot/$dtiUsrDt \
489 *) NewState $laststate;;
494 HASH 4.5) unsupported system configuration warning
503 *) NewState $laststate;;
508 HASH 4.6) 10/93 bits exist
512 if [ "$dti9310dirs" != "" ]; then
514 for i in $dti9310dirs
520 if [ "$dti9310links" != "" ]; then
522 for i in $dti9310links
536 *) NewState $laststate;;
542 HASH 4.7) display one last chance warning
549 for i in $dtiUsrDt $dtiEtcDt $dtiVarDt
552 dti9404links="$dti9404links /$i"
553 elif [ -d /$i ]; then
554 dti9404dirs="$dti9404dirs /$i"
558 if [ "$dti9404dirs" != "" ]; then
560 for i in $dti9404dirs
566 if [ "$dti9404links" != "" ]; then
568 for i in $dti9404links
581 *) NewState $laststate;;
587 HASH 4.8) display .dt directory warning
589 DtiPrint "$msg_4_8" $DTIREADME
596 *) NewState $laststate;;
603 HASH 4.*) unexpected state
612 HASH 5) verify configuration
614 verifyConfig="$(DtiVerifyConfiguration)"
615 if [ "$verifyConfig" = "yes" ]; then
618 if [ "$verifyConfig" != "no" ]; then
619 msg_4_5="$verifyConfig"
629 if [ -d "$(pwd)/$DTIPLATFORMDIR" ]; then
638 HASH 7) check for 10/93 bits
644 for i in /opt/dt /etc/opt/dt /var/opt/dt
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"
655 if [ -z "$dti9310dirs" -a -z "$dti9310links" ]; then
664 HASH 8) obtain alternate installation root
670 let meg=$(GetSpaceNeeded)/$dtiMeg+1
672 DtiPrint "$msg_8" ${dtiRoot:-$dtiDefaultRoot} \
678 if [ "$msg_8_error" != "" ]; then
679 DtiPrint " ${msg_8_error}\n\n"
689 HASH blank, no change
693 HASH root, revert to default
697 /usr/dt|/usr/dt/STAR|/etc/dt|/etc/dt/STAR|/var/dt|/var/dt/STAR)
699 msg_8_error="Please specify something other than '$response'."
702 HASH absolute path is ok, continue verification
703 dtiProposedRoot=$response
704 if [ -d $dtiProposedRoot ]; then
705 dtiRoot=$dtiProposedRoot
708 msg_8_error="Directory '$response' does not exist."
713 HASH anything else is not
714 msg_8_error="The directory you specify must start with a '/'."
721 HASH check available space
723 dir=$dtiRoot/$dtiUsrDt
725 while [[ ! -z "$dir" && ! -d $dir ]]
730 [ -z "$dir" ] && dir="/"
732 dtiSpaceAvail=$(DtiFreeSpace $dir)
733 dtiSpaceNeeded=$(GetSpaceNeeded)
735 if [[ "$dtiSpaceAvail" -lt "$dtiSpaceNeeded" ]]; then
744 HASH start install script
750 DtiPrint "Installing the Desktop..."
752 options="-clean -z $(pwd)/$DTIPLATFORMDIR"
754 if [ "$dtiRoot" != "" ]; then
755 options="$options -pI $dtiRoot/$dtiUsrDt"
756 options="$options -pC $dtiRoot/$dtiEtcDt"
757 options="$options -pV $dtiRoot/$dtiVarDt"
760 $DTIPLATFORMDIR/$DTIINSTALLCDE $options
762 if [ "$?" = "0" ]; then
771 HASH 13) erase 10/93 bits
777 DtiPrint "Erasing the October 1993 Snapshot ..."
779 if [ "$dti9310dirs" != "" ]; then
780 for i in $dti9310dirs
782 DtiPrint "\nErasing $i ..."
783 rm -rf $i 2>&1 >>$dtiLogFile
787 if [ "$dti9310links" != "" ]; then
788 for i in $dti9310links
790 DtiPrint "\nErasing $i ..."
791 rm $i 2>&1 >>$dtiLogFile
806 HASH *) unexpected state
813 XCOMM ==========================================================================
817 XCOMM ==========================================================================
820 The Common Open Systems Environment Desktop\n\
821 April 1994 Snapshot CDROM Installation\n\n"
824 You must be logged in as 'root' to install the Desktop\n"
827 This CD does not contain a Desktop install image for %s.\n"
830 This CD does not contain a Desktop install image for %s.\n"
833 The Desktop installation is complete.\n\
835 Please refer to your Getting Started guide for information
836 about how to start the Desktop.\n\n"
839 The Desktop installation completed with errors.\n\
841 Please browse the /tmp/installCDE.log file for information
842 regarding the problem.\n\n"
845 The Common Open Systems Environment Desktop\n\
846 April 1994 Snapshot CDROM Installation\n\n"
849 This script will guide you through the installation of
850 the Desktop onto your system.\n\
852 You will need approximately %sMB of available space in
853 which to install the Desktop.
855 0) Continue with Desktop Installation\n\
856 99) Exit Desktop Installation\n
858 Please enter selection: "
861 Important: You must sign and return the enclosed Software License
862 Agreement before you can use this Software!
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.
870 0) Continue with Desktop Installation
871 99) Exit Desktop Installation
873 Please enter selection: "
876 The current installation 'root' for the desktop is '%s',
877 which means the desktop will be installed in the following directories:
883 You may specify an alternate installation root by selecting (1) below.
885 1) Select alternate installation root\n\
887 0) Continue with Desktop Installation\n\
888 99) Exit Desktop Installation\n\
890 Please enter selection: "
893 WARNING! There is not enough free space available in which to
900 It is recommended that you Exit Desktop Installation (99) to
903 0) Continue with Desktop Installation\n\
904 99) Exit Desktop Installation\n
906 Please enter selection: "
909 WARNING! The Desktop does not support this system configuration.
911 It is recommended that you install the desktop on a supported
912 system configuration.
914 0) Continue with Desktop Installation
915 99) Exit Desktop Installation
917 Please enter selection: "
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"
925 \nErase the following directories and their contents:\n\n"
928 \nRemove the following symbolic links:\n\n"
932 1) Erase the October 1993 Snapshot from your system\n\
934 0) Continue with Desktop Installation\n\
935 99) Exit Desktop Installation\n\
937 Please enter selection: "
940 The April 1994 Snapshot will now be installed on your system.\n"
944 The contents of the following existing directories will be completely replaced:
948 \nThe following existing symbolic links will be replaced:\n\n"
952 0) Continue with Desktop Installation\n\
953 99) Exit Desktop Installation\n\
955 Please enter selection: "
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.
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
966 Please see the '%s' file on this CDROM for more information.
968 0) Continue with Desktop Installation
969 99) Exit Desktop Installation
971 Please enter selection: "
974 The current installation 'root' for the desktop is '%s',
975 which means the desktop will be installed in the following directories:
981 To specify a different directory, enter a full directory pathname
982 below. Simply press enter to keep the current installation root.
984 The directory you specify must:
986 * Be an absolute path (i.e. start with a '/')
987 * Be an existing directory
988 * Have approximately %sMB of free space\n\n"
991 Please enter directory name or leave blank to keep the current name
994 XCOMM ==========================================================================
1000 XCOMM $state - current state
1002 XCOMM $laststate - saved current state
1003 XCOMM $state - new state
1006 XCOMM ==========================================================================
1014 XCOMM ==========================================================================
1016 XCOMM DtiPrint - echo to stderr and log
1019 XCOMM $1 - data to echo to stdout and log
1022 XCOMM ==========================================================================
1026 printf "$1" $2 $3 $4 $5 $6 $7 $8 $9 >&2
1027 Log "$1" $2 $3 $4 $5 $6 $7 $8 $9
1031 XCOMM =========================================================================
1033 XCOMM ResolvePathName
1039 XCOMM =========================================================================
1042 if [ "/" = "$1" ]; then
1044 elif [ -L $1 ]; then
1045 ResolvePathName `/bin/ls -l $1 | awk '{print $NF}'` $2
1046 else ResolvePathName `dirname $1` `basename $1`${2+/}$2
1051 XCOMM ==========================================================================
1053 XCOMM DtiReturn - return a string to stdout
1056 XCOMM $1 - data to return
1059 XCOMM ==========================================================================
1066 XCOMM ==========================================================================
1071 XCOMM $laststate - previous state
1072 XCOMM $state - current state
1076 XCOMM ==========================================================================
1080 DtiPrint "Fatal error: unexpected state transition $laststate --> $state\n"
1081 Exit "Fatal error: unexpected state transition $laststate --> $state\n"
1084 XCOMM ==========================================================================
1091 XCOMM ==========================================================================
1095 DTIINSTALLDT=install.dt
1096 DTIINSTALLCDE=install.cde
1098 DTIINSTALLDTO=install.dto
1108 dtiPlatform=$(GetPlatform)
1109 DTIPLATFORMDIR=$dtiPlatform
1110 DTIREADME=config/config.$dtiPlatform
1114 dtiLogFile="/tmp/install.dt.log"
1119 XCOMM change directories to install.dt location as all
1120 XCOMM installation packages are relative to this
1123 if [ ${0##STAR/} != $DTIINSTALLDT ]; then
1125 HASH CDROM driver folds filenames to uppercase
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
1136 if [ ${0%/STAR} != $DTIINSTALLDT ]; then
1141 XCOMM source in possible platform overrides for certain functions
1143 XCOMM DtiClearScreen
1145 XCOMM DtiVerifyConfiguration
1148 if [ -d "$(pwd)/$DTIPLATFORMDIR" ]; then
1149 if [ -f $(pwd)/$DTIPLATFORMDIR/$DTIINSTALLDTO ]; then
1150 . $(pwd)/$DTIPLATFORMDIR/$DTIINSTALLDTO