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