Remove Unixware and openserver support
[oweals/cde.git] / cde / admin / IntegTools / dbTools / dinstallCDE.src
1 XCOMM! KORNSHELL
2 XCOMM $XConsortium: dinstallCDE.src /main/8 1996/11/25 14:20:36 drk $
3
4 XCOMM
5 XCOMM This script uses the 'CDE' configuration scripts to de-install the Desktop
6 XCOMM environment.
7 XCOMM
8 XCOMM this script accepts the following parameters:
9 XCOMM
10 XCOMM      Optional parameters:
11 XCOMM
12 XCOMM       -f  <filesets>                -- a quoted, space-separated list of 
13 XCOMM                                        filesets to unload. The .udb 
14 XCOMM                                        extension is not required.
15 XCOMM
16 XCOMM       -clean   -- remove the temporaray and configuration directories
17 XCOMM       -cleanVar-- remove the temporary directory but NOT the 
18 XCOMM                   configuration directory
19 XCOMM       -prog    -- load only the development environment
20 XCOMM       -runtime -- load only the runtime environment
21 XCOMM
22 XCOMM ##########################################################################
23
24 #define HASH #
25 #define STAR *
26
27 REVISION="$(echo "$Revision: /main/8 $" | awk '{print $2}')"
28
29 Log()
30 {
31     echo "$1" | tee -a /tmp/dinstallCDE.log
32 }
33
34 DoFilesetScript()
35 {
36   typeset ScriptName
37
38   FilesetName=$1
39   ScriptName=$2         # use long config file name (configFoo)
40
41   test_string=${DATABASE_FILES#*$FilesetName}
42   if (( ${#DATABASE_FILES} > ${#test_string} ))
43   then
44     if [ -x $POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName ]
45     then
46         Log "Executing $PLATFORM specific $FilesetName de-customize script"
47         $POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName -d 2>&1 | \
48                                 tee -a /tmp/$ScriptName.dverify
49     elif [ -x $POST_INSTALL_DIR/$ScriptName ]
50     then
51         Log "Executing $FilesetName de-customize script" 
52         $POST_INSTALL_DIR/$ScriptName -d 2>&1 | tee -a /tmp/$ScriptName.dverify
53     fi
54   fi
55 }
56
57 DoLangScript()
58 {
59   typeset ScriptName
60
61   if [ "$BUILD_TREE" = "" ]; then
62     ScriptName=$2       # use short config file name (foo.cfg)
63   else
64     ScriptName=$1       # use long config file name (configFoo)
65   fi
66
67   if [ $CDECONFIGDIR = "CONFIG" ]; then
68     typeset -u ScriptName
69   fi
70
71   if [ -x $POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName ]
72   then
73     Log "Executing $PLATFORM specific $FilesetName de-customize script"
74     KORNSHELL $POST_INSTALL_DIR/$PLATFORM_SCRIPT_DIR/$ScriptName -d $3 2>&1 | \
75                                 tee -a /tmp/$ScriptName.dverify
76   elif [ -x $POST_INSTALL_DIR/$ScriptName ]
77   then
78     Log "Executing $FilesetName de-customize script" 
79     KORNSHELL $POST_INSTALL_DIR/$ScriptName -d $3 2>&1 | tee -a /tmp/$ScriptName.dverify
80   fi
81 }
82
83 DoScripts()
84 {
85   Log " "
86
87   DoFilesetScript CDE-TT       configTT      tt.cfg
88   DoFilesetScript CDE-MIN      configMin     min.cfg
89   DoFilesetScript CDE-RUN      configRun     run.cfg
90   DoFilesetScript CDE-HELP-C   configHelp    help.cfg
91   DoFilesetScript CDE-HELP-PRG configHelpPrg helpprg.cfg
92   DoFilesetScript CDE-HELP-RUN configHelpRun helprun.cfg
93   DoFilesetScript CDE-SHLIBS   configShlibs  shlibs.cfg
94   DoFilesetScript CDE-DEMOS    configDemos   demos.cfg
95   DoFilesetScript CDE-FONTS    configFonts   fonts.cfg
96   DoFilesetScript CDE-ICONS    configIcons   icons.cfg
97   DoFilesetScript CDE-INC      configInc     inc.cfg
98   DoFilesetScript CDE-MAN      configMan     man.cfg
99   DoFilesetScript CDE-MAN-DEV  configManDev  mandev.cfg
100   DoFilesetScript CDE-MSG-C    configMsgCat  msgcat.cfg
101   DoFilesetScript CDE-PRG      configPrg     prg.cfg
102
103   HASH see if a lang has been specified and configure backdrops and
104   HASH palettes if it has.
105
106   if [ "$LangOption" != "" ]
107   then
108     DoLangScript configLang lang.cfg $theLang
109   fi
110
111 }
112
113 USAGE()
114 {
115 echo "Usage: $(basename $0) [options]"
116 echo ""
117 echo "\tOptions:"
118 echo ""
119 echo "\t[-a <udb directory>]\t\talternate place to get the"
120 echo "\t\t\t\t\tudb files from."
121 echo "\t[-f <filesets>]\t\t\tspecify filesets to be unloaded."
122 echo "\t\t\t\t\tThe list should be double-quoted,"
123 echo "\t\t\t\t\tspace-separated, with no .udb"
124 echo "\t\t\t\t\textensions."
125 echo ""
126 echo "\t[-clean]\t\t\tremove the temporary and configuration"
127 echo "\t\t\t\t\tdirectories"
128 echo "\t[-cleanVar]\t\t\tremove the temporary but NOT the "
129 echo "\t\t\t\t\tconfiguration directory"
130 echo "\t[-prog]\t\t\t\tload only the development environment"
131 echo "\t[-runtime]\t\t\tload only the runtime environment"
132 echo "\t[-relative]\t\t\trun the relative-located config scripts"
133 echo "\t[-lang LANG]\t\t\tspecify LANG to use for backdrops and"
134 echo "\t\t\t\t\tpalettes"
135 echo ""
136 }
137
138 ORIGINAL_COMMAND_LINE="$*"
139
140 XCOMM Set which system we are on
141 BUILDSYSTEM=$(uname)
142
143 PLATFORM=""
144 PLATFORM_SCRIPT_DIR=""
145
146 XCOMM
147 XCOMM Set system
148 XCOMM 
149   if [ $BUILDSYSTEM = "AIX" ];
150   then
151     PLATFORM=aix
152     PLATFORM_SCRIPT_DIR=ibm
153   elif [ $BUILDSYSTEM = "SunOS" ];
154   then
155     PLATFORM=sun
156     PLATFORM_SCRIPT_DIR=sun
157   elif [ $BUILDSYSTEM = "OSF1" ];
158   then
159     PLATFORM=dec
160     PLATFORM_SCRIPT_DIR=dec
161   else                  # Build system = HP
162     PLATFORM=hp-ux
163     PLATFORM_SCRIPT_DIR=hp
164   fi
165
166   if [ "$PLATFORM" = "aix" ];
167   then
168     USER=`/bin/whoami`
169   elif [ "$PLATFORM" = "sun" ];
170   then
171     USER=`/usr/ucb/whoami`
172   else
173     USER=`/usr/bin/whoami`
174   fi
175
176   if [ "$USER" != "root" ];
177   then
178     USAGE
179     echo ""
180     echo "You must be root to run this script"
181     echo ""
182     exit 1
183   fi
184
185   PATH=/bin:/usr/bin:/etc:/usr/bin/X11:
186   export PATH
187
188   CLEANING="no"
189   CLEANING_ETC="no"
190   USE_ALTERNATE_UDB_DIR="no"
191   USE_RELATIVE="no"
192   STARTING_DIR=$PWD
193   DATABASE_FILES=""
194   LeaveLinks="no"
195   REMOVE_LINKS="no"
196   CLEAN_DAEMONS="yes"
197   theLang=""
198   DEVELOP_ENV="yes"
199   RUNTIME_ENV="yes"
200
201   rm -f /tmp/dinstallCDE.log
202
203   Log "Options specified..."
204   while [ $# -ne 0 ]; do
205     case $1 in
206         -a) Log "  - alternate place to get the udb files from"
207             shift;
208             [ $# -ne 0 ] || {
209                 USAGE
210                 exit 1;
211             }
212             ALTERNATE_UDB_DIR=$1
213             USE_ALTERNATE_UDB_DIR="yes"
214             shift;
215             ;;
216         -f) Log "  - load specific filesets"
217             shift;
218             [ $# -ne 0 ] || {
219                 USAGE
220                 exit 1;
221             }
222             DATABASE_FILES=$1
223             shift;
224             ;;
225         -clean) Log "  - delete all three cde directories"
226             CLEANING="yes"
227             CLEANING_ETC="yes"
228             shift;
229             ;;
230         -cleanVar) Log "  - delete only temporary and installation directories"
231             CLEANING="yes"
232             shift;
233             ;;
234         -relative) Log "  - run the relative-located config scripts"
235             USE_RELATIVE="yes"
236             shift;
237             ;;
238         -prog) Log "  - remove only the development environment"
239             RUNTIME_ENV="no"
240             shift;
241             ;;
242         -runtime) Log "  - remove only the runtime environment"
243             DEVELOP_ENV="no"
244             shift;
245             ;;
246         -lang) Log "  - configure backdrops and palettes for LANG"
247             shift;
248             [ $# -ne 0 ] || {
249                 USAGE
250                 exit 1;
251             }
252             theLang=$1
253             shift;
254             ;;
255         esac
256   done
257
258   echo ""
259
260   TOOL_DIR=$BUILD_TREE/admin/IntegTools/dbTools
261   if [ "$USE_RELATIVE" = "yes" ]
262   then
263     POST_INSTALL_DIR=../post_install
264   else
265     POST_INSTALL_DIR=$BUILD_TREE/admin/IntegTools/post_install
266   fi
267
268   if [ "$USE_ALTERNATE_UDB_DIR" = "yes" ]
269   then
270     DATABASE_DIR=$ALTERNATE_UDB_DIR/databases
271   else
272     DATABASE_DIR=$BUILD_TREE/databases
273   fi
274
275   if [ "$DATABASE_FILES" = "" ]
276   then
277     if [ "$DEVELOP_ENV" = "yes" -a "$RUNTIME_ENV" = "yes" ]
278     then
279       DATABASE_FILES="CDE-RUN CDE-MIN CDE-TT CDE-MAN CDE-HELP-RUN CDE-C \
280                       CDE-MSG-C CDE-HELP-C CDE-SHLIBS CDE-HELP-PRG \
281                       CDE-PRG CDE-INC CDE-DEMOS CDE-MAN-DEV CDE-ICONS \
282                       CDE-FONTS"
283     elif [ "$DEVELOP_ENV" = "yes" ]
284     then
285       DATABASE_FILES="CDE-HELP-PRG CDE-PRG CDE-INC CDE-DEMOS \
286                       CDE-MAN-DEV CDE-SHLIBS"
287     elif [ "$RUNTIME_ENV" = "yes" ]
288     then
289       DATABASE_FILES="CDE-RUN CDE-MIN CDE-TT CDE-MAN CDE-HELP-RUN CDE-C \
290                       CDE-HELP-C CDE-MSG-C CDE-SHLIBS CDE-ICONS CDE-FONTS"
291     fi
292   fi
293
294   INSTALL_LOCATION=CDE_INSTALLATION_TOP
295   CONFIGURE_LOCATION=CDE_CONFIGURATION_TOP
296   LOGFILES_LOCATION=CDE_LOGFILES_TOP
297
298   DoScripts
299   
300   echo "Done."
301   echo ""
302   echo "See /tmp/dinstallCDE.log for a log of this de-install session."
303   echo ""