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