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