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