Fix some minor issues and re-enable building of DE, ES, FR, and IT locale data (help...
[oweals/cde.git] / cde / admin / IntegTools / dbTools / dinstallCDE.src
1 XCOMM! /bin/ksh
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     $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     $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 = "UNIX_SV" ];
158   then
159     PLATFORM=usl
160     PLATFORM_SCRIPT_DIR=usl
161   elif [ $BUILDSYSTEM = "UNIX_System_V" ];
162   then
163     PLATFORM=uxp
164     PLATFORM_SCRIPT_DIR=uxp
165   elif [ $BUILDSYSTEM = "OSF1" ];
166   then
167     PLATFORM=dec
168     PLATFORM_SCRIPT_DIR=dec
169   else                  # Build system = HP
170     PLATFORM=hp-ux
171     PLATFORM_SCRIPT_DIR=hp
172   fi
173
174   if [ "$PLATFORM" = "aix" ];
175   then
176     USER=`/bin/whoami`
177   elif [ "$PLATFORM" = "sun" -o "$PLATFORM" = "usl" -o "$PLATFORM" = "uxp" ];
178   then
179     USER=`/usr/ucb/whoami`
180   else
181     USER=`/usr/bin/whoami`
182   fi
183
184   if [ "$USER" != "root" ];
185   then
186     USAGE
187     echo ""
188     echo "You must be root to run this script"
189     echo ""
190     exit 1
191   fi
192
193   PATH=/bin:/usr/bin:/etc:/usr/bin/X11:
194   export PATH
195
196   CLEANING="no"
197   CLEANING_ETC="no"
198   USE_ALTERNATE_UDB_DIR="no"
199   USE_RELATIVE="no"
200   STARTING_DIR=$PWD
201   DATABASE_FILES=""
202   LeaveLinks="no"
203   REMOVE_LINKS="no"
204   CLEAN_DAEMONS="yes"
205   theLang=""
206   DEVELOP_ENV="yes"
207   RUNTIME_ENV="yes"
208
209   rm -f /tmp/dinstallCDE.log
210
211   Log "Options specified..."
212   while [ $# -ne 0 ]; do
213     case $1 in
214         -a) Log "  - alternate place to get the udb files from"
215             shift;
216             [ $# -ne 0 ] || {
217                 USAGE
218                 exit 1;
219             }
220             ALTERNATE_UDB_DIR=$1
221             USE_ALTERNATE_UDB_DIR="yes"
222             shift;
223             ;;
224         -f) Log "  - load specific filesets"
225             shift;
226             [ $# -ne 0 ] || {
227                 USAGE
228                 exit 1;
229             }
230             DATABASE_FILES=$1
231             shift;
232             ;;
233         -clean) Log "  - delete all three cde directories"
234             CLEANING="yes"
235             CLEANING_ETC="yes"
236             shift;
237             ;;
238         -cleanVar) Log "  - delete only temporary and installation directories"
239             CLEANING="yes"
240             shift;
241             ;;
242         -relative) Log "  - run the relative-located config scripts"
243             USE_RELATIVE="yes"
244             shift;
245             ;;
246         -prog) Log "  - remove only the development environment"
247             RUNTIME_ENV="no"
248             shift;
249             ;;
250         -runtime) Log "  - remove only the runtime environment"
251             DEVELOP_ENV="no"
252             shift;
253             ;;
254         -lang) Log "  - configure backdrops and palettes for LANG"
255             shift;
256             [ $# -ne 0 ] || {
257                 USAGE
258                 exit 1;
259             }
260             theLang=$1
261             shift;
262             ;;
263         esac
264   done
265
266   echo ""
267
268   TOOL_DIR=$BUILD_TREE/admin/IntegTools/dbTools
269   if [ "$USE_RELATIVE" = "yes" ]
270   then
271     POST_INSTALL_DIR=../post_install
272   else
273     POST_INSTALL_DIR=$BUILD_TREE/admin/IntegTools/post_install
274   fi
275
276   if [ "$USE_ALTERNATE_UDB_DIR" = "yes" ]
277   then
278     DATABASE_DIR=$ALTERNATE_UDB_DIR/databases
279   else
280     DATABASE_DIR=$BUILD_TREE/databases
281   fi
282
283   if [ "$DATABASE_FILES" = "" ]
284   then
285     if [ "$DEVELOP_ENV" = "yes" -a "$RUNTIME_ENV" = "yes" ]
286     then
287       DATABASE_FILES="CDE-RUN CDE-MIN CDE-TT CDE-MAN CDE-HELP-RUN CDE-C \
288                       CDE-MSG-C CDE-HELP-C CDE-SHLIBS CDE-HELP-PRG \
289                       CDE-PRG CDE-INC CDE-DEMOS CDE-MAN-DEV CDE-ICONS \
290                       CDE-FONTS"
291     elif [ "$DEVELOP_ENV" = "yes" ]
292     then
293       DATABASE_FILES="CDE-HELP-PRG CDE-PRG CDE-INC CDE-DEMOS \
294                       CDE-MAN-DEV CDE-SHLIBS"
295     elif [ "$RUNTIME_ENV" = "yes" ]
296     then
297       DATABASE_FILES="CDE-RUN CDE-MIN CDE-TT CDE-MAN CDE-HELP-RUN CDE-C \
298                       CDE-HELP-C CDE-MSG-C CDE-SHLIBS CDE-ICONS CDE-FONTS"
299     fi
300   fi
301
302   INSTALL_LOCATION=CDE_INSTALLATION_TOP
303   CONFIGURE_LOCATION=CDE_CONFIGURATION_TOP
304   LOGFILES_LOCATION=CDE_LOGFILES_TOP
305
306   DoScripts
307   
308   echo "Done."
309   echo ""
310   echo "See /tmp/dinstallCDE.log for a log of this de-install session."
311   echo ""