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