# HG changeset patch # User Claus Gittinger # Date 842372634 -7200 # Node ID 9bc23682b68cf96449ebd3c9593d7342d9c05fb8 # Parent c9574685e1571a9fec23d46d66073234b4d7a372 national strings diff -r c9574685e157 -r 9bc23682b68c STXInstaller.st --- a/STXInstaller.st Tue Sep 10 16:57:38 1996 +0200 +++ b/STXInstaller.st Tue Sep 10 18:23:54 1996 +0200 @@ -13,8 +13,9 @@ open ^ self new open - "Created: 17.7.1996 / 14:36:22 / cg" - "Modified: 18.7.1996 / 21:20:22 / cg" + " + STXInstaller open + " ! ! !STXInstaller methodsFor:'defaults'! @@ -67,14 +68,27 @@ "Created: 18.7.1996 / 19:43:21 / cg" "Modified: 18.7.1996 / 19:46:04 / cg" -! ! +! -!STXInstaller methodsFor:'installing'! +directoriesToMake + |dirsToMake| -copyFiles - |msg fileSpec filesToCopy numFiles nDone| + dirsToMake := OrderedCollection new. + dirsToMake add:stxBinDir. + dirsToMake add:stxLibDir. + dirsToMake add:(stxLibDir asFilename constructString:'lib'). + dirsToMake add:(stxLibDir asFilename constructString:'doc'). + dirsToMake add:(stxLibDir asFilename constructString:'include'). + dirsToMake add:(stxLibDir asFilename constructString:'resources'). + dirsToMake add:(stxLibDir asFilename constructString:'binary'). + dirsToMake add:(stxLibDir asFilename constructString:'bitmaps'). + dirsToMake add:(stxLibDir asFilename constructString:'goodies'). - msg := #('ST/X Installation' '' 'copying:' '' 'to:' '') asStringCollection. + ^ dirsToMake +! + +specOfFilesToCopy + |fileSpec| fileSpec := #( "/ name destination subDir required mode @@ -141,6 +155,20 @@ ). ]. + + ^ fileSpec + +! ! + +!STXInstaller methodsFor:'installing'! + +copyFiles + |msg fileSpec filesToCopy numFiles nDone| + + msg := (resources array:#('ST/X Installation' '' 'copying:' '' 'to:' '')) asStringCollection. + + fileSpec := self specOfFilesToCopy. + filesToCopy := OrderedCollection new. fileSpec do:[:entry | @@ -169,7 +197,7 @@ nDone := 0. filesToCopy do:[:entry | - |fileName destDir cmd p text line| + |fileName destDir cmd p text line doneSemaphore| fileName := entry key. destDir := entry value. @@ -187,25 +215,28 @@ commandTraceView showCR:cmd , ' ...'. cmd := 'sh -c "echo ; ' , cmd , ' 2>&1"' . - p := PipeStream readingFrom:cmd. - p isNil ifTrue:[ - self warn:('command error. Could not execute:\\' , cmd) withCRs. - ] ifFalse:[ - "/ text := OrderedCollection new. - [p atEnd] whileFalse:[ - p readWaitWithTimeout:0.1. - line := p nextLine. - (line notNil and:[line notEmpty]) ifTrue:[ - commandTraceView showCR:((' ' , line) asText emphasizeAllWith:(#color->Color red)). - "/ text add:line - ] + doneSemaphore := Semaphore new. + + [ + + p := PipeStream readingFrom:cmd. + p isNil ifTrue:[ + self warn:('command error. Could not execute:\\' , cmd) withCRs. + ] ifFalse:[ + [p atEnd] whileFalse:[ + [p readWaitWithTimeout:0.1] whileTrue:[]. + line := p nextLine. + (line notNil and:[line notEmpty]) ifTrue:[ + commandTraceView showCR:((' ' , line) asText emphasizeAllWith:(#color->Color red)). + ] + ]. + p close. ]. - p close. - ]. - "/ (OperatingSystem executeCommand:('cp -r ../../' , fileName , ' ' , destDir)) - "/ ifFalse:[ - "/ self warn:('error while copying ' , fileName , '\\Please check manually.') withCRs. - "/ ]. + doneSemaphore signal. + ] forkAt:4. + + doneSemaphore wait. + ]. nDone := nDone + 1 @@ -220,18 +251,9 @@ createDirectories |msg dirsToMake numDirs nDone| - msg := #('ST/X Installation' '' 'creating directory:' '' '' '') asStringCollection. + msg := (resources array:#('ST/X Installation' '' 'creating directory:' '' '' '')) asStringCollection. - dirsToMake := OrderedCollection new. - dirsToMake add:stxBinDir. - dirsToMake add:stxLibDir. - dirsToMake add:(stxLibDir asFilename constructString:'lib'). - dirsToMake add:(stxLibDir asFilename constructString:'doc'). - dirsToMake add:(stxLibDir asFilename constructString:'include'). - dirsToMake add:(stxLibDir asFilename constructString:'resources'). - dirsToMake add:(stxLibDir asFilename constructString:'binary'). - dirsToMake add:(stxLibDir asFilename constructString:'bitmaps'). - dirsToMake add:(stxLibDir asFilename constructString:'goodies'). + dirsToMake := self directoriesToMake. numDirs := dirsToMake size. nDone := 0. @@ -247,23 +269,23 @@ d := dirName asFilename. - commandTraceView showCR:'creating ' , d pathName , ' ...'. + commandTraceView showCR:(resources string:'creating %1 ...' with:d pathName). d exists ifFalse:[ OperatingSystem recursiveCreateDirectory:d pathName ]. d exists ifFalse:[ - errMsg := 'failed to create directory: ' , dirName. + errMsg := resources string:'failed to create directory: %1' with: dirName. stop := true ] ifTrue:[ d isDirectory ifFalse:[ - errMsg := 'not a directory: ' , dirName. + errMsg := resources string:'not a directory: %1' with:dirName. stop := true ] ifTrue:[ (d isReadable and:[d isWritable]) ifFalse:[ - errMsg := 'no R/W access to directory: ' , dirName. + errMsg := resources string:'no read/write access to directory: %1' with:dirName. stop := false ] ifTrue:[ errMsg := nil @@ -292,8 +314,10 @@ askAndInstall "/ check, if we are in the projects/smalltalk directory + resources := ResourcePack for:self class. + (Filename currentDirectory pathName endsWith:'projects/smalltalk') ifFalse:[ - self warn:'must be in the projects/smalltalk directory'. + self warn:(resources string:'must be in the ''projects/smalltalk'' directory'). ^ self ]. @@ -305,7 +329,7 @@ self postInstall. ^ self ]. - (self confirm:'installation failed or aborted - retry ?') + (self confirm:(resources string:'installation failed or aborted - retry ?')) ifFalse:[ ^ self ] @@ -320,8 +344,12 @@ |d cm l green dark img stxLibDirHolder stxBinDirHolder installDocHolder installSourceHolder installSTCHolder installGoodiesHolder + binMegabytes libMegabytes | + binMegabytes := 10. + libMegabytes := 10. + LastLibDir isNil ifTrue:[ LastLibDir := '/usr/local/lib/smalltalk' ]. @@ -346,27 +374,27 @@ d := DialogBox new. - d label:'ST/X CD Installation'. + d label:(resources string:'ST/X CD Installation'). img := Image fromFile:'SmalltalkX.xbm'. l := d addTextLabel:img. l adjust:#left; foregroundColor:green backgroundColor:dark. - l := d addTextLabel:'Smalltalk/X CD installation.'. + l := d addTextLabel:(resources string:'Smalltalk/X CD installation.'). l adjust:#left; backgroundColor:dark; foregroundColor:Color white. d addVerticalSpace. d addVerticalSpace. d addHorizontalLine. - l := d addTextLabel:'Destination directories:'. + l := d addTextLabel:(resources string:'Destination directories:'). l adjust:#left; backgroundColor:dark; foregroundColor:Color white. cm := ComboBoxView on:stxBinDirHolder. cm list:self defaultBinDirs. d addLabelledField:cm - label:'binaries' + label:(resources string:'binaries') adjust:#left tabable:true from:0.0 to:1.0 separateAtX:0.25 @@ -378,7 +406,7 @@ cm list:self defaultLibDirs. d addLabelledField:cm - label:'libraries' + label:(resources string:'libraries') adjust:#left tabable:true from:0.0 to:1.0 separateAtX:0.25 @@ -390,13 +418,13 @@ d addHorizontalLine. d addVerticalSpace. - (d addTextLabel:('required:')) + (d addTextLabel:(resources string:'required:')) adjust:#left; foregroundColor:Color white backgroundColor:dark. d leftIndent:35. - (d addTextLabel:('binaries (approx. 10 Mb)')) + (d addTextLabel:(resources string:'binaries (approx. %1 Mb)' with:binMegabytes printString)) adjust:#left; foregroundColor:Color white backgroundColor:dark. - (d addTextLabel:('libraries (approx. 10 Mb)')) + (d addTextLabel:(resources string:'libraries (approx. %1 Mb)' with:libMegabytes printString)) adjust:#left; foregroundColor:Color white backgroundColor:dark. d leftIndent:0. @@ -404,30 +432,30 @@ d addHorizontalLine. d addVerticalSpace. - (d addTextLabel:('optional:')) + (d addTextLabel:(resources string:'optional:')) adjust:#left; foregroundColor:Color white backgroundColor:dark. - (d addCheckBox:('doc files (+8 Mb)') on:installDocHolder) + (d addCheckBox:((resources string:'doc files') , ' (+8 Mb)') on:installDocHolder) labelView foregroundColor:Color white backgroundColor:dark. - (d addCheckBox:('stc & support files (+2 Mb)') on:installSTCHolder) + (d addCheckBox:((resources string:'stc & support files') , ' (+2 Mb)') on:installSTCHolder) labelView foregroundColor:Color white backgroundColor:dark. d addVerticalSpace. d addHorizontalLine. d addVerticalSpace. - (d addTextLabel:('optional (but highly recommended):')) + (d addTextLabel:(resources string:'optional (but highly recommended):')) adjust:#left; foregroundColor:Color white backgroundColor:dark. - (d addCheckBox:('smalltalk source files (+12 Mb)') on:installSourceHolder) + (d addCheckBox:((resources string:'smalltalk source files') , ' (+12 Mb)') on:installSourceHolder) labelView foregroundColor:Color white backgroundColor:dark. - (d addCheckBox:('goodies (+0.5 Mb)') on:installGoodiesHolder) + (d addCheckBox:((resources string:'goodies') , ' (+0.5 Mb)') on:installGoodiesHolder) labelView foregroundColor:Color white backgroundColor:dark. d addVerticalSpace. d addHorizontalLine. - d addAbortButton; addOkButtonLabelled:'install'. + d addAbortButton; addOkButtonLabelled:(resources string:'install'). d extent:400@300. d allViewBackground:dark. @@ -457,17 +485,18 @@ stxLibDir asFilename exists ifTrue:[ whatToDo := Dialog - choose:('detected existing installation in ' - , stxLibDir asText allBold) - label:'Attention' - labels:#('remove first' 'overwrite' 'cancel') + choose:(resources + string:'detected existing ST/X installation in %1' + with:stxLibDir asText allBold) + label:(resources string:'Attention') + labels:(resources array:#('remove first' 'overwrite' 'cancel')) values:#(remove over nil) default:nil. whatToDo isNil ifTrue:[^false]. whatToDo == #remove ifTrue:[ (OperatingSystem recursiveRemoveDirectory:stxLibDir) ifFalse:[ - self warn:'mhmh - could not remove old installation.' + self warn:(resources string:'mhmh - could not remove old installation.') ]. ]. ^ true @@ -514,9 +543,11 @@ ]. progressValue value:100. - progressView topView abortButton label:'continue'. + progressView topView abortButton label:(resources string:'continue'). progressView topView abortButton action:[progressView topView hide]. - msg := #('ST/X Installation finished.' '' 'press continue ...' '' '' '') asStringCollection. + msg := (resources + array:#('ST/X Installation finished.' '' 'press continue ...' '' '' '')) + asStringCollection. actionTextHolder value:nil. actionTextHolder value:msg. ] @@ -541,7 +572,7 @@ |shInfo cshInfo msg havePath| - msg := 'ST/X Installation complete.\\' withCRs. + msg := (resources string:'ST/X Installation complete.\\') withCRs. shInfo := ''. cshInfo := ''. @@ -553,27 +584,19 @@ havePath := false. shInfo := 'PATH=$PATH:' , stxBinDir , ' ; export PATH\'. cshInfo := 'set path=($path ' , stxBinDir , ')\'. - msg := msg , stxBinDir asText allBold , ' is not in your PATH. -You should change your ".login" and/or ".profile" files to include it. - -' + msg := msg , (resources string:'%1 is not in your PATH.\You should change your ".login" and/or ".profile" files to include it.\\' + with:stxBinDir asText allBold) withCRs. ]. (stxLibDir ~= '/usr/local/lib/smalltalk' and:[stxLibDir ~= '/usr/lib/smalltalk']) ifTrue:[ - msg := msg , -'The library directory is not a standard ST/X library directory -("/usr/local/lib/smalltalk" or "/usr/lib/smalltalk"). -You have to define the ' , 'STX_LIBDIR' asText allBold ,' environment variable -as ' , stxLibDir asText allBold , ' before ST/X can be started. -'. - + 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.\' + with:'STX_LIBDIR' asText allBold + with:stxLibDir asText allBold) withCRs. havePath ifFalse:[ - msg := msg , 'The above mentioned files are also a good place to do this. -'. + msg := msg , (resources string:'The above mentioned files are also a good place to do this.\') withCRs. ] ifTrue:[ - msg := msg , 'The ".login" and/or ".profile" files are a good place to do this. -'. + msg := msg , (resources string:'The ".login" and/or ".profile" files are a good place to do this.\') withCRs. ]. shInfo := shInfo , 'STX_LIBDIR=' , stxLibDir , ' ; export STX_LIBDIR\'. @@ -581,14 +604,17 @@ ]. shInfo notEmpty ifTrue:[ - 'Please add the following to your ".profile" file:' errorPrintCR. + '*********************************************************' errorPrintCR. + (resources string:'Message from the ST/X Installer:\\') withCRs errorPrintCR. + (resources string:'Please add the following to your ".profile" file:') withCRs errorPrintCR. '' errorPrintCR. shInfo withCRs errorPrintCR. '' errorPrintCR. - 'or (if you use csh/tcsh), add to your ".login" file:' errorPrintCR. + (resources string:'or (if you use csh/tcsh), add to your ".login" file:') withCRs errorPrintCR. '' errorPrintCR. cshInfo withCRs errorPrintCR. '' errorPrintCR. + '*********************************************************' errorPrintCR. ]. self information:msg.