author | ca |
Tue, 04 Mar 1997 12:29:48 +0100 | |
changeset 79 | 33212fbe9766 |
parent 73 | 2087134eea96 |
child 117 | 45af2b7a5eca |
permissions | -rw-r--r-- |
0 | 1 |
Object subclass:#STXInstaller |
24 | 2 |
instanceVariableNames:'stxLibDir stxLibBinDir stxBinDir installDocFiles |
3 |
installSourceFiles installSTCFiles installGoodyFiles |
|
4 |
actionPercentageHolder actionTextHolder commandTraceView |
|
5 |
resources' |
|
6 |
classVariableNames:'LastBinDir LastLibBinDir LastLibDir' |
|
0 | 7 |
poolDictionaries:'' |
8 |
category:'eXept-tools' |
|
9 |
! |
|
10 |
||
11 |
||
28 | 12 |
!STXInstaller class methodsFor:'startup'! |
0 | 13 |
|
14 |
open |
|
15 |
^ self new open |
|
16 |
||
11 | 17 |
" |
18 |
STXInstaller open |
|
19 |
" |
|
1 | 20 |
! ! |
21 |
||
22 |
!STXInstaller methodsFor:'defaults'! |
|
23 |
||
24 |
defaultBinDirs |
|
25 |
|dirs| |
|
26 |
||
27 |
dirs := OrderedCollection new. |
|
28 |
dirs add:'/usr/local/bin'. |
|
29 |
dirs add:'/usr/bin'. |
|
30 |
dirs add:(Filename homeDirectory constructString:'bin'). |
|
14 | 31 |
dirs add:((Filename homeDirectory |
32 |
construct:'stx') |
|
33 |
constructString:'bin'). |
|
1 | 34 |
dirs add:'/tmp/stxbin'. |
3 | 35 |
('/home' asFilename exists and:['/home' asFilename isDirectory]) ifTrue:[ |
36 |
dirs add:'/home/stx/bin'. |
|
37 |
]. |
|
38 |
('/home2' asFilename exists and:['/home2' asFilename isDirectory]) ifTrue:[ |
|
39 |
dirs add:'/home2/stx/bin'. |
|
40 |
]. |
|
41 |
||
42 |
"/ dirs := dirs select:[:path | |
|
43 |
"/ |f| |
|
44 |
"/ |
|
45 |
"/ f := path asFilename. |
|
46 |
"/ f exists and:[f isDirectory]]. |
|
47 |
^ dirs sort |
|
1 | 48 |
|
49 |
"Created: 18.7.1996 / 19:43:00 / cg" |
|
50 |
"Modified: 18.7.1996 / 19:45:08 / cg" |
|
51 |
! |
|
52 |
||
24 | 53 |
defaultLibBinDirs |
54 |
|dirs| |
|
55 |
||
56 |
dirs := OrderedCollection new. |
|
57 |
dirs add:'/usr/local/lib'. |
|
58 |
dirs add:'/usr/lib'. |
|
59 |
dirs add:'/lib'. |
|
60 |
dirs add:(Filename homeDirectory |
|
61 |
constructString:'lib'). |
|
62 |
||
63 |
dirs add:((Filename homeDirectory |
|
64 |
construct:'stx') |
|
65 |
constructString:'lib'). |
|
66 |
dirs add:'/tmp/stxlib'. |
|
67 |
dirs add:'/home/stx/lib'. |
|
68 |
dirs add:'/home2/stx/lib'. |
|
69 |
||
70 |
^ dirs sort |
|
71 |
||
72 |
"Created: 18.7.1996 / 19:43:21 / cg" |
|
73 |
"Modified: 18.7.1996 / 19:46:04 / cg" |
|
74 |
! |
|
75 |
||
1 | 76 |
defaultLibDirs |
77 |
|dirs| |
|
78 |
||
79 |
dirs := OrderedCollection new. |
|
80 |
dirs add:'/usr/local/lib/smalltalk'. |
|
81 |
dirs add:'/usr/lib/smalltalk'. |
|
82 |
dirs add:((Filename homeDirectory |
|
83 |
construct:'lib') |
|
84 |
constructString:'smalltalk'). |
|
15 | 85 |
dirs add:((Filename homeDirectory |
86 |
construct:'stx') |
|
87 |
constructString:'lib'). |
|
1 | 88 |
dirs add:'/tmp/stxlib'. |
89 |
dirs add:'/home/stx/lib'. |
|
90 |
dirs add:'/home2/stx/lib'. |
|
3 | 91 |
|
92 |
"/ dirs := dirs select:[:path | |
|
93 |
"/ |f| |
|
94 |
"/ |
|
95 |
"/ f := path asFilename. |
|
96 |
"/ f exists and:[f isDirectory]]. |
|
97 |
^ dirs sort |
|
1 | 98 |
|
99 |
"Created: 18.7.1996 / 19:43:21 / cg" |
|
100 |
"Modified: 18.7.1996 / 19:46:04 / cg" |
|
11 | 101 |
! |
0 | 102 |
|
11 | 103 |
directoriesToMake |
104 |
|dirsToMake| |
|
0 | 105 |
|
11 | 106 |
dirsToMake := OrderedCollection new. |
107 |
dirsToMake add:stxBinDir. |
|
108 |
dirsToMake add:stxLibDir. |
|
24 | 109 |
dirsToMake add:stxLibBinDir. |
110 |
dirsToMake add:(stxLibDir asFilename constructString:'configurations'). |
|
11 | 111 |
dirsToMake add:(stxLibDir asFilename constructString:'doc'). |
12
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
112 |
dirsToMake add:(stxLibDir asFilename constructString:'doc/online'). |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
113 |
dirsToMake add:(stxLibDir asFilename constructString:'doc/online/english'). |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
114 |
dirsToMake add:(stxLibDir asFilename constructString:'doc/online/german'). |
19 | 115 |
dirsToMake add:(stxLibDir asFilename constructString:'doc/online/french'). |
116 |
dirsToMake add:(stxLibDir asFilename constructString:'doc/online/italian'). |
|
11 | 117 |
dirsToMake add:(stxLibDir asFilename constructString:'include'). |
118 |
dirsToMake add:(stxLibDir asFilename constructString:'resources'). |
|
119 |
dirsToMake add:(stxLibDir asFilename constructString:'binary'). |
|
120 |
dirsToMake add:(stxLibDir asFilename constructString:'bitmaps'). |
|
121 |
dirsToMake add:(stxLibDir asFilename constructString:'goodies'). |
|
0 | 122 |
|
11 | 123 |
^ dirsToMake |
124 |
! |
|
125 |
||
73 | 126 |
listOfOptionalPackages |
127 |
^ #( |
|
128 |
'libDB' |
|
129 |
'clients/CBrowser' |
|
130 |
'libtool2' |
|
131 |
'libcompat' |
|
132 |
'libui' |
|
133 |
'libxt' |
|
134 |
||
135 |
||
136 |
"/ mhmh - these should not be needed here ... |
|
137 |
||
138 |
'projects/smalltalk/bitmaps/javaImages' |
|
139 |
'doc/online/english/overview/icons' |
|
140 |
) |
|
141 |
||
142 |
"Created: 2.3.1997 / 12:39:59 / cg" |
|
143 |
"Modified: 2.3.1997 / 13:24:41 / cg" |
|
144 |
! |
|
145 |
||
11 | 146 |
specOfFilesToCopy |
147 |
|fileSpec| |
|
0 | 148 |
|
149 |
fileSpec := #( |
|
27 | 150 |
"/ name destination subDir required mode |
12
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
151 |
( 'projects/smalltalk/smalltalk' #bin nil true '755' ) |
27 | 152 |
( 'projects/smalltalk/stx' #bin nil true '755' ) |
12
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
153 |
( 'projects/smalltalk/include' #lib nil true '644' ) |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
154 |
( 'projects/smalltalk/*.rc' #lib nil true '644' ) |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
155 |
( 'projects/smalltalk/patches' #lib nil true '644' ) |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
156 |
( 'projects/smalltalk/bitmaps' #lib nil true '644' ) |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
157 |
( 'projects/smalltalk/resources' #lib nil true '644' ) |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
158 |
( 'projects/smalltalk/lib' #lib nil true '644' ) |
16 | 159 |
( 'doc/online/german/LICENCE.STX.html' #lib 'doc/online/german' true '644' ) |
19 | 160 |
"/ ( 'doc/online/english/LICENCE.STX.html' #lib 'doc/online/english' true '644' ) |
5 | 161 |
). |
0 | 162 |
|
5 | 163 |
installDocFiles ifTrue:[ |
164 |
fileSpec := fileSpec , #( |
|
24 | 165 |
( 'doc' #lib nil false '644' ) |
5 | 166 |
). |
167 |
]. |
|
168 |
||
9 | 169 |
installSourceFiles ifTrue:[ |
170 |
fileSpec := fileSpec , #( |
|
24 | 171 |
( 'projects/smalltalk/source' #lib nil false '644' ) |
9 | 172 |
). |
173 |
]. |
|
174 |
||
5 | 175 |
installSTCFiles ifTrue:[ |
176 |
fileSpec := fileSpec , #( |
|
24 | 177 |
( 'stc/stc' #bin nil false '755' ) |
178 |
( 'rules/stmkmp' #bin nil false '755' ) |
|
179 |
( 'rules/stmkmf' #bin nil false '755' ) |
|
180 |
( 'include' #lib nil false '644' ) |
|
181 |
( 'configurations' #lib nil false '644' ) |
|
182 |
( 'configurations/PACKS' #lib 'configurations' false '644' ) |
|
183 |
( 'configurations/my*' #lib 'configurations' false '644' ) |
|
184 |
( 'configurations/vendor*' #lib 'configurations' false '644' ) |
|
185 |
( 'rules' #lib nil false '644' ) |
|
5 | 186 |
|
24 | 187 |
( 'support/VGL/vogl/src/libvogl.*' #lib 'lib' false '644' ) |
188 |
( 'support/VGL/vogl/src/*.h' #lib 'include' false '644' ) |
|
189 |
( 'support/DLD/dld-3.2.5/libdld.*' #lib 'lib' false '644' ) |
|
190 |
( 'goodies/persistency/db-1.6/PORT/libdb.*' #lib 'lib' false '644' ) |
|
0 | 191 |
|
24 | 192 |
( 'librun/librun.*' #libBin nil false '644' ) |
193 |
( 'libbasic/libbasic.*' #libBin nil false '644' ) |
|
194 |
( 'libbasic2/libbasic2.*' #libBin nil false '644' ) |
|
195 |
( 'libbasic3/libbasic3.*' #libBin nil false '644' ) |
|
196 |
( 'libhtml/libhtml.*' #libBin nil false '644' ) |
|
197 |
( 'libcomp/libcomp.*' #libBin nil false '644' ) |
|
198 |
( 'libview/libview.*' #libBin nil false '644' ) |
|
199 |
( 'libview2/libview2.*' #libBin nil false '644' ) |
|
200 |
( 'libwidg/libwidg.*' #libBin nil false '644' ) |
|
201 |
( 'libwidg2/libwidg2.*' #libBin nil false '644' ) |
|
202 |
( 'libwidg3/libwidg3.*' #libBin nil false '644' ) |
|
27 | 203 |
"/ ( 'libsnmp/libsnmp.*' #libBin nil false '644' ) |
204 |
"/ ( 'contrib/libPVM/libPVM.*' #libBin nil false '644' ) |
|
24 | 205 |
( 'goodies/persistency/libdbase.*' #libBin nil false '644' ) |
27 | 206 |
"/ ( 'libtable/libtable.*' #libBin nil false '644' ) |
24 | 207 |
( 'libtool/libtool.*' #libBin nil false '644' ) |
27 | 208 |
"/ ( 'libxt/libxt.*' #libBin nil false '644' ) |
209 |
"/ ( 'librt/librt.*' #libBin nil false '644' ) |
|
5 | 210 |
). |
211 |
]. |
|
0 | 212 |
|
5 | 213 |
installGoodyFiles ifTrue:[ |
214 |
fileSpec := fileSpec , #( |
|
215 |
( 'goodies/*.st' #lib 'goodies' false '644' ) |
|
216 |
( 'goodies/*.chg' #lib 'goodies' false '644' ) |
|
217 |
( 'goodies/rdoit/rdoit' #bin nil false '755' ) |
|
218 |
). |
|
219 |
]. |
|
0 | 220 |
|
11 | 221 |
|
222 |
^ fileSpec |
|
223 |
||
224 |
! ! |
|
225 |
||
226 |
!STXInstaller methodsFor:'installing'! |
|
227 |
||
228 |
copyFiles |
|
229 |
|msg fileSpec filesToCopy numFiles nDone| |
|
230 |
||
231 |
msg := (resources array:#('ST/X Installation' '' 'copying:' '' 'to:' '')) asStringCollection. |
|
232 |
||
233 |
fileSpec := self specOfFilesToCopy. |
|
234 |
||
0 | 235 |
filesToCopy := OrderedCollection new. |
236 |
||
237 |
fileSpec do:[:entry | |
|
8 | 238 |
|fileNames dest subDir required destDir| |
0 | 239 |
|
8 | 240 |
fileNames := entry at:1. |
0 | 241 |
dest := entry at:2. |
242 |
subDir := entry at:3. |
|
243 |
required := entry at:4. |
|
244 |
||
245 |
dest == #bin ifTrue:[ |
|
246 |
destDir := stxBinDir |
|
247 |
] ifFalse:[ |
|
24 | 248 |
dest == #libBin ifTrue:[ |
249 |
destDir := stxLibBinDir |
|
250 |
] ifFalse:[ |
|
251 |
destDir := stxLibDir |
|
252 |
] |
|
0 | 253 |
]. |
254 |
||
255 |
destDir := destDir asFilename. |
|
256 |
subDir notNil ifTrue:[ |
|
257 |
destDir := destDir construct:subDir |
|
258 |
]. |
|
259 |
||
8 | 260 |
filesToCopy add:(fileNames -> destDir pathName) |
0 | 261 |
]. |
262 |
||
263 |
numFiles := filesToCopy size. |
|
264 |
nDone := 0. |
|
265 |
||
266 |
filesToCopy do:[:entry | |
|
11 | 267 |
|fileName destDir cmd p text line doneSemaphore| |
0 | 268 |
|
269 |
fileName := entry key. |
|
270 |
destDir := entry value. |
|
271 |
||
8 | 272 |
((fileName includes:$*) |
273 |
or:[('../../' , fileName) asFilename exists])ifTrue:[ |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
274 |
actionPercentageHolder value:(nDone / numFiles * 100) rounded. |
0 | 275 |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
276 |
msg at:4 put:' ' , (fileName asText allBold). |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
277 |
msg at:6 put:' ' , (destDir asText allBold). |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
278 |
actionTextHolder value:nil. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
279 |
actionTextHolder value:msg. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
280 |
|
73 | 281 |
((fileName includes:$*) not |
282 |
and:[('../../' , fileName) asFilename exists not]) ifTrue:[ |
|
283 |
(self listOfOptionalPackages includes:fileName) ifFalse:[ |
|
284 |
commandTraceView showCR:('cannot copy ' , fileName , ' - not included in distribution') |
|
285 |
] |
|
286 |
] ifFalse:[ |
|
287 |
cmd := 'cp -r ../../' , fileName , ' ' , destDir. |
|
288 |
commandTraceView showCR:cmd , ' ...'. |
|
289 |
cmd := cmd , ' 2>&1' . |
|
1 | 290 |
|
73 | 291 |
doneSemaphore := Semaphore new. |
11 | 292 |
|
73 | 293 |
[ |
11 | 294 |
|
73 | 295 |
p := PipeStream readingFrom:cmd. |
296 |
p isNil ifTrue:[ |
|
297 |
self warn:('command error. Could not execute:\\' , cmd) withCRs. |
|
298 |
] ifFalse:[ |
|
299 |
[p atEnd] whileFalse:[ |
|
300 |
(p readWaitWithTimeout:0.1) ifFalse:[ |
|
301 |
line := p nextLine. |
|
302 |
(line notNil and:[line notEmpty]) ifTrue:[ |
|
303 |
commandTraceView showCR:((' ' , line) asText emphasizeAllWith:(#color->Color red)). |
|
304 |
] |
|
30 | 305 |
] |
73 | 306 |
]. |
307 |
p close. |
|
11 | 308 |
]. |
73 | 309 |
doneSemaphore signal. |
310 |
] forkAt:4. |
|
11 | 311 |
|
73 | 312 |
doneSemaphore wait. |
313 |
] |
|
1 | 314 |
]. |
0 | 315 |
|
316 |
nDone := nDone + 1 |
|
317 |
]. |
|
318 |
||
319 |
^ true |
|
320 |
||
321 |
"Created: 17.7.1996 / 15:16:20 / cg" |
|
73 | 322 |
"Modified: 2.3.1997 / 12:43:47 / cg" |
0 | 323 |
! |
324 |
||
325 |
createDirectories |
|
326 |
|msg dirsToMake numDirs nDone| |
|
327 |
||
11 | 328 |
msg := (resources array:#('ST/X Installation' '' 'creating directory:' '' '' '')) asStringCollection. |
0 | 329 |
|
11 | 330 |
dirsToMake := self directoriesToMake. |
0 | 331 |
|
332 |
numDirs := dirsToMake size. |
|
333 |
nDone := 0. |
|
334 |
||
335 |
dirsToMake do:[:dirName | |
|
336 |
|d errMsg stop box| |
|
337 |
||
338 |
actionPercentageHolder value:(nDone / numDirs * 100) rounded. |
|
339 |
||
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
340 |
msg at:4 put:' ' , (dirName asText allBold). |
0 | 341 |
actionTextHolder value:nil. |
342 |
actionTextHolder value:msg. |
|
343 |
||
344 |
d := dirName asFilename. |
|
345 |
||
11 | 346 |
commandTraceView showCR:(resources string:'creating %1 ...' with:d pathName). |
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
347 |
|
0 | 348 |
d exists ifFalse:[ |
349 |
OperatingSystem recursiveCreateDirectory:d pathName |
|
350 |
]. |
|
351 |
||
352 |
d exists ifFalse:[ |
|
11 | 353 |
errMsg := resources string:'failed to create directory: %1' with: dirName. |
0 | 354 |
stop := true |
355 |
] ifTrue:[ |
|
356 |
d isDirectory ifFalse:[ |
|
11 | 357 |
errMsg := resources string:'not a directory: %1' with:dirName. |
0 | 358 |
stop := true |
359 |
] ifTrue:[ |
|
360 |
(d isReadable |
|
361 |
and:[d isWritable]) ifFalse:[ |
|
11 | 362 |
errMsg := resources string:'no read/write access to directory: %1' with:dirName. |
0 | 363 |
stop := false |
364 |
] ifTrue:[ |
|
365 |
errMsg := nil |
|
366 |
] |
|
367 |
] |
|
368 |
]. |
|
369 |
||
370 |
errMsg notNil ifTrue:[ |
|
371 |
box := WarningBox new. |
|
372 |
box title:errMsg. |
|
373 |
box showAtPointerNotCovering:(WindowGroup activeGroup topViews first). |
|
1 | 374 |
stop ifTrue:[^ false]. |
0 | 375 |
]. |
376 |
||
377 |
Delay waitForSeconds:0.25. |
|
378 |
nDone := nDone + 1. |
|
379 |
]. |
|
380 |
^ true |
|
381 |
||
382 |
"Created: 17.7.1996 / 15:24:19 / cg" |
|
1 | 383 |
"Modified: 18.7.1996 / 22:18:38 / cg" |
19 | 384 |
! |
385 |
||
386 |
createSymbolicLinks |
|
387 |
|msg dirsToMake numDirs nDone| |
|
388 |
||
389 |
msg := (resources array:#('ST/X Installation' '' 'creating symbolic links' '' '' '')) asStringCollection. |
|
390 |
||
28 | 391 |
commandTraceView showCR:(resources string:'setting up symbolic links in doc/online ...'). |
29 | 392 |
OperatingSystem executeCommand:('(cd ' , stxLibDir , '/doc/online ; make links)'). |
19 | 393 |
^ true |
394 |
||
395 |
"Created: 17.7.1996 / 15:24:19 / cg" |
|
396 |
"Modified: 18.7.1996 / 22:18:38 / cg" |
|
73 | 397 |
! |
398 |
||
399 |
outputInitialMessage |
|
400 |
#( |
|
401 |
'Notice:' |
|
402 |
'' |
|
403 |
'During the installation, you may get error messages' |
|
404 |
'complaining that some files where not found' |
|
405 |
'and could therefore not be copied.' |
|
406 |
) do:[:line | |
|
407 |
commandTraceView showCR:((resources string:line) asText emphasizeAllWith:(#color->Color blue)). |
|
408 |
commandTraceView endEntry. |
|
409 |
]. |
|
410 |
||
411 |
Delay waitForSeconds:2. |
|
412 |
||
413 |
#( |
|
414 |
'' |
|
415 |
'This is normal behavior; since the CD may contain' |
|
416 |
'broken symbolic links to non-existing packages' |
|
417 |
'which are either not contained on your ordered' |
|
418 |
'package (i.e. non-commercial) or not yet published by eXept.' |
|
419 |
) do:[:line | |
|
420 |
commandTraceView showCR:((resources string:line) asText emphasizeAllWith:(#color->Color blue)). |
|
421 |
commandTraceView endEntry. |
|
422 |
]. |
|
423 |
||
424 |
Delay waitForSeconds:2. |
|
425 |
||
426 |
#( |
|
427 |
'' |
|
428 |
'Please excuse this inconvenience.' |
|
429 |
'' |
|
430 |
) do:[:line | |
|
431 |
commandTraceView showCR:((resources string:line) asText emphasizeAllWith:(#color->Color blue)). |
|
432 |
commandTraceView endEntry. |
|
433 |
]. |
|
434 |
||
435 |
Delay waitForSeconds:2. |
|
436 |
||
437 |
"Created: 2.3.1997 / 12:49:52 / cg" |
|
438 |
"Modified: 2.3.1997 / 13:22:45 / cg" |
|
0 | 439 |
! ! |
440 |
||
441 |
!STXInstaller methodsFor:'startup'! |
|
442 |
||
443 |
askAndInstall |
|
444 |
"/ check, if we are in the projects/smalltalk directory |
|
445 |
||
11 | 446 |
resources := ResourcePack for:self class. |
447 |
||
0 | 448 |
(Filename currentDirectory pathName endsWith:'projects/smalltalk') ifFalse:[ |
11 | 449 |
self warn:(resources string:'must be in the ''projects/smalltalk'' directory'). |
0 | 450 |
^ self |
451 |
]. |
|
452 |
||
453 |
[self askForDestination] whileTrue:[ |
|
73 | 454 |
self checkForExistingInstallationAndConfirm ifTrue:[ |
455 |
self preInstall. |
|
456 |
self doInstall ifTrue:[ |
|
457 |
self postInstall. |
|
458 |
^ self |
|
459 |
]. |
|
460 |
(self confirm:(resources string:'installation failed or aborted - retry ?')) |
|
461 |
ifFalse:[ |
|
462 |
^ self |
|
463 |
] |
|
0 | 464 |
] |
465 |
]. |
|
466 |
||
73 | 467 |
"Modified: 2.3.1997 / 13:46:23 / cg" |
0 | 468 |
! |
469 |
||
470 |
askForDestination |
|
471 |
"open a dialog to enter destination directories" |
|
472 |
||
2 | 473 |
|d cm l green dark img |
24 | 474 |
stxLibDirHolder stxLibBinDirHolder stxBinDirHolder |
5 | 475 |
installDocHolder installSourceHolder installSTCHolder installGoodiesHolder |
73 | 476 |
binMegabytes libMegabytes docMegabytes stcMegabytes srcMegabytes |
0 | 477 |
| |
478 |
||
11 | 479 |
binMegabytes := 10. |
73 | 480 |
libMegabytes := 30. |
481 |
docMegabytes := 11. |
|
482 |
stcMegabytes := 1. |
|
483 |
srcMegabytes := 15. |
|
11 | 484 |
|
0 | 485 |
LastLibDir isNil ifTrue:[ |
486 |
LastLibDir := '/usr/local/lib/smalltalk' |
|
487 |
]. |
|
24 | 488 |
LastLibBinDir isNil ifTrue:[ |
489 |
LastLibBinDir := '/usr/local/lib' |
|
490 |
]. |
|
0 | 491 |
LastBinDir isNil ifTrue:[ |
492 |
LastBinDir := '/usr/local/bin' |
|
493 |
]. |
|
494 |
||
495 |
stxLibDirHolder := LastLibDir asValue. |
|
24 | 496 |
stxLibBinDirHolder := LastLibBinDir asValue. |
0 | 497 |
stxBinDirHolder := LastBinDir asValue. |
24 | 498 |
|
5 | 499 |
installDocHolder := true asValue. |
500 |
installSourceHolder := true asValue. |
|
501 |
installSTCHolder := true asValue. |
|
502 |
installGoodiesHolder := true asValue. |
|
0 | 503 |
|
504 |
Screen current hasColors ifTrue:[ |
|
505 |
green := (Color red:0 green:80 blue:20) "darkened". |
|
506 |
dark := Color grey:10. |
|
507 |
] ifFalse:[ |
|
508 |
green := Color white. |
|
509 |
dark := Color black. |
|
510 |
]. |
|
511 |
||
512 |
d := DialogBox new. |
|
513 |
||
11 | 514 |
d label:(resources string:'ST/X CD Installation'). |
2 | 515 |
img := Image fromFile:'SmalltalkX.xbm'. |
516 |
||
517 |
l := d addTextLabel:img. |
|
518 |
l adjust:#left; foregroundColor:green backgroundColor:dark. |
|
519 |
||
11 | 520 |
l := d addTextLabel:(resources string:'Smalltalk/X CD installation.'). |
0 | 521 |
l adjust:#left; backgroundColor:dark; foregroundColor:Color white. |
522 |
d addVerticalSpace. |
|
523 |
d addVerticalSpace. |
|
524 |
||
525 |
d addHorizontalLine. |
|
526 |
||
11 | 527 |
l := d addTextLabel:(resources string:'Destination directories:'). |
0 | 528 |
l adjust:#left; backgroundColor:dark; foregroundColor:Color white. |
529 |
||
530 |
cm := ComboBoxView on:stxBinDirHolder. |
|
1 | 531 |
cm list:self defaultBinDirs. |
0 | 532 |
d |
533 |
addLabelledField:cm |
|
11 | 534 |
label:(resources string:'binaries') |
0 | 535 |
adjust:#left |
536 |
tabable:true |
|
537 |
from:0.0 to:1.0 separateAtX:0.25 |
|
538 |
nameAs:'binaryBox'. |
|
539 |
||
540 |
(d componentAt:'binaryBox.label') backgroundColor:dark; foregroundColor:Color white. |
|
541 |
||
24 | 542 |
cm := ComboBoxView on:stxLibBinDirHolder. |
543 |
cm list:self defaultLibBinDirs. |
|
544 |
d |
|
545 |
addLabelledField:cm |
|
546 |
label:(resources string:'libraries') |
|
547 |
adjust:#left |
|
548 |
tabable:true |
|
549 |
from:0.0 to:1.0 separateAtX:0.25 |
|
550 |
nameAs:'libraryBinBox'. |
|
551 |
||
552 |
(d componentAt:'libraryBinBox.label') backgroundColor:dark; foregroundColor:Color white. |
|
553 |
||
0 | 554 |
cm := ComboBoxView on:stxLibDirHolder. |
1 | 555 |
cm list:self defaultLibDirs. |
0 | 556 |
d |
557 |
addLabelledField:cm |
|
24 | 558 |
label:(resources string:'help files') |
0 | 559 |
adjust:#left |
560 |
tabable:true |
|
561 |
from:0.0 to:1.0 separateAtX:0.25 |
|
562 |
nameAs:'libraryBox'. |
|
563 |
||
564 |
(d componentAt:'libraryBox.label') backgroundColor:dark; foregroundColor:Color white. |
|
565 |
||
5 | 566 |
d addVerticalSpace. |
567 |
d addHorizontalLine. |
|
568 |
d addVerticalSpace. |
|
569 |
||
11 | 570 |
(d addTextLabel:(resources string:'required:')) |
5 | 571 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
572 |
||
573 |
d leftIndent:35. |
|
11 | 574 |
(d addTextLabel:(resources string:'binaries (approx. %1 Mb)' with:binMegabytes printString)) |
5 | 575 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
11 | 576 |
(d addTextLabel:(resources string:'libraries (approx. %1 Mb)' with:libMegabytes printString)) |
5 | 577 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
578 |
d leftIndent:0. |
|
579 |
||
580 |
d addVerticalSpace. |
|
581 |
d addHorizontalLine. |
|
582 |
d addVerticalSpace. |
|
583 |
||
11 | 584 |
(d addTextLabel:(resources string:'optional:')) |
5 | 585 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
586 |
||
73 | 587 |
(d addCheckBox:((resources string:'doc files (+%1 Mb)' with:docMegabytes)) on:installDocHolder) |
5 | 588 |
labelView foregroundColor:Color white backgroundColor:dark. |
73 | 589 |
(d addCheckBox:((resources string:'stc & support files (+%1 Mb)' with:stcMegabytes)) on:installSTCHolder) |
10 | 590 |
labelView foregroundColor:Color white backgroundColor:dark. |
591 |
||
592 |
d addVerticalSpace. |
|
593 |
d addHorizontalLine. |
|
594 |
d addVerticalSpace. |
|
595 |
||
11 | 596 |
(d addTextLabel:(resources string:'optional (but highly recommended):')) |
10 | 597 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
598 |
||
73 | 599 |
(d addCheckBox:((resources string:'smalltalk source files (+%1 Mb)' with:srcMegabytes)) on:installSourceHolder) |
5 | 600 |
labelView foregroundColor:Color white backgroundColor:dark. |
73 | 601 |
(d addCheckBox:((resources string:'goodies (+0.5 Mb)')) on:installGoodiesHolder) |
5 | 602 |
labelView foregroundColor:Color white backgroundColor:dark. |
603 |
||
604 |
d addVerticalSpace. |
|
605 |
d addHorizontalLine. |
|
606 |
||
24 | 607 |
d addHelpButtonFor:'STXInstaller/installHelp.html'; |
608 |
addAbortButton; |
|
609 |
addOkButtonLabelled:(resources string:'install'). |
|
73 | 610 |
d extent:500@400. |
0 | 611 |
|
612 |
d allViewBackground:dark. |
|
613 |
||
614 |
d openAtCenter. |
|
615 |
d accepted ifTrue:[ |
|
616 |
stxLibDir := LastLibDir := stxLibDirHolder value. |
|
24 | 617 |
stxLibBinDir := LastLibBinDir := stxLibBinDirHolder value. |
0 | 618 |
stxBinDir := LastBinDir := stxBinDirHolder value. |
5 | 619 |
installDocFiles := installDocHolder value. |
620 |
installSourceFiles := installSourceHolder value. |
|
621 |
installSTCFiles := installSTCHolder value. |
|
622 |
installGoodyFiles := installGoodiesHolder value. |
|
1 | 623 |
d destroy. |
0 | 624 |
^ true |
625 |
]. |
|
1 | 626 |
d destroy. |
0 | 627 |
^ false |
628 |
||
73 | 629 |
"Modified: 2.3.1997 / 13:40:44 / cg" |
0 | 630 |
! |
631 |
||
632 |
checkForExistingInstallationAndConfirm |
|
633 |
"look if there is another installation and confirm |
|
634 |
reinstalling; return true if ok, false if not" |
|
635 |
||
1 | 636 |
|whatToDo| |
637 |
||
0 | 638 |
stxLibDir asFilename exists ifTrue:[ |
1 | 639 |
whatToDo := Dialog |
11 | 640 |
choose:(resources |
641 |
string:'detected existing ST/X installation in %1' |
|
642 |
with:stxLibDir asText allBold) |
|
643 |
label:(resources string:'Attention') |
|
644 |
labels:(resources array:#('remove first' 'overwrite' 'cancel')) |
|
1 | 645 |
values:#(remove over nil) |
646 |
default:nil. |
|
73 | 647 |
|
1 | 648 |
whatToDo isNil ifTrue:[^false]. |
649 |
whatToDo == #remove ifTrue:[ |
|
23
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
650 |
((stxLibDir findString:'stx') == 0 |
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
651 |
and:[(stxLibDir findString:'smalltalk') == 0]) ifTrue:[ |
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
652 |
"/ confirm again |
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
653 |
(self confirm:(resources |
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
654 |
string:'are you certain that the directory to remove |
73 | 655 |
(' , stxLibDir , ') is really a smalltalk directory ? |
23
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
656 |
|
73 | 657 |
Remove it now ?')) ifFalse:[ |
658 |
(self confirm:(resources |
|
659 |
string:'overwrite ?')) ifTrue:[^ true]. |
|
660 |
^ false |
|
661 |
] |
|
23
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
662 |
]. |
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
663 |
|
1 | 664 |
(OperatingSystem recursiveRemoveDirectory:stxLibDir) |
665 |
ifFalse:[ |
|
11 | 666 |
self warn:(resources string:'mhmh - could not remove old installation.') |
1 | 667 |
]. |
668 |
]. |
|
669 |
^ true |
|
0 | 670 |
]. |
671 |
^ true |
|
672 |
||
73 | 673 |
"Modified: 2.3.1997 / 13:45:13 / cg" |
0 | 674 |
! |
675 |
||
676 |
doInstall |
|
677 |
"install ST/X; return true if ok, false if not" |
|
678 |
||
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
679 |
|progressView ok textView| |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
680 |
|
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
681 |
textView := HVScrollableView for:TextCollector. |
73 | 682 |
textView preferredExtent:(200 @ 300). |
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
683 |
commandTraceView := textView scrolledView. |
0 | 684 |
|
685 |
progressView := ProgressIndicator |
|
26 | 686 |
inBoxWithLabel:'ST/X Installation' icon:(Depth8Image fromImage:Launcher aboutIcon) |
0 | 687 |
text:#('ST/X Installation' '' '' '' '' '' '' '') asStringCollection |
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
688 |
abortable:true |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
689 |
view:textView |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
690 |
closeWhenDone:false. |
73 | 691 |
progressView topView extent:(640 min:Display width) @ (500 min:Display height). |
0 | 692 |
|
693 |
ok := false. |
|
694 |
||
695 |
progressView showProgressOf: |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
696 |
[:progressValue :currentAction| |msg| |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
697 |
|
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
698 |
Processor activeProcess withPriority:7 do:[ |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
699 |
actionPercentageHolder := progressValue. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
700 |
actionTextHolder := currentAction. |
0 | 701 |
|
73 | 702 |
self outputInitialMessage. |
703 |
||
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
704 |
(self createDirectories) ifTrue:[ |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
705 |
ok := self copyFiles |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
706 |
]. |
19 | 707 |
self createSymbolicLinks. |
708 |
||
6 | 709 |
progressValue value:100. |
710 |
||
11 | 711 |
progressView topView abortButton label:(resources string:'continue'). |
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
712 |
progressView topView abortButton action:[progressView topView hide]. |
11 | 713 |
msg := (resources |
714 |
array:#('ST/X Installation finished.' '' 'press continue ...' '' '' '')) |
|
715 |
asStringCollection. |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
716 |
actionTextHolder value:nil. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
717 |
actionTextHolder value:msg. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
718 |
] |
0 | 719 |
]. |
720 |
||
721 |
^ ok |
|
722 |
||
723 |
"Created: 17.7.1996 / 15:11:27 / cg" |
|
73 | 724 |
"Modified: 2.3.1997 / 12:59:47 / cg" |
0 | 725 |
! |
726 |
||
727 |
open |
|
1 | 728 |
self askAndInstall. |
0 | 729 |
|
5 | 730 |
" |
731 |
STXInstaller open |
|
732 |
" |
|
1 | 733 |
! |
734 |
||
735 |
postInstall |
|
736 |
"some messages at the end ..." |
|
737 |
||
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
738 |
|shInfo cshInfo msg havePath| |
1 | 739 |
|
11 | 740 |
msg := (resources string:'ST/X Installation complete.\\') withCRs. |
1 | 741 |
shInfo := ''. |
742 |
cshInfo := ''. |
|
743 |
||
744 |
havePath := true. |
|
745 |
(((OperatingSystem getEnvironment:'PATH') |
|
746 |
asCollectionOfSubstringsSeparatedBy:$:) |
|
747 |
includes:stxBinDir) ifFalse:[ |
|
748 |
||
749 |
havePath := false. |
|
750 |
shInfo := 'PATH=$PATH:' , stxBinDir , ' ; export PATH\'. |
|
751 |
cshInfo := 'set path=($path ' , stxBinDir , ')\'. |
|
11 | 752 |
msg := msg , (resources string:'%1 is not in your PATH.\You should change your ".login" and/or ".profile" files to include it.\\' |
753 |
with:stxBinDir asText allBold) withCRs. |
|
1 | 754 |
]. |
755 |
||
756 |
(stxLibDir ~= '/usr/local/lib/smalltalk' |
|
757 |
and:[stxLibDir ~= '/usr/lib/smalltalk']) ifTrue:[ |
|
11 | 758 |
msg := msg , (resources string:'The library directory is not a standard ST/X library directory\("/usr/local/lib/smalltalk" or "/usr/lib/smalltalk").\You have to define the %1 environment variable\as %2 before ST/X can be started.\' |
759 |
with:'STX_LIBDIR' asText allBold |
|
760 |
with:stxLibDir asText allBold) withCRs. |
|
1 | 761 |
havePath ifFalse:[ |
11 | 762 |
msg := msg , (resources string:'The above mentioned files are also a good place to do this.\') withCRs. |
1 | 763 |
] ifTrue:[ |
11 | 764 |
msg := msg , (resources string:'The ".login" and/or ".profile" files are a good place to do this.\') withCRs. |
1 | 765 |
]. |
766 |
||
767 |
shInfo := shInfo , 'STX_LIBDIR=' , stxLibDir , ' ; export STX_LIBDIR\'. |
|
768 |
cshInfo := cshInfo , 'setenv STX_LIBDIR ' , stxLibDir , '\'. |
|
769 |
]. |
|
770 |
||
771 |
shInfo notEmpty ifTrue:[ |
|
11 | 772 |
'*********************************************************' errorPrintCR. |
773 |
(resources string:'Message from the ST/X Installer:\\') withCRs errorPrintCR. |
|
774 |
(resources string:'Please add the following to your ".profile" file:') withCRs errorPrintCR. |
|
1 | 775 |
'' errorPrintCR. |
776 |
shInfo withCRs errorPrintCR. |
|
777 |
'' errorPrintCR. |
|
11 | 778 |
(resources string:'or (if you use csh/tcsh), add to your ".login" file:') withCRs errorPrintCR. |
1 | 779 |
'' errorPrintCR. |
780 |
cshInfo withCRs errorPrintCR. |
|
781 |
'' errorPrintCR. |
|
11 | 782 |
'*********************************************************' errorPrintCR. |
1 | 783 |
]. |
73 | 784 |
|
785 |
msg := msg , '\\Have fun using ST/X !!'. |
|
786 |
||
787 |
self information:msg withCRs. |
|
1 | 788 |
|
789 |
" |
|
790 |
STXInstaller new postInstall |
|
791 |
" |
|
792 |
||
73 | 793 |
"Modified: 2.3.1997 / 13:28:18 / cg" |
25
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
794 |
! |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
795 |
|
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
796 |
preInstall |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
797 |
"clobber the doc directory, to avoid copying cyclic symbolic links" |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
798 |
|
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
799 |
|f| |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
800 |
|
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
801 |
f := '../../doc/online/english/german' asFilename. |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
802 |
f exists ifTrue:[ |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
803 |
f isSymbolicLink ifTrue:[ |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
804 |
OperatingSystem executeCommand:'(cd ../../doc/online; make clobber) >/dev/null 2>/dev/null' |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
805 |
] |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
806 |
] |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
807 |
|
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
808 |
" |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
809 |
STXInstaller new preInstall |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
810 |
" |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
811 |
|
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
812 |
"Modified: 18.7.1996 / 22:10:42 / cg" |
0 | 813 |
! ! |
814 |
||
28 | 815 |
!STXInstaller class methodsFor:'documentation'! |
0 | 816 |
|
817 |
version |
|
818 |
^ '$Header$' |
|
819 |
! ! |