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