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