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, 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 ==========================================================================
172 XCOMM ==========================================================================
176 if [ -z "$getPlatform" ]; then
179 *HP-UX*) getPlatform=hp;;
180 *AIX*) getPlatform=ibm;;
181 *SunOS*) getPlatform=sun;;
182 *UNIX_SV*) getPlatform=usl;;
183 *OSF1*) getPlatform=dec;;
186 DtiReturn $getPlatform
189 XCOMM ==========================================================================
195 XCOMM Return - bytes needed for /usr/dt directory
196 XCOMM ==========================================================================
200 DtiReturn "$(awk '/SIZE: / {print $2}' $(pwd)/$DTIPLATFORMDIR/$DTIPACKAGE)"
203 XCOMM ==========================================================================
205 XCOMM Log - echo to log
208 XCOMM $1 - data to echo to log
211 XCOMM ==========================================================================
215 printf "$1" $2 $3 $4 $5 $6 $7 $8 $9 >>$dtiLogFile
218 XCOMM ==========================================================================
228 XCOMM State transitions
233 XCOMM 1) verify user is root
234 XCOMM user is root -> 3
235 XCOMM user is not root -> 2.1
237 XCOMM 2.*) display message and exit
239 XCOMM 2.1) user must be root
240 XCOMM 2.2) unsupported platform
241 XCOMM 2.4) could not find desktop install image
242 XCOMM 2.5) desktop install complete without error
243 XCOMM 2.6) desktop install complete with error
245 XCOMM 3) verify platform is supported
246 XCOMM supported platform -> 4.1
247 XCOMM unsupported platform -> 2.2
249 XCOMM 4.*) display a message
250 XCOMM 4.1) display welcome message
251 XCOMM user selects continue "0" -> 4.2
252 XCOMM user selects exit "99" -> 99.1
254 XCOMM 4.2) display disclaimer
255 XCOMM user selects continue "0" -> 5
256 XCOMM user selects exit "99" -> 99.1
258 XCOMM 4.3) display destinations
259 XCOMM user selects change installation root "1" -> 8
260 XCOMM user selects continue "0" -> 12
261 XCOMM user selects exit "99" -> 99.1
263 XCOMM 4.4) display free space warning
264 XCOMM user selects continue "0" -> 12
265 XCOMM user selects exit "99" -> 99.1
267 XCOMM 4.5) display system configuration warning
268 XCOMM user selects continue "0" -> 6
269 XCOMM user selects exit "99" -> 99.1
271 XCOMM 4.6) display 10/93 bits exist message
272 XCOMM user selects erase "1" -> 13
273 XCOMM user selects continue "0" -> 4.3
274 XCOMM user selects exit "99" -> 99.1
276 XCOMM 5) verify configuration
277 XCOMM configuration ok -> 6
278 XCOMM configuration not ok -> 4.5
280 XCOMM 6) verify CDROM
281 XCOMM platform dir found -> 4.3
282 XCOMM platform dir not found -> 2.4
284 XCOMM 7) check for 10/93 bits
285 XCOMM 10/93 bits exist -> 4.6
286 XCOMM 10/93 bits don't exist -> 4.3
288 XCOMM 8.*) obtain altername directory names
289 XCOMM 8.usr) obtain alternate /usr/dt directory name
290 XCOMM user enters "" or "/" -> 4.3 (revert to default)
291 XCOMM user enters "/*" -> 10.usr
292 XCOMM user enters anything else -> 8.usr
293 XCOMM 8.etc) obtain alternate /etc/dt directory name
294 XCOMM user enters "" or "/" -> 4.3 (revert to default)
295 XCOMM user enters "/*" -> 10.etc
296 XCOMM user enters anything else -> 8.etc
297 XCOMM 8.var) obtain alternate /var/dt directory name
298 XCOMM user enters "" or "/" -> 4.3 (revert to default)
299 XCOMM user enters "/*" -> 10.var
300 XCOMM user enters anything else -> 8.var
302 XCOMM 11) check available space
303 XCOMM space available -> 12
304 XCOMM space not available -> 4.4
306 XCOMM 12) run install script
307 XCOMM desktop install ok -> 2.5
308 XCOMM desktop install not ok -> 2.6
310 XCOMM 13) erase 10/93 bits
315 XCOMM ==========================================================================
337 HASH 1) verify user is 'root'
339 if [ $(DtiWhoami) = "root" ]; then
342 HASH NewState 3 # for debugging
349 HASH 2.*) display a message and exit
358 HASH 2.1) user must be root
364 HASH 2.2) unsupported platform
366 DtiPrint "$msg_2_2" $dtiPlatform
370 HASH 2.4) no desktop install image
372 DtiPrint "$msg_2_4" $dtiPlatform
376 HASH 2.5) desktop install complete without error
382 HASH 2.6) desktop install complete with error
388 HASH 2.7) not enough space
390 DtiPrint "$msg_2_7" $dtiRoot/$dtiUsrDt \
396 HASH 2.*) unexpected state
406 HASH 3) verify platform is supported
408 case "$dtiPlatform" in
420 HASH 4.*) display a message and allow user to continue
429 HASH 4.1) display welcome message
431 let meg=$(GetSpaceNeeded)/$dtiMeg+1
432 DtiPrint "$msg_4_1" " $meg"
439 *) NewState $laststate;;
444 HASH 4.2) display disclaimer
453 *) NewState $laststate;;
458 HASH 4.3) display destinations
460 DtiPrint "$msg_4_3" ${dtiRoot:-$dtiDefaultRoot} \
476 HASH 4.4) not enough space warning
478 DtiPrint "$msg_4_4" $dtiRoot/$dtiUsrDt \
487 *) NewState $laststate;;
492 HASH 4.5) unsupported system configuration warning
501 *) NewState $laststate;;
506 HASH 4.6) 10/93 bits exist
510 if [ "$dti9310dirs" != "" ]; then
512 for i in $dti9310dirs
518 if [ "$dti9310links" != "" ]; then
520 for i in $dti9310links
534 *) NewState $laststate;;
540 HASH 4.7) display one last chance warning
547 for i in $dtiUsrDt $dtiEtcDt $dtiVarDt
550 dti9404links="$dti9404links /$i"
551 elif [ -d /$i ]; then
552 dti9404dirs="$dti9404dirs /$i"
556 if [ "$dti9404dirs" != "" ]; then
558 for i in $dti9404dirs
564 if [ "$dti9404links" != "" ]; then
566 for i in $dti9404links
579 *) NewState $laststate;;
585 HASH 4.8) display .dt directory warning
587 DtiPrint "$msg_4_8" $DTIREADME
594 *) NewState $laststate;;
601 HASH 4.*) unexpected state
610 HASH 5) verify configuration
612 verifyConfig="$(DtiVerifyConfiguration)"
613 if [ "$verifyConfig" = "yes" ]; then
616 if [ "$verifyConfig" != "no" ]; then
617 msg_4_5="$verifyConfig"
627 if [ -d "$(pwd)/$DTIPLATFORMDIR" ]; then
636 HASH 7) check for 10/93 bits
642 for i in /opt/dt /etc/opt/dt /var/opt/dt
644 if [ -d "$i" -a -L "$i" ]; then
645 dti9310dirs="$dti9310dirs $(ResolvePathName $i)"
646 dti9310links="$dti9310links $i"
647 elif [ -d "$i" ]; then
648 dti9310dirs="$dti9310dirs $i"
653 if [ -z "$dti9310dirs" -a -z "$dti9310links" ]; then
662 HASH 8) obtain alternate installation root
668 let meg=$(GetSpaceNeeded)/$dtiMeg+1
670 DtiPrint "$msg_8" ${dtiRoot:-$dtiDefaultRoot} \
676 if [ "$msg_8_error" != "" ]; then
677 DtiPrint " ${msg_8_error}\n\n"
687 HASH blank, no change
691 HASH root, revert to default
695 /usr/dt|/usr/dt/STAR|/etc/dt|/etc/dt/STAR|/var/dt|/var/dt/STAR)
697 msg_8_error="Please specify something other than '$response'."
700 HASH absolute path is ok, continue verification
701 dtiProposedRoot=$response
702 if [ -d $dtiProposedRoot ]; then
703 dtiRoot=$dtiProposedRoot
706 msg_8_error="Directory '$response' does not exist."
711 HASH anything else is not
712 msg_8_error="The directory you specify must start with a '/'."
719 HASH check available space
721 dir=$dtiRoot/$dtiUsrDt
723 while [[ ! -z "$dir" && ! -d $dir ]]
728 [ -z "$dir" ] && dir="/"
730 dtiSpaceAvail=$(DtiFreeSpace $dir)
731 dtiSpaceNeeded=$(GetSpaceNeeded)
733 if [[ "$dtiSpaceAvail" -lt "$dtiSpaceNeeded" ]]; then
742 HASH start install script
748 DtiPrint "Installing the Desktop..."
750 options="-clean -z $(pwd)/$DTIPLATFORMDIR"
752 if [ "$dtiRoot" != "" ]; then
753 options="$options -pI $dtiRoot/$dtiUsrDt"
754 options="$options -pC $dtiRoot/$dtiEtcDt"
755 options="$options -pV $dtiRoot/$dtiVarDt"
758 $DTIPLATFORMDIR/$DTIINSTALLCDE $options
760 if [ "$?" = "0" ]; then
769 HASH 13) erase 10/93 bits
775 DtiPrint "Erasing the October 1993 Snapshot ..."
777 if [ "$dti9310dirs" != "" ]; then
778 for i in $dti9310dirs
780 DtiPrint "\nErasing $i ..."
781 rm -rf $i 2>&1 >>$dtiLogFile
785 if [ "$dti9310links" != "" ]; then
786 for i in $dti9310links
788 DtiPrint "\nErasing $i ..."
789 rm $i 2>&1 >>$dtiLogFile
804 HASH *) unexpected state
811 XCOMM ==========================================================================
815 XCOMM ==========================================================================
818 The Common Open Systems Environment Desktop\n\
819 April 1994 Snapshot CDROM Installation\n\n"
822 You must be logged in as 'root' to install the Desktop\n"
825 This CD does not contain a Desktop install image for %s.\n"
828 This CD does not contain a Desktop install image for %s.\n"
831 The Desktop installation is complete.\n\
833 Please refer to your Getting Started guide for information
834 about how to start the Desktop.\n\n"
837 The Desktop installation completed with errors.\n\
839 Please browse the /tmp/installCDE.log file for information
840 regarding the problem.\n\n"
843 The Common Open Systems Environment Desktop\n\
844 April 1994 Snapshot CDROM Installation\n\n"
847 This script will guide you through the installation of
848 the Desktop onto your system.\n\
850 You will need approximately %sMB of available space in
851 which to install the Desktop.
853 0) Continue with Desktop Installation\n\
854 99) Exit Desktop Installation\n
856 Please enter selection: "
859 Important: You must sign and return the enclosed Software License
860 Agreement before you can use this Software!
863 WARNING: Use of CD-ROM Code is Time Limited: This software is
864 not intended for use beyond the time limitations detailed in
865 the Software License Agreement.
868 0) Continue with Desktop Installation
869 99) Exit Desktop Installation
871 Please enter selection: "
874 The current installation 'root' for the desktop is '%s',
875 which means the desktop will be installed in the following directories:
881 You may specify an alternate installation root by selecting (1) below.
883 1) Select alternate installation root\n\
885 0) Continue with Desktop Installation\n\
886 99) Exit Desktop Installation\n\
888 Please enter selection: "
891 WARNING! There is not enough free space available in which to
898 It is recommended that you Exit Desktop Installation (99) to
901 0) Continue with Desktop Installation\n\
902 99) Exit Desktop Installation\n
904 Please enter selection: "
907 WARNING! The Desktop does not support this system configuration.
909 It is recommended that you install the desktop on a supported
910 system configuration.
912 0) Continue with Desktop Installation
913 99) Exit Desktop Installation
915 Please enter selection: "
918 The October 1993 Snapshot installation has been detected on this
919 system. You may select (1) to erase the October 1993 Snapshot from
920 your system. Selecting (1) will:\n"
923 \nErase the following directories and their contents:\n\n"
926 \nRemove the following symbolic links:\n\n"
930 1) Erase the October 1993 Snapshot from your system\n\
932 0) Continue with Desktop Installation\n\
933 99) Exit Desktop Installation\n\
935 Please enter selection: "
938 The April 1994 Snapshot will now be installed on your system.\n"
942 The contents of the following existing directories will be completely replaced:
946 \nThe following existing symbolic links will be replaced:\n\n"
950 0) Continue with Desktop Installation\n\
951 99) Exit Desktop Installation\n\
953 Please enter selection: "
956 WARNING! Advise all CDE users on the system to remove or rename their
957 \$HOME/.dt directory and their \$HOME/.dtprofile. The April 1994 Desktop
958 is not compatible with the October 1993 Desktop versions of these files.
960 If users have customized the \$HOME/.dt/dtwmrc file and want to keep
961 it, they will need to cut and paste the appropriate pieces into the new
964 Please see the '%s' file on this CDROM for more information.
966 0) Continue with Desktop Installation
967 99) Exit Desktop Installation
969 Please enter selection: "
972 The current installation 'root' for the desktop is '%s',
973 which means the desktop will be installed in the following directories:
979 To specify a different directory, enter a full directory pathname
980 below. Simply press enter to keep the current installation root.
982 The directory you specify must:
984 * Be an absolute path (i.e. start with a '/')
985 * Be an existing directory
986 * Have approximately %sMB of free space\n\n"
989 Please enter directory name or leave blank to keep the current name
992 XCOMM ==========================================================================
998 XCOMM $state - current state
1000 XCOMM $laststate - saved current state
1001 XCOMM $state - new state
1004 XCOMM ==========================================================================
1012 XCOMM ==========================================================================
1014 XCOMM DtiPrint - echo to stderr and log
1017 XCOMM $1 - data to echo to stdout and log
1020 XCOMM ==========================================================================
1024 printf "$1" $2 $3 $4 $5 $6 $7 $8 $9 >&2
1025 Log "$1" $2 $3 $4 $5 $6 $7 $8 $9
1029 XCOMM =========================================================================
1031 XCOMM ResolvePathName
1037 XCOMM =========================================================================
1040 if [ "/" = "$1" ]; then
1042 elif [ -L $1 ]; then
1043 ResolvePathName `/bin/ls -l $1 | awk '{print $NF}'` $2
1044 else ResolvePathName `dirname $1` `basename $1`${2+/}$2
1049 XCOMM ==========================================================================
1051 XCOMM DtiReturn - return a string to stdout
1054 XCOMM $1 - data to return
1057 XCOMM ==========================================================================
1064 XCOMM ==========================================================================
1069 XCOMM $laststate - previous state
1070 XCOMM $state - current state
1074 XCOMM ==========================================================================
1078 DtiPrint "Fatal error: unexpected state transition $laststate --> $state\n"
1079 Exit "Fatal error: unexpected state transition $laststate --> $state\n"
1082 XCOMM ==========================================================================
1089 XCOMM ==========================================================================
1093 DTIINSTALLDT=install.dt
1094 DTIINSTALLCDE=install.cde
1096 DTIINSTALLDTO=install.dto
1106 dtiPlatform=$(GetPlatform)
1107 DTIPLATFORMDIR=$dtiPlatform
1108 DTIREADME=config/config.$dtiPlatform
1112 dtiLogFile="/tmp/install.dt.log"
1117 XCOMM change directories to install.dt location as all
1118 XCOMM installation packages are relative to this
1121 if [ ${0##STAR/} != $DTIINSTALLDT ]; then
1123 HASH CDROM driver folds filenames to uppercase
1125 typeset -u DTIINSTALLDT
1126 typeset -u DTIINSTALLCDE
1127 typeset -u DTIPACKAGE
1128 typeset -u DTIINSTALLDTO
1129 typeset -u DTICONFIGDIR
1130 typeset -u DTIPLATFORMDIR
1131 typeset -u DTIREADME
1134 if [ ${0%/STAR} != $DTIINSTALLDT ]; then
1139 XCOMM source in possible platform overrides for certain functions
1141 XCOMM DtiClearScreen
1143 XCOMM DtiVerifyConfiguration
1146 if [ -d "$(pwd)/$DTIPLATFORMDIR" ]; then
1147 if [ -f $(pwd)/$DTIPLATFORMDIR/$DTIINSTALLDTO ]; then
1148 . $(pwd)/$DTIPLATFORMDIR/$DTIINSTALLDTO