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, or Sun 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 ==========================================================================
170 XCOMM ==========================================================================
174 if [ -z "$getPlatform" ]; then
177 *HP-UX*) getPlatform=hp;;
178 *AIX*) getPlatform=ibm;;
179 *SunOS*) getPlatform=sun;;
182 DtiReturn $getPlatform
185 XCOMM ==========================================================================
191 XCOMM Return - bytes needed for /usr/dt directory
192 XCOMM ==========================================================================
196 DtiReturn "$(awk '/SIZE: / {print $2}' $(pwd)/$DTIPLATFORMDIR/$DTIPACKAGE)"
199 XCOMM ==========================================================================
201 XCOMM Log - echo to log
204 XCOMM $1 - data to echo to log
207 XCOMM ==========================================================================
211 printf "$1" $2 $3 $4 $5 $6 $7 $8 $9 >>$dtiLogFile
214 XCOMM ==========================================================================
224 XCOMM State transitions
229 XCOMM 1) verify user is root
230 XCOMM user is root -> 3
231 XCOMM user is not root -> 2.1
233 XCOMM 2.*) display message and exit
235 XCOMM 2.1) user must be root
236 XCOMM 2.2) unsupported platform
237 XCOMM 2.4) could not find desktop install image
238 XCOMM 2.5) desktop install complete without error
239 XCOMM 2.6) desktop install complete with error
241 XCOMM 3) verify platform is supported
242 XCOMM supported platform -> 4.1
243 XCOMM unsupported platform -> 2.2
245 XCOMM 4.*) display a message
246 XCOMM 4.1) display welcome message
247 XCOMM user selects continue "0" -> 4.2
248 XCOMM user selects exit "99" -> 99.1
250 XCOMM 4.2) display disclaimer
251 XCOMM user selects continue "0" -> 5
252 XCOMM user selects exit "99" -> 99.1
254 XCOMM 4.3) display destinations
255 XCOMM user selects change installation root "1" -> 8
256 XCOMM user selects continue "0" -> 12
257 XCOMM user selects exit "99" -> 99.1
259 XCOMM 4.4) display free space warning
260 XCOMM user selects continue "0" -> 12
261 XCOMM user selects exit "99" -> 99.1
263 XCOMM 4.5) display system configuration warning
264 XCOMM user selects continue "0" -> 6
265 XCOMM user selects exit "99" -> 99.1
267 XCOMM 4.6) display 10/93 bits exist message
268 XCOMM user selects erase "1" -> 13
269 XCOMM user selects continue "0" -> 4.3
270 XCOMM user selects exit "99" -> 99.1
272 XCOMM 5) verify configuration
273 XCOMM configuration ok -> 6
274 XCOMM configuration not ok -> 4.5
276 XCOMM 6) verify CDROM
277 XCOMM platform dir found -> 4.3
278 XCOMM platform dir not found -> 2.4
280 XCOMM 7) check for 10/93 bits
281 XCOMM 10/93 bits exist -> 4.6
282 XCOMM 10/93 bits don't exist -> 4.3
284 XCOMM 8.*) obtain altername directory names
285 XCOMM 8.usr) obtain alternate /usr/dt directory name
286 XCOMM user enters "" or "/" -> 4.3 (revert to default)
287 XCOMM user enters "/*" -> 10.usr
288 XCOMM user enters anything else -> 8.usr
289 XCOMM 8.etc) obtain alternate /etc/dt directory name
290 XCOMM user enters "" or "/" -> 4.3 (revert to default)
291 XCOMM user enters "/*" -> 10.etc
292 XCOMM user enters anything else -> 8.etc
293 XCOMM 8.var) obtain alternate /var/dt directory name
294 XCOMM user enters "" or "/" -> 4.3 (revert to default)
295 XCOMM user enters "/*" -> 10.var
296 XCOMM user enters anything else -> 8.var
298 XCOMM 11) check available space
299 XCOMM space available -> 12
300 XCOMM space not available -> 4.4
302 XCOMM 12) run install script
303 XCOMM desktop install ok -> 2.5
304 XCOMM desktop install not ok -> 2.6
306 XCOMM 13) erase 10/93 bits
311 XCOMM ==========================================================================
333 HASH 1) verify user is 'root'
335 if [ $(DtiWhoami) = "root" ]; then
338 HASH NewState 3 # for debugging
345 HASH 2.*) display a message and exit
354 HASH 2.1) user must be root
360 HASH 2.2) unsupported platform
362 DtiPrint "$msg_2_2" $dtiPlatform
366 HASH 2.4) no desktop install image
368 DtiPrint "$msg_2_4" $dtiPlatform
372 HASH 2.5) desktop install complete without error
378 HASH 2.6) desktop install complete with error
384 HASH 2.7) not enough space
386 DtiPrint "$msg_2_7" $dtiRoot/$dtiUsrDt \
392 HASH 2.*) unexpected state
402 HASH 3) verify platform is supported
404 case "$dtiPlatform" in
416 HASH 4.*) display a message and allow user to continue
425 HASH 4.1) display welcome message
427 let meg=$(GetSpaceNeeded)/$dtiMeg+1
428 DtiPrint "$msg_4_1" " $meg"
435 *) NewState $laststate;;
440 HASH 4.2) display disclaimer
449 *) NewState $laststate;;
454 HASH 4.3) display destinations
456 DtiPrint "$msg_4_3" ${dtiRoot:-$dtiDefaultRoot} \
472 HASH 4.4) not enough space warning
474 DtiPrint "$msg_4_4" $dtiRoot/$dtiUsrDt \
483 *) NewState $laststate;;
488 HASH 4.5) unsupported system configuration warning
497 *) NewState $laststate;;
502 HASH 4.6) 10/93 bits exist
506 if [ "$dti9310dirs" != "" ]; then
508 for i in $dti9310dirs
514 if [ "$dti9310links" != "" ]; then
516 for i in $dti9310links
530 *) NewState $laststate;;
536 HASH 4.7) display one last chance warning
543 for i in $dtiUsrDt $dtiEtcDt $dtiVarDt
546 dti9404links="$dti9404links /$i"
547 elif [ -d /$i ]; then
548 dti9404dirs="$dti9404dirs /$i"
552 if [ "$dti9404dirs" != "" ]; then
554 for i in $dti9404dirs
560 if [ "$dti9404links" != "" ]; then
562 for i in $dti9404links
575 *) NewState $laststate;;
581 HASH 4.8) display .dt directory warning
583 DtiPrint "$msg_4_8" $DTIREADME
590 *) NewState $laststate;;
597 HASH 4.*) unexpected state
606 HASH 5) verify configuration
608 verifyConfig="$(DtiVerifyConfiguration)"
609 if [ "$verifyConfig" = "yes" ]; then
612 if [ "$verifyConfig" != "no" ]; then
613 msg_4_5="$verifyConfig"
623 if [ -d "$(pwd)/$DTIPLATFORMDIR" ]; then
632 HASH 7) check for 10/93 bits
638 for i in /opt/dt /etc/opt/dt /var/opt/dt
640 if [ -d "$i" -a -L "$i" ]; then
641 dti9310dirs="$dti9310dirs $(ResolvePathName $i)"
642 dti9310links="$dti9310links $i"
643 elif [ -d "$i" ]; then
644 dti9310dirs="$dti9310dirs $i"
649 if [ -z "$dti9310dirs" -a -z "$dti9310links" ]; then
658 HASH 8) obtain alternate installation root
664 let meg=$(GetSpaceNeeded)/$dtiMeg+1
666 DtiPrint "$msg_8" ${dtiRoot:-$dtiDefaultRoot} \
672 if [ "$msg_8_error" != "" ]; then
673 DtiPrint " ${msg_8_error}\n\n"
683 HASH blank, no change
687 HASH root, revert to default
691 /usr/dt|/usr/dt/STAR|/etc/dt|/etc/dt/STAR|/var/dt|/var/dt/STAR)
693 msg_8_error="Please specify something other than '$response'."
696 HASH absolute path is ok, continue verification
697 dtiProposedRoot=$response
698 if [ -d $dtiProposedRoot ]; then
699 dtiRoot=$dtiProposedRoot
702 msg_8_error="Directory '$response' does not exist."
707 HASH anything else is not
708 msg_8_error="The directory you specify must start with a '/'."
715 HASH check available space
717 dir=$dtiRoot/$dtiUsrDt
719 while [[ ! -z "$dir" && ! -d $dir ]]
724 [ -z "$dir" ] && dir="/"
726 dtiSpaceAvail=$(DtiFreeSpace $dir)
727 dtiSpaceNeeded=$(GetSpaceNeeded)
729 if [[ "$dtiSpaceAvail" -lt "$dtiSpaceNeeded" ]]; then
738 HASH start install script
744 DtiPrint "Installing the Desktop..."
746 options="-clean -z $(pwd)/$DTIPLATFORMDIR"
748 if [ "$dtiRoot" != "" ]; then
749 options="$options -pI $dtiRoot/$dtiUsrDt"
750 options="$options -pC $dtiRoot/$dtiEtcDt"
751 options="$options -pV $dtiRoot/$dtiVarDt"
754 $DTIPLATFORMDIR/$DTIINSTALLCDE $options
756 if [ "$?" = "0" ]; then
765 HASH 13) erase 10/93 bits
771 DtiPrint "Erasing the October 1993 Snapshot ..."
773 if [ "$dti9310dirs" != "" ]; then
774 for i in $dti9310dirs
776 DtiPrint "\nErasing $i ..."
777 rm -rf $i 2>&1 >>$dtiLogFile
781 if [ "$dti9310links" != "" ]; then
782 for i in $dti9310links
784 DtiPrint "\nErasing $i ..."
785 rm $i 2>&1 >>$dtiLogFile
800 HASH *) unexpected state
807 XCOMM ==========================================================================
811 XCOMM ==========================================================================
814 The Common Open Systems Environment Desktop\n\
815 April 1994 Snapshot CDROM Installation\n\n"
818 You must be logged in as 'root' to install the Desktop\n"
821 This CD does not contain a Desktop install image for %s.\n"
824 This CD does not contain a Desktop install image for %s.\n"
827 The Desktop installation is complete.\n\
829 Please refer to your Getting Started guide for information
830 about how to start the Desktop.\n\n"
833 The Desktop installation completed with errors.\n\
835 Please browse the /tmp/installCDE.log file for information
836 regarding the problem.\n\n"
839 The Common Open Systems Environment Desktop\n\
840 April 1994 Snapshot CDROM Installation\n\n"
843 This script will guide you through the installation of
844 the Desktop onto your system.\n\
846 You will need approximately %sMB of available space in
847 which to install the Desktop.
849 0) Continue with Desktop Installation\n\
850 99) Exit Desktop Installation\n
852 Please enter selection: "
855 Important: You must sign and return the enclosed Software License
856 Agreement before you can use this Software!
859 WARNING: Use of CD-ROM Code is Time Limited: This software is
860 not intended for use beyond the time limitations detailed in
861 the Software License Agreement.
864 0) Continue with Desktop Installation
865 99) Exit Desktop Installation
867 Please enter selection: "
870 The current installation 'root' for the desktop is '%s',
871 which means the desktop will be installed in the following directories:
877 You may specify an alternate installation root by selecting (1) below.
879 1) Select alternate installation root\n\
881 0) Continue with Desktop Installation\n\
882 99) Exit Desktop Installation\n\
884 Please enter selection: "
887 WARNING! There is not enough free space available in which to
894 It is recommended that you Exit Desktop Installation (99) to
897 0) Continue with Desktop Installation\n\
898 99) Exit Desktop Installation\n
900 Please enter selection: "
903 WARNING! The Desktop does not support this system configuration.
905 It is recommended that you install the desktop on a supported
906 system configuration.
908 0) Continue with Desktop Installation
909 99) Exit Desktop Installation
911 Please enter selection: "
914 The October 1993 Snapshot installation has been detected on this
915 system. You may select (1) to erase the October 1993 Snapshot from
916 your system. Selecting (1) will:\n"
919 \nErase the following directories and their contents:\n\n"
922 \nRemove the following symbolic links:\n\n"
926 1) Erase the October 1993 Snapshot from your system\n\
928 0) Continue with Desktop Installation\n\
929 99) Exit Desktop Installation\n\
931 Please enter selection: "
934 The April 1994 Snapshot will now be installed on your system.\n"
938 The contents of the following existing directories will be completely replaced:
942 \nThe following existing symbolic links will be replaced:\n\n"
946 0) Continue with Desktop Installation\n\
947 99) Exit Desktop Installation\n\
949 Please enter selection: "
952 WARNING! Advise all CDE users on the system to remove or rename their
953 \$HOME/.dt directory and their \$HOME/.dtprofile. The April 1994 Desktop
954 is not compatible with the October 1993 Desktop versions of these files.
956 If users have customized the \$HOME/.dt/dtwmrc file and want to keep
957 it, they will need to cut and paste the appropriate pieces into the new
960 Please see the '%s' file on this CDROM for more information.
962 0) Continue with Desktop Installation
963 99) Exit Desktop Installation
965 Please enter selection: "
968 The current installation 'root' for the desktop is '%s',
969 which means the desktop will be installed in the following directories:
975 To specify a different directory, enter a full directory pathname
976 below. Simply press enter to keep the current installation root.
978 The directory you specify must:
980 * Be an absolute path (i.e. start with a '/')
981 * Be an existing directory
982 * Have approximately %sMB of free space\n\n"
985 Please enter directory name or leave blank to keep the current name
988 XCOMM ==========================================================================
994 XCOMM $state - current state
996 XCOMM $laststate - saved current state
997 XCOMM $state - new state
1000 XCOMM ==========================================================================
1008 XCOMM ==========================================================================
1010 XCOMM DtiPrint - echo to stderr and log
1013 XCOMM $1 - data to echo to stdout and log
1016 XCOMM ==========================================================================
1020 printf "$1" $2 $3 $4 $5 $6 $7 $8 $9 >&2
1021 Log "$1" $2 $3 $4 $5 $6 $7 $8 $9
1025 XCOMM =========================================================================
1027 XCOMM ResolvePathName
1033 XCOMM =========================================================================
1036 if [ "/" = "$1" ]; then
1038 elif [ -L $1 ]; then
1039 ResolvePathName `/bin/ls -l $1 | awk '{print $NF}'` $2
1040 else ResolvePathName `dirname $1` `basename $1`${2+/}$2
1045 XCOMM ==========================================================================
1047 XCOMM DtiReturn - return a string to stdout
1050 XCOMM $1 - data to return
1053 XCOMM ==========================================================================
1060 XCOMM ==========================================================================
1065 XCOMM $laststate - previous state
1066 XCOMM $state - current state
1070 XCOMM ==========================================================================
1074 DtiPrint "Fatal error: unexpected state transition $laststate --> $state\n"
1075 Exit "Fatal error: unexpected state transition $laststate --> $state\n"
1078 XCOMM ==========================================================================
1085 XCOMM ==========================================================================
1089 DTIINSTALLDT=install.dt
1090 DTIINSTALLCDE=install.cde
1092 DTIINSTALLDTO=install.dto
1102 dtiPlatform=$(GetPlatform)
1103 DTIPLATFORMDIR=$dtiPlatform
1104 DTIREADME=config/config.$dtiPlatform
1108 dtiLogFile="/tmp/install.dt.log"
1113 XCOMM change directories to install.dt location as all
1114 XCOMM installation packages are relative to this
1117 if [ ${0##STAR/} != $DTIINSTALLDT ]; then
1119 HASH CDROM driver folds filenames to uppercase
1121 typeset -u DTIINSTALLDT
1122 typeset -u DTIINSTALLCDE
1123 typeset -u DTIPACKAGE
1124 typeset -u DTIINSTALLDTO
1125 typeset -u DTICONFIGDIR
1126 typeset -u DTIPLATFORMDIR
1127 typeset -u DTIREADME
1130 if [ ${0%/STAR} != $DTIINSTALLDT ]; then
1135 XCOMM source in possible platform overrides for certain functions
1137 XCOMM DtiClearScreen
1139 XCOMM DtiVerifyConfiguration
1142 if [ -d "$(pwd)/$DTIPLATFORMDIR" ]; then
1143 if [ -f $(pwd)/$DTIPLATFORMDIR/$DTIINSTALLDTO ]; then
1144 . $(pwd)/$DTIPLATFORMDIR/$DTIINSTALLDTO