📄 install.old
字号:
# <destFile> : an absolute path filename
# [option] : none | update | overwrite
#
# RETURNS: True or False bases on success or failure.
#
# ERRORS: N/A
#
proc fileDup {sourceFilePath destFilePath {option none}} {
global ctrlVals setupVals
if ![file exists $sourceFilePath] {
if [debug] {
puts "$sourceFilePath not found"
}
return 0
}
regsub -all {\\} $destFilePath {/} destFilePathUnixStyle
regsub -all {\\} [destDirGet] {/} destDir
regsub "$destDir/" $destFilePathUnixStyle "" relDestFilePathUnix
switch $option {
none {
if [file exists $destFilePath] {return 1}
}
update {
if {[file exists $destFilePath] &&
[file mtime $sourceFilePath] <= [file mtime $destFilePath]} {
return 1
} elseif {[file exists $destFilePath]} {
backup $relDestFilePathUnix
}
}
overwrite {
if {[file exists $destFilePath]} {
backup $relDestFilePathUnix
}
}
default {
puts "fileDup $sourceFilePath $destFilePath $option"
puts "unknown option: $option"
}
}
set destDir [file dirname $destFilePath]
if {![file isdirectory $destDir] && [catch {file mkdir $destDir} error]} {
puts "$error"
return 0
}
if [catch {file copy -force $sourceFilePath $destFilePath} error] {
set msg [strTableGet 1370_FILE_ACCESS_ERROR $destFilePath $error]
switch [dialog re_ig_cancel "Setup" $msg question 0] {
0 {return [fileDup $sourceFilePath $destFilePath $option]}
1 {
set msg "\tcannot create $destFilePath: $error"
lastErrorSet $msg
uninstLog setup $msg
return 0
}
default {quitCallback}
}
}
if {[info exists setupVals(fileMode)] && [windHostTypeGet] != "x86-win32"} {
catch {exec chmod $setupVals(fileMode) $destFilePath}
}
# logging for later uninstall
uninstLog file "wind_base\t$relDestFilePathUnix"
return 1
}
##############################################################################
#
# pageRemove - removes an installation step
#
# This routine removes an element from the pageList which control the flow of
# the setup script. Once an element is removed from the list, their associate
# functions, pageCreate() and pageProcess() will be skipped.
#
# SYNOPSIS
# pageRemove <pageName>
#
# PARAMETERS:
# <pageName> : an element in the pageList
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc pageRemove {page} {
global ctrlVals
if {[lsearch $ctrlVals(pageList) $page] == "-1"} {
if [debug] {puts "cannot find page $page to remove"}
} {
set tempList ""
foreach p $ctrlVals(pageList) {
if {"$p" != "$page"} {
lappend tempList $p
}
}
set ctrlVals(pageList) $tempList
}
}
##############################################################################
#
# bbrdListGet - obtains a list of bitmaps
#
# This routine walks thru all selected products, and extracts the available
# bitmaps.
#
# SYNOPSIS
# bbrdListGet <extension>
#
# PARAMETERS:
# <extension> : bitmap file extension, supported extension are .BMP and .PPM
#
# RETURNS: a list of bitmap filename.
#
# ERRORS: N/A
#
proc bbrdListGet {extension} {
global ctrlVals
set retVal ""
set newList ""
if {[windHostTypeGet] == "x86-win32"} {
set zipFile [cdromZipDirGet]\\WIND.000
} {
set zipFile [cdromZipDirGet]/WIND.000
}
set prodNameList "prologue"
lappend prodNameList [cdInfoGet selectedProdNameList]
lappend prodNameList "epilogue"
set prodNameList [join $prodNameList]
foreach prodName $prodNameList {
if ![catch {setupUnzip -o -qq -d [tempDirGet] $zipFile "$prodName/*$extension"} \
error] {
set saveDir [pwd]
cd [tempDirGet]/$prodName
set bbrdList [glob -nocomplain "*$extension"]
foreach bbrdFile $bbrdList {
if {[windHostTypeGet] == "x86-win32"} {
lappend newList "[tempDirGet]\\$prodName\\$bbrdFile"
} {
lappend newList "[tempDirGet]/$prodName/$bbrdFile"
}
}
cd $saveDir
}
}
return $newList
}
##############################################################################
#
# execute - executes product pre/postInstall tcl script
#
# This procedure extracts the provided tclFile, if exists, then evaluates it.
#
# SYNOPSIS
# execute <tclFile>
#
# PARAMETERS:
# <tclFile> : product preInstall.tcl or postInstall.tcl
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc execute {tclFile} {
set zipFile [cdromZipDirGet]/WIND.000
if {[file exists $zipFile]} {
if ![catch {setupUnzip -o -qq -d [tempDirGet] $zipFile $tclFile} retVal] {
if ![catch {open [tempDirGet]/$tclFile "r"} fp] {
set retVal [read $fp]
close $fp
if [debug] {
puts "Evaluating $tclFile"
puts "$retVal"
}
if [catch {eval $retVal} error] {
puts "$error"
}
}
}
}
}
##############################################################################
#
# byteToMbyte - converts bytes to Mbytes
#
# SYNOPSIS
# byteToMbyte <size>
#
# PARAMETERS:
# <byte> : number in bytes
#
# RETURNS: number in mega bytes
#
# ERRORS: N/A
#
proc byteToMbyte {size} {
return [format "%3.1f" [expr $size / 1048576.0]]
}
##############################################################################
#
# objectConstruct - creates objects to store all information about the unlocked
# products.
#
# This function must be called prior to the following functions: cdInfoGet/Set
# SYNOPSIS
# objectConstruct
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc objectConstruct {} {
global productObj partObj featureObj cdObj
global constructed
if ![info exists constructed([instKeyGet])] {
catch {
unset constructed
unset productObj
unset partObj
unset featureObj
}
set constructed([instKeyGet]) 1
set productDescList {}
foreach prodIndex [setupProductIndexListGet] {
set productObj($prodIndex,instFlag) 0
set productObj($prodIndex,prevInstFlag) 0
set productObj($prodIndex,partIndexList) {}
set partIndexList [setupPartIndexListGet $prodIndex]
foreach partIndex $partIndexList {
set infoList [setupPartInfoGet $partIndex]
set productNum [lindex $infoList 0]
set productName [lindex $infoList 1]
set productDesc [lindex $infoList 2]
set partName [lindex $infoList 3]
set partDesc [lindex $infoList 4]
set productIndex [lindex $infoList 5]
set defInstFlag [lindex $infoList 6]
set totalFile [lindex $infoList 7]
set featureDesc [lindex $infoList 8]
set featureId [lindex $infoList 9]
set size [lindex $infoList 10]
# construct CD object
if ![info exists cdObj(number)] {
set cdObj(number) [lindex $infoList 11]
}
# construct product objects
set productObj($prodIndex,number) $productNum
set productObj($prodIndex,name) $productName
set productObj($prodIndex,desc) $productDesc
lappend productObj($prodIndex,partIndexList) $partIndex
# construct part objects
set partObj($partIndex,instFlag) $defInstFlag
set partObj($partIndex,prevInstFlag) $defInstFlag
set partObj($partIndex,desc) $partDesc
set partObj($partIndex,featureId) $featureId
set partObj($partIndex,size) $size
set partObj($partIndex,totalFile) $totalFile
set partObj($partIndex,parent) $prodIndex
set featureObj($featureId) $featureDesc
if {"$defInstFlag" == "1"} {
set productObj($prodIndex,instFlag) 1
set productObj($prodIndex,prevInstFlag) 1
}
}
if {[llength $partIndexList] == 1} {
set partObj([lindex $partIndexList 0],instFlag) 1
set partObj([lindex $partIndexList 0],prevInstFlag) 1
}
lappend productDescList \
[list $productObj($prodIndex,desc) $prodIndex]
}
set cdObj(productIndexList) {}
foreach pair [lsort $productDescList] {
lappend cdObj(productIndexList) [lindex $pair 1]
}
}
if [debug] {puts "finish constructing the products array"}
}
##############################################################################
#
# cdInfoGet - returns the requested information
#
# Following is the list of available commands:
#
# Command Meaning
# ------- -------
# number the name of the CDROM
# size the total size of unlocked products
# totalFile the total files of unlocked products
# stateInfo the global selection information
# featureIdList the feature list of unlocked products
# productIndexList the index list of unlocked products
# selectedProdIndexList the selected products index list
# selectedProdNameList the selected products name list
# installedFeatureIdList the selected feature id list
#
# SYNOPSIS
# cdInfoGet <command>
#
# PARAMETERS:
# <command> : one of the above commands
#
# RETURNS: the requested information
#
# ERRORS: N/A
#
proc cdInfoGet {info} {
global cdObj
switch $info {
number { return $cdObj(number) }
productIndexList { return $cdObj(productIndexList) }
selectedProdIndexList {
set retVal {}
foreach prodIndex $cdObj(productIndexList) {
if [productInfoGet instFlag $prodIndex] {
lappend retVal $prodIndex
}
}
return $retVal
}
selectedProdNameList {
set retVal {}
foreach prodIndex [cdInfoGet selectedProdIndexList] {
set prodName [productInfoGet name $prodIndex]
if {[lsearch $retVal "$prodName"] == "-1"} {
lappend retVal $prodName
}
}
return $retVal
}
size {
set retVal 0
foreach selProdIndex [cdInfoGet selectedProdIndexList] {
incr retVal [productInfoGet size $selProdIndex]
}
return $retVal
}
totalFile {
set retVal 0
foreach selProdIndex [cdInfoGet selectedProdIndexList] {
incr retVal [productInfoGet totalFile $selProdIndex]
}
return $retVal
}
installedFeatureIdList {
set retVal {}
foreach selProdIndex [cdInfoGet selectedProdIndexList] {
set fId [productInfoGet installedFeatureIdList $selProdIndex]
if {("$fId" != "") && ([lsearch $retVal $fId] == "-1")} {
lappend retVal $fId
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -