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