author | Claus Gittinger <cg@exept.de> |
Tue, 12 Nov 1996 18:30:40 +0100 | |
changeset 28 | b3a8378dd626 |
parent 27 | 8c5195f9508a |
child 29 | 537410dfad60 |
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:[ |
|
274 |
[p readWaitWithTimeout:0.1] whileTrue:[]. |
|
275 |
line := p nextLine. |
|
276 |
(line notNil and:[line notEmpty]) ifTrue:[ |
|
277 |
commandTraceView showCR:((' ' , line) asText emphasizeAllWith:(#color->Color red)). |
|
278 |
] |
|
279 |
]. |
|
280 |
p close. |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
281 |
]. |
11 | 282 |
doneSemaphore signal. |
283 |
] forkAt:4. |
|
284 |
||
285 |
doneSemaphore wait. |
|
286 |
||
1 | 287 |
]. |
0 | 288 |
|
289 |
nDone := nDone + 1 |
|
290 |
]. |
|
291 |
||
292 |
^ true |
|
293 |
||
294 |
"Created: 17.7.1996 / 15:16:20 / cg" |
|
1 | 295 |
"Modified: 18.7.1996 / 22:20:24 / cg" |
0 | 296 |
! |
297 |
||
298 |
createDirectories |
|
299 |
|msg dirsToMake numDirs nDone| |
|
300 |
||
11 | 301 |
msg := (resources array:#('ST/X Installation' '' 'creating directory:' '' '' '')) asStringCollection. |
0 | 302 |
|
11 | 303 |
dirsToMake := self directoriesToMake. |
0 | 304 |
|
305 |
numDirs := dirsToMake size. |
|
306 |
nDone := 0. |
|
307 |
||
308 |
dirsToMake do:[:dirName | |
|
309 |
|d errMsg stop box| |
|
310 |
||
311 |
actionPercentageHolder value:(nDone / numDirs * 100) rounded. |
|
312 |
||
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
313 |
msg at:4 put:' ' , (dirName asText allBold). |
0 | 314 |
actionTextHolder value:nil. |
315 |
actionTextHolder value:msg. |
|
316 |
||
317 |
d := dirName asFilename. |
|
318 |
||
11 | 319 |
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
|
320 |
|
0 | 321 |
d exists ifFalse:[ |
322 |
OperatingSystem recursiveCreateDirectory:d pathName |
|
323 |
]. |
|
324 |
||
325 |
d exists ifFalse:[ |
|
11 | 326 |
errMsg := resources string:'failed to create directory: %1' with: dirName. |
0 | 327 |
stop := true |
328 |
] ifTrue:[ |
|
329 |
d isDirectory ifFalse:[ |
|
11 | 330 |
errMsg := resources string:'not a directory: %1' with:dirName. |
0 | 331 |
stop := true |
332 |
] ifTrue:[ |
|
333 |
(d isReadable |
|
334 |
and:[d isWritable]) ifFalse:[ |
|
11 | 335 |
errMsg := resources string:'no read/write access to directory: %1' with:dirName. |
0 | 336 |
stop := false |
337 |
] ifTrue:[ |
|
338 |
errMsg := nil |
|
339 |
] |
|
340 |
] |
|
341 |
]. |
|
342 |
||
343 |
errMsg notNil ifTrue:[ |
|
344 |
box := WarningBox new. |
|
345 |
box title:errMsg. |
|
346 |
box showAtPointerNotCovering:(WindowGroup activeGroup topViews first). |
|
1 | 347 |
stop ifTrue:[^ false]. |
0 | 348 |
]. |
349 |
||
350 |
Delay waitForSeconds:0.25. |
|
351 |
nDone := nDone + 1. |
|
352 |
]. |
|
353 |
^ true |
|
354 |
||
355 |
"Created: 17.7.1996 / 15:24:19 / cg" |
|
1 | 356 |
"Modified: 18.7.1996 / 22:18:38 / cg" |
19 | 357 |
! |
358 |
||
359 |
createSymbolicLinks |
|
360 |
|msg dirsToMake numDirs nDone| |
|
361 |
||
362 |
msg := (resources array:#('ST/X Installation' '' 'creating symbolic links' '' '' '')) asStringCollection. |
|
363 |
||
28 | 364 |
commandTraceView showCR:(resources string:'setting up symbolic links in doc/online ...'). |
20 | 365 |
OperatingSystem executeCommand:('cd ' , stxLibDir , '/doc/online ; make links'). |
19 | 366 |
^ true |
367 |
||
368 |
"Created: 17.7.1996 / 15:24:19 / cg" |
|
369 |
"Modified: 18.7.1996 / 22:18:38 / cg" |
|
0 | 370 |
! ! |
371 |
||
372 |
!STXInstaller methodsFor:'startup'! |
|
373 |
||
374 |
askAndInstall |
|
375 |
"/ check, if we are in the projects/smalltalk directory |
|
376 |
||
11 | 377 |
resources := ResourcePack for:self class. |
378 |
||
0 | 379 |
(Filename currentDirectory pathName endsWith:'projects/smalltalk') ifFalse:[ |
11 | 380 |
self warn:(resources string:'must be in the ''projects/smalltalk'' directory'). |
0 | 381 |
^ self |
382 |
]. |
|
383 |
||
384 |
[self askForDestination] whileTrue:[ |
|
385 |
self checkForExistingInstallationAndConfirm ifFalse:[ |
|
386 |
^ self |
|
387 |
]. |
|
25
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
388 |
self preInstall. |
0 | 389 |
self doInstall ifTrue:[ |
1 | 390 |
self postInstall. |
0 | 391 |
^ self |
392 |
]. |
|
11 | 393 |
(self confirm:(resources string:'installation failed or aborted - retry ?')) |
0 | 394 |
ifFalse:[ |
395 |
^ self |
|
396 |
] |
|
397 |
]. |
|
398 |
||
1 | 399 |
"Modified: 18.7.1996 / 21:20:56 / cg" |
0 | 400 |
! |
401 |
||
402 |
askForDestination |
|
403 |
"open a dialog to enter destination directories" |
|
404 |
||
2 | 405 |
|d cm l green dark img |
24 | 406 |
stxLibDirHolder stxLibBinDirHolder stxBinDirHolder |
5 | 407 |
installDocHolder installSourceHolder installSTCHolder installGoodiesHolder |
11 | 408 |
binMegabytes libMegabytes |
0 | 409 |
| |
410 |
||
11 | 411 |
binMegabytes := 10. |
412 |
libMegabytes := 10. |
|
413 |
||
0 | 414 |
LastLibDir isNil ifTrue:[ |
415 |
LastLibDir := '/usr/local/lib/smalltalk' |
|
416 |
]. |
|
24 | 417 |
LastLibBinDir isNil ifTrue:[ |
418 |
LastLibBinDir := '/usr/local/lib' |
|
419 |
]. |
|
0 | 420 |
LastBinDir isNil ifTrue:[ |
421 |
LastBinDir := '/usr/local/bin' |
|
422 |
]. |
|
423 |
||
424 |
stxLibDirHolder := LastLibDir asValue. |
|
24 | 425 |
stxLibBinDirHolder := LastLibBinDir asValue. |
0 | 426 |
stxBinDirHolder := LastBinDir asValue. |
24 | 427 |
|
5 | 428 |
installDocHolder := true asValue. |
429 |
installSourceHolder := true asValue. |
|
430 |
installSTCHolder := true asValue. |
|
431 |
installGoodiesHolder := true asValue. |
|
0 | 432 |
|
433 |
Screen current hasColors ifTrue:[ |
|
434 |
green := (Color red:0 green:80 blue:20) "darkened". |
|
435 |
dark := Color grey:10. |
|
436 |
] ifFalse:[ |
|
437 |
green := Color white. |
|
438 |
dark := Color black. |
|
439 |
]. |
|
440 |
||
441 |
d := DialogBox new. |
|
442 |
||
11 | 443 |
d label:(resources string:'ST/X CD Installation'). |
2 | 444 |
img := Image fromFile:'SmalltalkX.xbm'. |
445 |
||
446 |
l := d addTextLabel:img. |
|
447 |
l adjust:#left; foregroundColor:green backgroundColor:dark. |
|
448 |
||
11 | 449 |
l := d addTextLabel:(resources string:'Smalltalk/X CD installation.'). |
0 | 450 |
l adjust:#left; backgroundColor:dark; foregroundColor:Color white. |
451 |
d addVerticalSpace. |
|
452 |
d addVerticalSpace. |
|
453 |
||
454 |
d addHorizontalLine. |
|
455 |
||
11 | 456 |
l := d addTextLabel:(resources string:'Destination directories:'). |
0 | 457 |
l adjust:#left; backgroundColor:dark; foregroundColor:Color white. |
458 |
||
459 |
cm := ComboBoxView on:stxBinDirHolder. |
|
1 | 460 |
cm list:self defaultBinDirs. |
0 | 461 |
d |
462 |
addLabelledField:cm |
|
11 | 463 |
label:(resources string:'binaries') |
0 | 464 |
adjust:#left |
465 |
tabable:true |
|
466 |
from:0.0 to:1.0 separateAtX:0.25 |
|
467 |
nameAs:'binaryBox'. |
|
468 |
||
469 |
(d componentAt:'binaryBox.label') backgroundColor:dark; foregroundColor:Color white. |
|
470 |
||
24 | 471 |
cm := ComboBoxView on:stxLibBinDirHolder. |
472 |
cm list:self defaultLibBinDirs. |
|
473 |
d |
|
474 |
addLabelledField:cm |
|
475 |
label:(resources string:'libraries') |
|
476 |
adjust:#left |
|
477 |
tabable:true |
|
478 |
from:0.0 to:1.0 separateAtX:0.25 |
|
479 |
nameAs:'libraryBinBox'. |
|
480 |
||
481 |
(d componentAt:'libraryBinBox.label') backgroundColor:dark; foregroundColor:Color white. |
|
482 |
||
0 | 483 |
cm := ComboBoxView on:stxLibDirHolder. |
1 | 484 |
cm list:self defaultLibDirs. |
0 | 485 |
d |
486 |
addLabelledField:cm |
|
24 | 487 |
label:(resources string:'help files') |
0 | 488 |
adjust:#left |
489 |
tabable:true |
|
490 |
from:0.0 to:1.0 separateAtX:0.25 |
|
491 |
nameAs:'libraryBox'. |
|
492 |
||
493 |
(d componentAt:'libraryBox.label') backgroundColor:dark; foregroundColor:Color white. |
|
494 |
||
5 | 495 |
d addVerticalSpace. |
496 |
d addHorizontalLine. |
|
497 |
d addVerticalSpace. |
|
498 |
||
11 | 499 |
(d addTextLabel:(resources string:'required:')) |
5 | 500 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
501 |
||
502 |
d leftIndent:35. |
|
11 | 503 |
(d addTextLabel:(resources string:'binaries (approx. %1 Mb)' with:binMegabytes printString)) |
5 | 504 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
11 | 505 |
(d addTextLabel:(resources string:'libraries (approx. %1 Mb)' with:libMegabytes printString)) |
5 | 506 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
507 |
d leftIndent:0. |
|
508 |
||
509 |
d addVerticalSpace. |
|
510 |
d addHorizontalLine. |
|
511 |
d addVerticalSpace. |
|
512 |
||
11 | 513 |
(d addTextLabel:(resources string:'optional:')) |
5 | 514 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
515 |
||
11 | 516 |
(d addCheckBox:((resources string:'doc files') , ' (+8 Mb)') on:installDocHolder) |
5 | 517 |
labelView foregroundColor:Color white backgroundColor:dark. |
11 | 518 |
(d addCheckBox:((resources string:'stc & support files') , ' (+2 Mb)') on:installSTCHolder) |
10 | 519 |
labelView foregroundColor:Color white backgroundColor:dark. |
520 |
||
521 |
d addVerticalSpace. |
|
522 |
d addHorizontalLine. |
|
523 |
d addVerticalSpace. |
|
524 |
||
11 | 525 |
(d addTextLabel:(resources string:'optional (but highly recommended):')) |
10 | 526 |
adjust:#left; foregroundColor:Color white backgroundColor:dark. |
527 |
||
11 | 528 |
(d addCheckBox:((resources string:'smalltalk source files') , ' (+12 Mb)') on:installSourceHolder) |
5 | 529 |
labelView foregroundColor:Color white backgroundColor:dark. |
11 | 530 |
(d addCheckBox:((resources string:'goodies') , ' (+0.5 Mb)') on:installGoodiesHolder) |
5 | 531 |
labelView foregroundColor:Color white backgroundColor:dark. |
532 |
||
533 |
d addVerticalSpace. |
|
534 |
d addHorizontalLine. |
|
535 |
||
24 | 536 |
d addHelpButtonFor:'STXInstaller/installHelp.html'; |
537 |
addAbortButton; |
|
538 |
addOkButtonLabelled:(resources string:'install'). |
|
0 | 539 |
d extent:400@300. |
540 |
||
541 |
d allViewBackground:dark. |
|
542 |
||
543 |
d openAtCenter. |
|
544 |
d accepted ifTrue:[ |
|
545 |
stxLibDir := LastLibDir := stxLibDirHolder value. |
|
24 | 546 |
stxLibBinDir := LastLibBinDir := stxLibBinDirHolder value. |
0 | 547 |
stxBinDir := LastBinDir := stxBinDirHolder value. |
5 | 548 |
installDocFiles := installDocHolder value. |
549 |
installSourceFiles := installSourceHolder value. |
|
550 |
installSTCFiles := installSTCHolder value. |
|
551 |
installGoodyFiles := installGoodiesHolder value. |
|
1 | 552 |
d destroy. |
0 | 553 |
^ true |
554 |
]. |
|
1 | 555 |
d destroy. |
0 | 556 |
^ false |
557 |
||
1 | 558 |
"Modified: 18.7.1996 / 19:43:38 / cg" |
0 | 559 |
! |
560 |
||
561 |
checkForExistingInstallationAndConfirm |
|
562 |
"look if there is another installation and confirm |
|
563 |
reinstalling; return true if ok, false if not" |
|
564 |
||
1 | 565 |
|whatToDo| |
566 |
||
0 | 567 |
stxLibDir asFilename exists ifTrue:[ |
1 | 568 |
whatToDo := Dialog |
11 | 569 |
choose:(resources |
570 |
string:'detected existing ST/X installation in %1' |
|
571 |
with:stxLibDir asText allBold) |
|
572 |
label:(resources string:'Attention') |
|
573 |
labels:(resources array:#('remove first' 'overwrite' 'cancel')) |
|
1 | 574 |
values:#(remove over nil) |
575 |
default:nil. |
|
576 |
whatToDo isNil ifTrue:[^false]. |
|
577 |
whatToDo == #remove ifTrue:[ |
|
23
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
578 |
((stxLibDir findString:'stx') == 0 |
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
579 |
and:[(stxLibDir findString:'smalltalk') == 0]) ifTrue:[ |
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
580 |
"/ confirm again |
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
581 |
(self confirm:(resources |
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
582 |
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
|
583 |
is really an smalltalk directory ? |
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
584 |
|
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
585 |
Remove it now ?')) ifFalse:[ ^ true]. |
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
586 |
]. |
42997b231783
double confirm removal of directory, if its name
Claus Gittinger <cg@exept.de>
parents:
22
diff
changeset
|
587 |
|
1 | 588 |
(OperatingSystem recursiveRemoveDirectory:stxLibDir) |
589 |
ifFalse:[ |
|
11 | 590 |
self warn:(resources string:'mhmh - could not remove old installation.') |
1 | 591 |
]. |
592 |
]. |
|
593 |
^ true |
|
594 |
"/ ^ DialogBox |
|
595 |
"/ confirm:('detected existing installation in ' |
|
596 |
"/ , stxLibDir asText allBold |
|
597 |
"/ , '\\continue & overwrite ?') withCRs |
|
598 |
"/ yesLabel:'overwrite' noLabel:'cancel' |
|
0 | 599 |
|
600 |
]. |
|
601 |
^ true |
|
602 |
||
1 | 603 |
"Modified: 18.7.1996 / 20:01:36 / cg" |
0 | 604 |
! |
605 |
||
606 |
doInstall |
|
607 |
"install ST/X; return true if ok, false if not" |
|
608 |
||
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
609 |
|progressView ok textView| |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
610 |
|
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
611 |
textView := HVScrollableView for:TextCollector. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
612 |
textView preferredExtent:(100 @ 250). |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
613 |
commandTraceView := textView scrolledView. |
0 | 614 |
|
615 |
progressView := ProgressIndicator |
|
26 | 616 |
inBoxWithLabel:'ST/X Installation' icon:(Depth8Image fromImage:Launcher aboutIcon) |
0 | 617 |
text:#('ST/X Installation' '' '' '' '' '' '' '') asStringCollection |
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
618 |
abortable:true |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
619 |
view:textView |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
620 |
closeWhenDone:false. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
621 |
progressView topView extent:(500 min:Display width) @ 300. |
0 | 622 |
|
623 |
ok := false. |
|
624 |
||
625 |
progressView showProgressOf: |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
626 |
[:progressValue :currentAction| |msg| |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
627 |
|
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
628 |
Processor activeProcess withPriority:7 do:[ |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
629 |
actionPercentageHolder := progressValue. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
630 |
actionTextHolder := currentAction. |
0 | 631 |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
632 |
(self createDirectories) ifTrue:[ |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
633 |
ok := self copyFiles |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
634 |
]. |
19 | 635 |
self createSymbolicLinks. |
636 |
||
6 | 637 |
progressValue value:100. |
638 |
||
11 | 639 |
progressView topView abortButton label:(resources string:'continue'). |
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
640 |
progressView topView abortButton action:[progressView topView hide]. |
11 | 641 |
msg := (resources |
642 |
array:#('ST/X Installation finished.' '' 'press continue ...' '' '' '')) |
|
643 |
asStringCollection. |
|
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
644 |
actionTextHolder value:nil. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
645 |
actionTextHolder value:msg. |
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
646 |
] |
0 | 647 |
]. |
648 |
||
649 |
^ ok |
|
650 |
||
651 |
"Created: 17.7.1996 / 15:11:27 / cg" |
|
652 |
"Modified: 17.7.1996 / 15:24:27 / cg" |
|
653 |
! |
|
654 |
||
655 |
open |
|
1 | 656 |
self askAndInstall. |
0 | 657 |
|
5 | 658 |
" |
659 |
STXInstaller open |
|
660 |
" |
|
1 | 661 |
! |
662 |
||
663 |
postInstall |
|
664 |
"some messages at the end ..." |
|
665 |
||
4
8b68fdf7c870
better looking; show command output
Claus Gittinger <cg@exept.de>
parents:
3
diff
changeset
|
666 |
|shInfo cshInfo msg havePath| |
1 | 667 |
|
11 | 668 |
msg := (resources string:'ST/X Installation complete.\\') withCRs. |
1 | 669 |
shInfo := ''. |
670 |
cshInfo := ''. |
|
671 |
||
672 |
havePath := true. |
|
673 |
(((OperatingSystem getEnvironment:'PATH') |
|
674 |
asCollectionOfSubstringsSeparatedBy:$:) |
|
675 |
includes:stxBinDir) ifFalse:[ |
|
676 |
||
677 |
havePath := false. |
|
678 |
shInfo := 'PATH=$PATH:' , stxBinDir , ' ; export PATH\'. |
|
679 |
cshInfo := 'set path=($path ' , stxBinDir , ')\'. |
|
11 | 680 |
msg := msg , (resources string:'%1 is not in your PATH.\You should change your ".login" and/or ".profile" files to include it.\\' |
681 |
with:stxBinDir asText allBold) withCRs. |
|
1 | 682 |
]. |
683 |
||
684 |
(stxLibDir ~= '/usr/local/lib/smalltalk' |
|
685 |
and:[stxLibDir ~= '/usr/lib/smalltalk']) ifTrue:[ |
|
11 | 686 |
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.\' |
687 |
with:'STX_LIBDIR' asText allBold |
|
688 |
with:stxLibDir asText allBold) withCRs. |
|
1 | 689 |
havePath ifFalse:[ |
11 | 690 |
msg := msg , (resources string:'The above mentioned files are also a good place to do this.\') withCRs. |
1 | 691 |
] ifTrue:[ |
11 | 692 |
msg := msg , (resources string:'The ".login" and/or ".profile" files are a good place to do this.\') withCRs. |
1 | 693 |
]. |
694 |
||
695 |
shInfo := shInfo , 'STX_LIBDIR=' , stxLibDir , ' ; export STX_LIBDIR\'. |
|
696 |
cshInfo := cshInfo , 'setenv STX_LIBDIR ' , stxLibDir , '\'. |
|
697 |
]. |
|
698 |
||
699 |
shInfo notEmpty ifTrue:[ |
|
11 | 700 |
'*********************************************************' errorPrintCR. |
701 |
(resources string:'Message from the ST/X Installer:\\') withCRs errorPrintCR. |
|
702 |
(resources string:'Please add the following to your ".profile" file:') withCRs errorPrintCR. |
|
1 | 703 |
'' errorPrintCR. |
704 |
shInfo withCRs errorPrintCR. |
|
705 |
'' errorPrintCR. |
|
11 | 706 |
(resources string:'or (if you use csh/tcsh), add to your ".login" file:') withCRs errorPrintCR. |
1 | 707 |
'' errorPrintCR. |
708 |
cshInfo withCRs errorPrintCR. |
|
709 |
'' errorPrintCR. |
|
11 | 710 |
'*********************************************************' errorPrintCR. |
1 | 711 |
]. |
712 |
self information:msg. |
|
713 |
||
714 |
" |
|
715 |
STXInstaller new postInstall |
|
716 |
" |
|
717 |
||
718 |
"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
|
719 |
! |
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 |
preInstall |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
722 |
"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
|
723 |
|
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
724 |
|f| |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
725 |
|
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
726 |
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
|
727 |
f exists ifTrue:[ |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
728 |
f isSymbolicLink ifTrue:[ |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
729 |
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
|
730 |
] |
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 |
STXInstaller new preInstall |
42ee3e7ced09
remove local symbolic links (if any) in doc/online
Claus Gittinger <cg@exept.de>
parents:
24
diff
changeset
|
735 |
" |
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 |
"Modified: 18.7.1996 / 22:10:42 / cg" |
0 | 738 |
! ! |
739 |
||
28 | 740 |
!STXInstaller class methodsFor:'documentation'! |
0 | 741 |
|
742 |
version |
|
743 |
^ '$Header$' |
|
744 |
! ! |