author | Claus Gittinger <cg@exept.de> |
Tue, 10 Sep 1996 20:49:46 +0200 | |
changeset 14 | 4c8640a78f2a |
parent 13 | d889323fd944 |
child 15 | ffe9991b03ba |
permissions | -rw-r--r-- |
0 | 1 |
Object subclass:#STXInstaller |
5 | 2 |
instanceVariableNames:'stxLibDir stxBinDir installDocFiles installSourceFiles |
3 |
installSTCFiles installGoodyFiles actionPercentageHolder |
|
4 |
actionTextHolder commandTraceView resources' |
|
0 | 5 |
classVariableNames:'LastBinDir LastLibDir' |
6 |
poolDictionaries:'' |
|
7 |
category:'eXept-tools' |
|
8 |
! |
|
9 |
||
10 |
||
11 |
!STXInstaller class methodsFor:'startup'! |
|
12 |
||
13 |
open |
|
14 |
^ self new open |
|
15 |
||
11 | 16 |
" |
17 |
STXInstaller open |
|
18 |
" |
|
1 | 19 |
! ! |
20 |
||
21 |
!STXInstaller methodsFor:'defaults'! |
|
22 |
||
23 |
defaultBinDirs |
|
24 |
|dirs| |
|
25 |
||
26 |
dirs := OrderedCollection new. |
|
27 |
dirs add:'/usr/local/bin'. |
|
28 |
dirs add:'/usr/bin'. |
|
29 |
dirs add:(Filename homeDirectory constructString:'bin'). |
|
14 | 30 |
dirs add:((Filename homeDirectory |
31 |
construct:'stx') |
|
32 |
constructString:'bin'). |
|
1 | 33 |
dirs add:'/tmp/stxbin'. |
3 | 34 |
('/home' asFilename exists and:['/home' asFilename isDirectory]) ifTrue:[ |
35 |
dirs add:'/home/stx/bin'. |
|
36 |
]. |
|
37 |
('/home2' asFilename exists and:['/home2' asFilename isDirectory]) ifTrue:[ |
|
38 |
dirs add:'/home2/stx/bin'. |
|
39 |
]. |
|
40 |
||
41 |
"/ dirs := dirs select:[:path | |
|
42 |
"/ |f| |
|
43 |
"/ |
|
44 |
"/ f := path asFilename. |
|
45 |
"/ f exists and:[f isDirectory]]. |
|
46 |
^ dirs sort |
|
1 | 47 |
|
48 |
"Created: 18.7.1996 / 19:43:00 / cg" |
|
49 |
"Modified: 18.7.1996 / 19:45:08 / cg" |
|
50 |
! |
|
51 |
||
52 |
defaultLibDirs |
|
53 |
|dirs| |
|
54 |
||
55 |
dirs := OrderedCollection new. |
|
56 |
dirs add:'/usr/local/lib/smalltalk'. |
|
57 |
dirs add:'/usr/lib/smalltalk'. |
|
58 |
dirs add:((Filename homeDirectory |
|
59 |
construct:'lib') |
|
60 |
constructString:'smalltalk'). |
|
14 | 61 |
dirs add:(((Filename homeDirectory |
62 |
construct:'stx') |
|
63 |
construct:'lib') |
|
64 |
constructString:'smalltalk'). |
|
1 | 65 |
dirs add:'/tmp/stxlib'. |
66 |
dirs add:'/home/stx/lib'. |
|
67 |
dirs add:'/home2/stx/lib'. |
|
3 | 68 |
|
69 |
"/ dirs := dirs select:[:path | |
|
70 |
"/ |f| |
|
71 |
"/ |
|
72 |
"/ f := path asFilename. |
|
73 |
"/ f exists and:[f isDirectory]]. |
|
74 |
^ dirs sort |
|
1 | 75 |
|
76 |
"Created: 18.7.1996 / 19:43:21 / cg" |
|
77 |
"Modified: 18.7.1996 / 19:46:04 / cg" |
|
11 | 78 |
! |
0 | 79 |
|
11 | 80 |
directoriesToMake |
81 |
|dirsToMake| |
|
0 | 82 |
|
11 | 83 |
dirsToMake := OrderedCollection new. |
84 |
dirsToMake add:stxBinDir. |
|
85 |
dirsToMake add:stxLibDir. |
|
86 |
dirsToMake add:(stxLibDir asFilename constructString:'lib'). |
|
87 |
dirsToMake add:(stxLibDir asFilename constructString:'doc'). |
|
12
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
88 |
dirsToMake add:(stxLibDir asFilename constructString:'doc/online'). |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
89 |
dirsToMake add:(stxLibDir asFilename constructString:'doc/online/english'). |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
90 |
dirsToMake add:(stxLibDir asFilename constructString:'doc/online/german'). |
11 | 91 |
dirsToMake add:(stxLibDir asFilename constructString:'include'). |
92 |
dirsToMake add:(stxLibDir asFilename constructString:'resources'). |
|
93 |
dirsToMake add:(stxLibDir asFilename constructString:'binary'). |
|
94 |
dirsToMake add:(stxLibDir asFilename constructString:'bitmaps'). |
|
95 |
dirsToMake add:(stxLibDir asFilename constructString:'goodies'). |
|
0 | 96 |
|
11 | 97 |
^ dirsToMake |
98 |
! |
|
99 |
||
100 |
specOfFilesToCopy |
|
101 |
|fileSpec| |
|
0 | 102 |
|
103 |
fileSpec := #( |
|
13 | 104 |
"/ name destination subDir required mode |
12
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
105 |
( 'projects/smalltalk/smalltalk' #bin nil true '755' ) |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
106 |
( 'projects/smalltalk/include' #lib nil true '644' ) |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
107 |
( 'projects/smalltalk/*.rc' #lib nil true '644' ) |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
108 |
( 'projects/smalltalk/patches' #lib nil true '644' ) |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
109 |
( 'projects/smalltalk/bitmaps' #lib nil true '644' ) |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
110 |
( 'projects/smalltalk/resources' #lib nil true '644' ) |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
111 |
( 'projects/smalltalk/lib' #lib nil true '644' ) |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
112 |
( 'doc/online/german/LICENSE.STX.html' #lib 'doc/online/german' true '644' ) |
6cb00d713d4d
LICENSE texts must always be installed
Claus Gittinger <cg@exept.de>
parents:
11
diff
changeset
|
113 |
( 'doc/online/english/LICENSE.STX.html' #lib 'doc/online/english' true '644' ) |
5 | 114 |
). |
0 | 115 |
|
5 | 116 |
installDocFiles ifTrue:[ |
117 |
fileSpec := fileSpec , #( |
|
118 |
( 'doc' #lib nil false '644' ) |
|
119 |
). |
|
120 |
]. |
|
121 |
||
9 | 122 |
installSourceFiles ifTrue:[ |
123 |
fileSpec := fileSpec , #( |
|
124 |
( 'projects/smalltalk/source' #lib nil false '644' ) |
|
125 |
). |
|
126 |
]. |
|
127 |
||
5 | 128 |
installSTCFiles ifTrue:[ |
129 |
fileSpec := fileSpec , #( |
|
130 |
( 'stc/stc' #bin nil false '755' ) |
|
131 |
( 'rules/stmkmp' #bin nil false '755' ) |
|
132 |
( 'rules/stmkmf' #bin nil false '755' ) |
|
7 | 133 |
( 'include' #lib nil false '644' ) |
5 | 134 |
( 'configurations' #lib nil false '644' ) |
135 |
( 'rules' #lib nil false '644' ) |
|
136 |
||
137 |
( 'support/VGL/vogl/src/libvogl.*' #lib 'lib' false '644' ) |
|
138 |
( 'support/VGL/vogl/src/*.h' #lib 'include' false '644' ) |
|
139 |
( 'support/DLD/dld-3.2.5/libdld.*' #lib 'lib' false '644' ) |
|
140 |
( 'goodies/persistency/db-1.6/PORT/libdb.*' #lib 'lib' false '644' ) |
|
0 | 141 |
|
5 | 142 |
( 'librun/librun.*' #lib 'lib' false '644' ) |
143 |
( 'libbasic/libbasic.*' #lib 'lib' false '644' ) |
|
144 |
( 'libbasic2/libbasic2.*' #lib 'lib' false '644' ) |
|
145 |
( 'libbasic3/libbasic3.*' #lib 'lib' false '644' ) |
|
146 |
( 'libcomp/libcomp.*' #lib 'lib' false '644' ) |
|
147 |
( 'libview/libview.*' #lib 'lib' false '644' ) |
|
148 |
( 'libview2/libview2.*' #lib 'lib' false '644' ) |
|
149 |
( 'libwidg/libwidg.*' #lib 'lib' false '644' ) |
|
150 |
( 'libwidg2/libwidg2.*' #lib 'lib' false '644' ) |
|
151 |
( 'libwidg3/libwidg3.*' #lib 'lib' false '644' ) |
|
152 |
( 'libsnmp/libsnmp.*' #lib 'lib' false '644' ) |
|
153 |
( 'contrib/libPVM/libPVM.*' #lib 'lib' false '644' ) |
|
154 |
( 'goodies/persistency/libdbase.*' #lib 'lib' false '644' ) |
|
155 |
( 'libtable/libtable.*' #lib 'lib' false '644' ) |
|
156 |
( 'libtool/libtool.*' #lib 'lib' false '644' ) |
|
157 |
( 'libxt/libxt.*' #lib 'lib' false '644' ) |
|
158 |
( 'librt/librt.*' #lib 'lib' false '644' ) |
|
159 |
). |
|
160 |
]. |
|
0 | 161 |
|
5 | 162 |
installGoodyFiles ifTrue:[ |
163 |
fileSpec := fileSpec , #( |
|
164 |
( 'goodies/*.st' #lib 'goodies' false '644' ) |
|
165 |
( 'goodies/*.chg' #lib 'goodies' false '644' ) |
|
166 |
( 'goodies/rdoit/rdoit' #bin nil false '755' ) |
|
167 |
). |
|
168 |
]. |
|
0 | 169 |
|
11 | 170 |
|
171 |
^ fileSpec |
|
172 |
||
173 |
! ! |
|
174 |
||
175 |
!STXInstaller methodsFor:'installing'! |
|
176 |
||
177 |
copyFiles |
|
178 |
|msg fileSpec filesToCopy numFiles nDone| |
|
179 |
||
180 |
msg := (resources array:#('ST/X Installation' '' 'copying:' '' 'to:' '')) asStringCollection. |
|
181 |
||
182 |
fileSpec := self specOfFilesToCopy. |
|
183 |
||
0 | 184 |
filesToCopy := OrderedCollection new. |
185 |
||
186 |
fileSpec do:[:entry | |
|
8 | 187 |
|fileNames dest subDir required destDir| |
0 | 188 |
|
8 | 189 |
fileNames := entry at:1. |
0 | 190 |
dest := entry at:2. |
191 |
subDir := entry at:3. |
|
192 |
required := entry at:4. |
|
193 |
||
194 |
dest == #bin ifTrue:[ |
|
195 |
destDir := stxBinDir |
|
196 |
] ifFalse:[ |
|
197 |
destDir := stxLibDir |
|
198 |
]. |
|
199 |
||
200 |
destDir := destDir asFilename. |
|
201 |
subDir notNil ifTrue:[ |
|
202 |
destDir := destDir construct:subDir |
|
203 |
]. |
|
204 |
||
8 | 205 |
filesToCopy add:(fileNames -> destDir pathName) |
0 | 206 |
]. |
207 |
||
208 |
numFiles := filesToCopy size. |
|
209 |
nDone := 0. |
|
210 |
||
211 |
filesToCopy do:[:entry | |
|
11 | 212 |
|fileName destDir cmd p text line doneSemaphore| |
0 | 213 |
|
214 |
fileName := entry key. |
|
215 |
destDir := entry value. |
|
216 |
||
8 | 217 |
((fileName includes:$*) |
218 |
or:[('../../' , fileName) asFilename exists])ifTrue:[ |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
219 |
actionPercentageHolder value:(nDone / numFiles * 100) rounded. |
0 | 220 |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
221 |
msg at:4 put:' ' , (fileName asText allBold). |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
222 |
msg at:6 put:' ' , (destDir asText allBold). |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
223 |
actionTextHolder value:nil. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
224 |
actionTextHolder value:msg. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
225 |
|
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
226 |
cmd := 'cp -r ../../' , fileName , ' ' , destDir. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
227 |
commandTraceView showCR:cmd , ' ...'. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
228 |
cmd := 'sh -c "echo ; ' , cmd , ' 2>&1"' . |
1 | 229 |
|
11 | 230 |
doneSemaphore := Semaphore new. |
231 |
||
232 |
[ |
|
233 |
||
234 |
p := PipeStream readingFrom:cmd. |
|
235 |
p isNil ifTrue:[ |
|
236 |
self warn:('command error. Could not execute:\\' , cmd) withCRs. |
|
237 |
] ifFalse:[ |
|
238 |
[p atEnd] whileFalse:[ |
|
239 |
[p readWaitWithTimeout:0.1] whileTrue:[]. |
|
240 |
line := p nextLine. |
|
241 |
(line notNil and:[line notEmpty]) ifTrue:[ |
|
242 |
commandTraceView showCR:((' ' , line) asText emphasizeAllWith:(#color->Color red)). |
|
243 |
] |
|
244 |
]. |
|
245 |
p close. |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
246 |
]. |
11 | 247 |
doneSemaphore signal. |
248 |
] forkAt:4. |
|
249 |
||
250 |
doneSemaphore wait. |
|
251 |
||
1 | 252 |
]. |
0 | 253 |
|
254 |
nDone := nDone + 1 |
|
255 |
]. |
|
256 |
||
257 |
^ true |
|
258 |
||
259 |
"Created: 17.7.1996 / 15:16:20 / cg" |
|
1 | 260 |
"Modified: 18.7.1996 / 22:20:24 / cg" |
0 | 261 |
! |
262 |
||
263 |
createDirectories |
|
264 |
|msg dirsToMake numDirs nDone| |
|
265 |
||
11 | 266 |
msg := (resources array:#('ST/X Installation' '' 'creating directory:' '' '' '')) asStringCollection. |
0 | 267 |
|
11 | 268 |
dirsToMake := self directoriesToMake. |
0 | 269 |
|
270 |
numDirs := dirsToMake size. |
|
271 |
nDone := 0. |
|
272 |
||
273 |
dirsToMake do:[:dirName | |
|
274 |
|d errMsg stop box| |
|
275 |
||
276 |
actionPercentageHolder value:(nDone / numDirs * 100) rounded. |
|
277 |
||
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
278 |
msg at:4 put:' ' , (dirName asText allBold). |
0 | 279 |
actionTextHolder value:nil. |
280 |
actionTextHolder value:msg. |
|
281 |
||
282 |
d := dirName asFilename. |
|
283 |
||
11 | 284 |
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
|
285 |
|
0 | 286 |
d exists ifFalse:[ |
287 |
OperatingSystem recursiveCreateDirectory:d pathName |
|
288 |
]. |
|
289 |
||
290 |
d exists ifFalse:[ |
|
11 | 291 |
errMsg := resources string:'failed to create directory: %1' with: dirName. |
0 | 292 |
stop := true |
293 |
] ifTrue:[ |
|
294 |
d isDirectory ifFalse:[ |
|
11 | 295 |
errMsg := resources string:'not a directory: %1' with:dirName. |
0 | 296 |
stop := true |
297 |
] ifTrue:[ |
|
298 |
(d isReadable |
|
299 |
and:[d isWritable]) ifFalse:[ |
|
11 | 300 |
errMsg := resources string:'no read/write access to directory: %1' with:dirName. |
0 | 301 |
stop := false |
302 |
] ifTrue:[ |
|
303 |
errMsg := nil |
|
304 |
] |
|
305 |
] |
|
306 |
]. |
|
307 |
||
308 |
errMsg notNil ifTrue:[ |
|
309 |
box := WarningBox new. |
|
310 |
box title:errMsg. |
|
311 |
box showAtPointerNotCovering:(WindowGroup activeGroup topViews first). |
|
1 | 312 |
stop ifTrue:[^ false]. |
0 | 313 |
]. |
314 |
||
315 |
Delay waitForSeconds:0.25. |
|
316 |
nDone := nDone + 1. |
|
317 |
]. |
|
318 |
^ true |
|
319 |
||
320 |
"Created: 17.7.1996 / 15:24:19 / cg" |
|
1 | 321 |
"Modified: 18.7.1996 / 22:18:38 / cg" |
0 | 322 |
! ! |
323 |
||
324 |
!STXInstaller methodsFor:'startup'! |
|
325 |
||
326 |
askAndInstall |
|
327 |
"/ check, if we are in the projects/smalltalk directory |
|
328 |
||
11 | 329 |
resources := ResourcePack for:self class. |
330 |
||
0 | 331 |
(Filename currentDirectory pathName endsWith:'projects/smalltalk') ifFalse:[ |
11 | 332 |
self warn:(resources string:'must be in the ''projects/smalltalk'' directory'). |
0 | 333 |
^ self |
334 |
]. |
|
335 |
||
336 |
[self askForDestination] whileTrue:[ |
|
337 |
self checkForExistingInstallationAndConfirm ifFalse:[ |
|
338 |
^ self |
|
339 |
]. |
|
340 |
self doInstall ifTrue:[ |
|
1 | 341 |
self postInstall. |
0 | 342 |
^ self |
343 |
]. |
|
11 | 344 |
(self confirm:(resources string:'installation failed or aborted - retry ?')) |
0 | 345 |
ifFalse:[ |
346 |
^ self |
|
347 |
] |
|
348 |
]. |
|
349 |
||
1 | 350 |
"Modified: 18.7.1996 / 21:20:56 / cg" |
0 | 351 |
! |
352 |
||
353 |
askForDestination |
|
354 |
"open a dialog to enter destination directories" |
|
355 |
||
2 | 356 |
|d cm l green dark img |
0 | 357 |
stxLibDirHolder stxBinDirHolder |
5 | 358 |
installDocHolder installSourceHolder installSTCHolder installGoodiesHolder |
11 | 359 |
binMegabytes libMegabytes |
0 | 360 |
| |
361 |
||
11 | 362 |
binMegabytes := 10. |
363 |
libMegabytes := 10. |
|
364 |
||
0 | 365 |
LastLibDir isNil ifTrue:[ |
366 |
LastLibDir := '/usr/local/lib/smalltalk' |
|
367 |
]. |
|
368 |
LastBinDir isNil ifTrue:[ |
|
369 |
LastBinDir := '/usr/local/bin' |
|
370 |
]. |
|
371 |
||
372 |
stxLibDirHolder := LastLibDir asValue. |
|
373 |
stxBinDirHolder := LastBinDir asValue. |
|
5 | 374 |
installDocHolder := true asValue. |
375 |
installSourceHolder := true asValue. |
|
376 |
installSTCHolder := true asValue. |
|
377 |
installGoodiesHolder := true asValue. |
|
0 | 378 |
|
379 |
Screen current hasColors ifTrue:[ |
|
380 |
green := (Color red:0 green:80 blue:20) "darkened". |
|
381 |
dark := Color grey:10. |
|
382 |
] ifFalse:[ |
|
383 |
green := Color white. |
|
384 |
dark := Color black. |
|
385 |
]. |
|
386 |
||
387 |
d := DialogBox new. |
|
388 |
||
11 | 389 |
d label:(resources string:'ST/X CD Installation'). |
2 | 390 |
img := Image fromFile:'SmalltalkX.xbm'. |
391 |
||
392 |
l := d addTextLabel:img. |
|
393 |
l adjust:#left; foregroundColor:green backgroundColor:dark. |
|
394 |
||
11 | 395 |
l := d addTextLabel:(resources string:'Smalltalk/X CD installation.'). |
0 | 396 |
l adjust:#left; backgroundColor:dark; foregroundColor:Color white. |
397 |
d addVerticalSpace. |
|
398 |
d addVerticalSpace. |
|
399 |
||
400 |
d addHorizontalLine. |
|
401 |
||
11 | 402 |
l := d addTextLabel:(resources string:'Destination directories:'). |
0 | 403 |
l adjust:#left; backgroundColor:dark; foregroundColor:Color white. |
404 |
||
405 |
cm := ComboBoxView on:stxBinDirHolder. |
|
1 | 406 |
cm list:self defaultBinDirs. |
0 | 407 |
d |
408 |
addLabelledField:cm |
|
11 | 409 |
label:(resources string:'binaries') |
0 | 410 |
adjust:#left |
411 |
tabable:true |
|
412 |
from:0.0 to:1.0 separateAtX:0.25 |
|
413 |
nameAs:'binaryBox'. |
|
414 |
||
415 |
(d componentAt:'binaryBox.label') backgroundColor:dark; foregroundColor:Color white. |
|
416 |
||
417 |
cm := ComboBoxView on:stxLibDirHolder. |
|
1 | 418 |
cm list:self defaultLibDirs. |
0 | 419 |
d |
420 |
addLabelledField:cm |
|
11 | 421 |
label:(resources string:'libraries') |
0 | 422 |
adjust:#left |
423 |
tabable:true |
|
424 |
from:0.0 to:1.0 separateAtX:0.25 |
|
425 |
nameAs:'libraryBox'. |
|
426 |
||
427 |
(d componentAt:'libraryBox.label') backgroundColor:dark; foregroundColor:Color white. |
|
428 |
||
5 | 429 |
d addVerticalSpace. |
430 |
d addHorizontalLine. |
|
431 |
d addVerticalSpace. |
|
432 |
||
11 | 433 |
(d addTextLabel:(resources string:'required:')) |
5 | 434 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
435 |
||
436 |
d leftIndent:35. |
|
11 | 437 |
(d addTextLabel:(resources string:'binaries (approx. %1 Mb)' with:binMegabytes printString)) |
5 | 438 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
11 | 439 |
(d addTextLabel:(resources string:'libraries (approx. %1 Mb)' with:libMegabytes printString)) |
5 | 440 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
441 |
d leftIndent:0. |
|
442 |
||
443 |
d addVerticalSpace. |
|
444 |
d addHorizontalLine. |
|
445 |
d addVerticalSpace. |
|
446 |
||
11 | 447 |
(d addTextLabel:(resources string:'optional:')) |
5 | 448 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
449 |
||
11 | 450 |
(d addCheckBox:((resources string:'doc files') , ' (+8 Mb)') on:installDocHolder) |
5 | 451 |
labelView foregroundColor:Color white backgroundColor:dark. |
11 | 452 |
(d addCheckBox:((resources string:'stc & support files') , ' (+2 Mb)') on:installSTCHolder) |
10 | 453 |
labelView foregroundColor:Color white backgroundColor:dark. |
454 |
||
455 |
d addVerticalSpace. |
|
456 |
d addHorizontalLine. |
|
457 |
d addVerticalSpace. |
|
458 |
||
11 | 459 |
(d addTextLabel:(resources string:'optional (but highly recommended):')) |
10 | 460 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
461 |
||
11 | 462 |
(d addCheckBox:((resources string:'smalltalk source files') , ' (+12 Mb)') on:installSourceHolder) |
5 | 463 |
labelView foregroundColor:Color white backgroundColor:dark. |
11 | 464 |
(d addCheckBox:((resources string:'goodies') , ' (+0.5 Mb)') on:installGoodiesHolder) |
5 | 465 |
labelView foregroundColor:Color white backgroundColor:dark. |
466 |
||
467 |
d addVerticalSpace. |
|
468 |
d addHorizontalLine. |
|
469 |
||
11 | 470 |
d addAbortButton; addOkButtonLabelled:(resources string:'install'). |
0 | 471 |
d extent:400@300. |
472 |
||
473 |
d allViewBackground:dark. |
|
474 |
||
475 |
d openAtCenter. |
|
476 |
d accepted ifTrue:[ |
|
477 |
stxLibDir := LastLibDir := stxLibDirHolder value. |
|
478 |
stxBinDir := LastBinDir := stxBinDirHolder value. |
|
5 | 479 |
installDocFiles := installDocHolder value. |
480 |
installSourceFiles := installSourceHolder value. |
|
481 |
installSTCFiles := installSTCHolder value. |
|
482 |
installGoodyFiles := installGoodiesHolder value. |
|
1 | 483 |
d destroy. |
0 | 484 |
^ true |
485 |
]. |
|
1 | 486 |
d destroy. |
0 | 487 |
^ false |
488 |
||
1 | 489 |
"Modified: 18.7.1996 / 19:43:38 / cg" |
0 | 490 |
! |
491 |
||
492 |
checkForExistingInstallationAndConfirm |
|
493 |
"look if there is another installation and confirm |
|
494 |
reinstalling; return true if ok, false if not" |
|
495 |
||
1 | 496 |
|whatToDo| |
497 |
||
0 | 498 |
stxLibDir asFilename exists ifTrue:[ |
1 | 499 |
whatToDo := Dialog |
11 | 500 |
choose:(resources |
501 |
string:'detected existing ST/X installation in %1' |
|
502 |
with:stxLibDir asText allBold) |
|
503 |
label:(resources string:'Attention') |
|
504 |
labels:(resources array:#('remove first' 'overwrite' 'cancel')) |
|
1 | 505 |
values:#(remove over nil) |
506 |
default:nil. |
|
507 |
whatToDo isNil ifTrue:[^false]. |
|
508 |
whatToDo == #remove ifTrue:[ |
|
509 |
(OperatingSystem recursiveRemoveDirectory:stxLibDir) |
|
510 |
ifFalse:[ |
|
11 | 511 |
self warn:(resources string:'mhmh - could not remove old installation.') |
1 | 512 |
]. |
513 |
]. |
|
514 |
^ true |
|
515 |
"/ ^ DialogBox |
|
516 |
"/ confirm:('detected existing installation in ' |
|
517 |
"/ , stxLibDir asText allBold |
|
518 |
"/ , '\\continue & overwrite ?') withCRs |
|
519 |
"/ yesLabel:'overwrite' noLabel:'cancel' |
|
0 | 520 |
|
521 |
]. |
|
522 |
^ true |
|
523 |
||
1 | 524 |
"Modified: 18.7.1996 / 20:01:36 / cg" |
0 | 525 |
! |
526 |
||
527 |
doInstall |
|
528 |
"install ST/X; return true if ok, false if not" |
|
529 |
||
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
530 |
|progressView ok textView| |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
531 |
|
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
532 |
textView := HVScrollableView for:TextCollector. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
533 |
textView preferredExtent:(100 @ 250). |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
534 |
commandTraceView := textView scrolledView. |
0 | 535 |
|
536 |
progressView := ProgressIndicator |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
537 |
inBoxWithLabel:'ST/X Installation' icon:(Depth8Image fromImage:NewLauncher aboutIcon) |
0 | 538 |
text:#('ST/X Installation' '' '' '' '' '' '' '') asStringCollection |
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
539 |
abortable:true |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
540 |
view:textView |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
541 |
closeWhenDone:false. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
542 |
progressView topView extent:(500 min:Display width) @ 300. |
0 | 543 |
|
544 |
ok := false. |
|
545 |
||
546 |
progressView showProgressOf: |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
547 |
[:progressValue :currentAction| |msg| |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
548 |
|
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
549 |
Processor activeProcess withPriority:7 do:[ |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
550 |
actionPercentageHolder := progressValue. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
551 |
actionTextHolder := currentAction. |
0 | 552 |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
553 |
(self createDirectories) ifTrue:[ |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
554 |
ok := self copyFiles |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
555 |
]. |
6 | 556 |
progressValue value:100. |
557 |
||
11 | 558 |
progressView topView abortButton label:(resources string:'continue'). |
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
559 |
progressView topView abortButton action:[progressView topView hide]. |
11 | 560 |
msg := (resources |
561 |
array:#('ST/X Installation finished.' '' 'press continue ...' '' '' '')) |
|
562 |
asStringCollection. |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
563 |
actionTextHolder value:nil. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
564 |
actionTextHolder value:msg. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
565 |
] |
0 | 566 |
]. |
567 |
||
568 |
^ ok |
|
569 |
||
570 |
"Created: 17.7.1996 / 15:11:27 / cg" |
|
571 |
"Modified: 17.7.1996 / 15:24:27 / cg" |
|
572 |
! |
|
573 |
||
574 |
open |
|
1 | 575 |
self askAndInstall. |
0 | 576 |
|
5 | 577 |
" |
578 |
STXInstaller open |
|
579 |
" |
|
1 | 580 |
! |
581 |
||
582 |
postInstall |
|
583 |
"some messages at the end ..." |
|
584 |
||
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
585 |
|shInfo cshInfo msg havePath| |
1 | 586 |
|
11 | 587 |
msg := (resources string:'ST/X Installation complete.\\') withCRs. |
1 | 588 |
shInfo := ''. |
589 |
cshInfo := ''. |
|
590 |
||
591 |
havePath := true. |
|
592 |
(((OperatingSystem getEnvironment:'PATH') |
|
593 |
asCollectionOfSubstringsSeparatedBy:$:) |
|
594 |
includes:stxBinDir) ifFalse:[ |
|
595 |
||
596 |
havePath := false. |
|
597 |
shInfo := 'PATH=$PATH:' , stxBinDir , ' ; export PATH\'. |
|
598 |
cshInfo := 'set path=($path ' , stxBinDir , ')\'. |
|
11 | 599 |
msg := msg , (resources string:'%1 is not in your PATH.\You should change your ".login" and/or ".profile" files to include it.\\' |
600 |
with:stxBinDir asText allBold) withCRs. |
|
1 | 601 |
]. |
602 |
||
603 |
(stxLibDir ~= '/usr/local/lib/smalltalk' |
|
604 |
and:[stxLibDir ~= '/usr/lib/smalltalk']) ifTrue:[ |
|
11 | 605 |
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.\' |
606 |
with:'STX_LIBDIR' asText allBold |
|
607 |
with:stxLibDir asText allBold) withCRs. |
|
1 | 608 |
havePath ifFalse:[ |
11 | 609 |
msg := msg , (resources string:'The above mentioned files are also a good place to do this.\') withCRs. |
1 | 610 |
] ifTrue:[ |
11 | 611 |
msg := msg , (resources string:'The ".login" and/or ".profile" files are a good place to do this.\') withCRs. |
1 | 612 |
]. |
613 |
||
614 |
shInfo := shInfo , 'STX_LIBDIR=' , stxLibDir , ' ; export STX_LIBDIR\'. |
|
615 |
cshInfo := cshInfo , 'setenv STX_LIBDIR ' , stxLibDir , '\'. |
|
616 |
]. |
|
617 |
||
618 |
shInfo notEmpty ifTrue:[ |
|
11 | 619 |
'*********************************************************' errorPrintCR. |
620 |
(resources string:'Message from the ST/X Installer:\\') withCRs errorPrintCR. |
|
621 |
(resources string:'Please add the following to your ".profile" file:') withCRs errorPrintCR. |
|
1 | 622 |
'' errorPrintCR. |
623 |
shInfo withCRs errorPrintCR. |
|
624 |
'' errorPrintCR. |
|
11 | 625 |
(resources string:'or (if you use csh/tcsh), add to your ".login" file:') withCRs errorPrintCR. |
1 | 626 |
'' errorPrintCR. |
627 |
cshInfo withCRs errorPrintCR. |
|
628 |
'' errorPrintCR. |
|
11 | 629 |
'*********************************************************' errorPrintCR. |
1 | 630 |
]. |
631 |
self information:msg. |
|
632 |
||
633 |
" |
|
634 |
STXInstaller new postInstall |
|
635 |
" |
|
636 |
||
637 |
"Modified: 18.7.1996 / 22:10:42 / cg" |
|
0 | 638 |
! ! |
639 |
||
640 |
!STXInstaller class methodsFor:'documentation'! |
|
641 |
||
642 |
version |
|
643 |
^ '$Header$' |
|
644 |
! ! |