📄 filecopy.tcl
字号:
} else {
set objects($objDir) [list $tailFileName]
}
}
}
##############################################################################
#
# processInstall - process the return value from filesCopy routine
#
# SYNOPSIS
# processInstall <retVal>
#
# PARAMETERS: The return value from call to setupFileExtract in filesCopy
#
# RETURNS: string "break" if EOF encountered, else "NULL".
#
# ERRORS: N/A
#
proc processInstall {retVal fileName prodIndex} {
global ctrlVals
global setupVals
global current_file
global overwritePolicy
global multipleVersion
set f [destDirGet]/$fileName
switch $retVal {
OK {
uninstLog file "wind_base\t$fileName"
# Build archList for later updating the archirve.
archListPut $fileName $prodIndex
setupFileNext
}
EXIST_AND_SAME {
# Workaround the problem that the base product is
# reinstalled, and messup the libraries.
archListPut $fileName $prodIndex
setupFileNext
}
EXIST_AND_NEWER {
# do not overwrite if auto install
if { $ctrlVals(useInputScript) } {
archListPut $fileName $prodIndex; \
setupFileNext
return NULL
}
if {! $overwritePolicy(ALL)} {
messageBeep -exclamation
switch [dialog file_exists_newer_warn "Setup" \
[strTableGet 4010_FILE_EXISTS_NEWER_WARN] \
question 0] {
0 {backup $fileName; \
set newerFileArray($fileName) ""; \
if {[fileRemove $f] == "IGNORE"} {
setupFileNext}
}
1 {archListPut $fileName $prodIndex; \
setupFileNext
}
2 {set overwritePolicy(ALL) 1; \
backup $fileName; \
set newerFileArray($fileName) ""; \
if {[fileRemove $f] == "IGNORE"} {
setupFileNext}
}
default {set overwritePolicy(ALL) 1; \
backup $fileName; \
set newerFileArray($fileName) ""; \
if {[fileRemove $f] == "IGNORE"} {
setupFileNext}
}
}
} else {
backup $fileName; \
set newerFileArray($fileName) ""; \
if {[fileRemove $f] == "IGNORE"} {
setupFileNext}
}
}
EXIST_AND_OLDER {
backup $fileName; \
if {[fileRemove $f] == "IGNORE"} {
setupFileNext}
}
MULTIPLE_VERSION {
# Setup detected that the file being install has more
# than one versions on the CD-ROM.
if ![file exists $f._${prodIndex}_] {
uninstLog setup "\t$f._${prodIndex}_: does not exist"
setupFileNext
return NULL
}
if {![info exists multipleVersion($fileName)]} {
set multipleVersion($fileName) $prodIndex
} else {
# Check to see if there is a duplicate prodIndex
set indexLocate [lsearch -exact \
$multipleVersion($fileName) $prodIndex]
if {$indexLocate == -1} {
lappend multipleVersion($fileName) $prodIndex
}
}
setupFileNext
}
NOT_FOUND {
set msg [strTableGet 1380_DEFLATE_ERROR]
set logMsg "\terror: can not copy $fileName: not found"
switch [dialog re_ig_cancel "Setup" $msg question 0] {
0 {return NULL}
1 {
lastErrorSet $logMsg
uninstLog setup $logMsg
setupFileNext
}
default {quitCallback}
}
}
ZIP_ERROR {
set logMsg "\terror: can not copy $fileName: zip error"
lastErrorSet $logMsg
uninstLog setup $logMsg
setupFileNext
}
MEMORY_LOW {
set msg [strTableGet 1390_MEMORY_LOW]
switch [dialog ok_cancel "Setup" $msg question 0] {
0 {return NULL}
default {quitCallback}
}
}
NO_ZIP_FILE {
switch [dialog re_ig_cancel "Setup" \
[strTableGet 1171_FILE_COPY] question 0] {
0 { return NULL }
1 {
set logMsg "\terror: can not copy $fileName : no zip file"
lastErrorSet $logMsg
uninstLog setup $logMsg
setupFileNext
}
default { quitCallback }
}
}
BAD_PARAM {
set logMsg "\terror: can not copy $fileName: bad param"
lastErrorSet $logMsg
uninstLog setup $logMsg
setupFileNext
}
DISK_FULL {
set msg [strTableGet 1400_DISK_FULL]
switch [dialog ok_cancel "Setup" $msg question 0] {
0 {return NULL}
default {set setupVals(diskfull) 1
quitCallback}
}
}
UNEXPECT_EOF {
set logMsg "\terror: can not copy $fileName: zip corrupt"
lastErrorSet $logMsg
uninstLog setup $logMsg
setupFileNext
}
END_OF_LIST {return break}
default {
set msg "Setup was unable to copy $fileName from \
the CDROM due to $retVal."
switch [dialog re_ig_cancel "Setup" $msg question 0] {
0 { return NULL }
1 {
set logMsg "\terror: can not copy $fileName : $retVal"
lastErrorSet $logMsg
uninstLog setup $logMsg
setupFileNext
}
default { quitCallback }
}
}
}
return NULL
}
##############################################################################
#
# fileRemove - remove the specified file
#
# This procedure removes the specified file, and if fails to do so, it's then
# popping up a dialog to query for the next action.
#
# SYNOPSIS
# fileRemove <fileName>
#
# PARAMETERS:
# fileName : a path filename
#
# RETURNS:
# OK : successful removing <filename>
# RETRY : failed to remove the file, and user wants to retry.
# IGNORE : failed to remove the file, and user wants to ignore it.
#
# ERRORS: N/A
#
proc fileRemove {fileName} {
if [catch {file delete $fileName} error] {
set msg [strTableGet 1370_FILE_ACCESS_ERROR $fileName $error]
switch [dialog re_ig_cancel "Setup" $msg question 0] {
0 { return "RETRY" }
1 {
set logMsg "\terror: $fileName: $error"
lastErrorSet $logMsg
uninstLog setup $logMsg
return "IGNORE"
}
default {quitCallback}
}
}
return "OK"
}
##############################################################################
#
# filesCopy - copies all the selected product files into the user destination
# directory.
#
# This routine walks thru each selected product, and do the following actions:
#
# - runs the preInstall.tcl if any
# - creates a record to the setup.log
# - obtains a list of sub-products, and do the following actions:
#
# + calls setupFileSetMake to build the sub-product filelist
# + calls setupFileExtract to extract each file from the filelist.
# An internal pointer is advanced until it hits the end of the list.
# The setupFileExtract function returns one of the following messages:
#
# Message Next actions
# ------- ------------
# OK - creates uninstall record, advances file pointer.
# EXIST_AND_SAME - skips this file
# EXIST_AND_NEWER - backup the original file, and extracts this file
# again
# EXIST_AND_OLDER - same as above
# MULTIPLE_VERSION - keeps the newer version of the file, backup the
# original if it's older.
# NOT_FOUND - queries for retry until user gives up.
# ZIP_ERROR - logs the error message into the setup.log
# MEMORY_LOW - queries user for continue or not.
# NO_ZIP_FILE - queries for retry until user gives up.
# BAD_PARAM - logs the error message into the setup.log
# DISK_FULL - queries user for continue or not.
# UNEXPECT_EOF - logs the error message into the setup.log
# END_OF_LIST - continues w/ the next sub-product.
#
# - runs the postInstall.tcl if any
#
#
# SYNOPSIS
# filesCopy
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc filesCopy {} {
global setupVals
global ctrlVals
global current_file
global overwritePolicy
global multipleVersion
cd [destDirGet]
set setupVals(cancel) 0
set totalFiles [cdInfoGet totalFile]
set desc "Unknown component"
set i 0
uninstLog setup "CD manufacturing time: [cdNameGet time]"
uninstLog setup "[cdInfoGet number]\t$setupVals(version)\t[destDirGet]"
# Append CD Info to the uninstall record
uninstLog cdNumber "$setupVals(CDnumber)"
# Add host OS to setup log
if {[isUnix]} {
catch {exec uname -a} hostOS
} else {
if [catch {setupWinVerGetEx} hostOS] {
puts "error: $hostOS"
}
}
uninstLog setup "$hostOS"
# find products that specify to be installed last
set firstList ""
set lastList ""
foreach prodIndex [cdInfoGet selectedProdIndexList] {
if {[searchAndProcessSection InstallLast \
[chooseInfFile $prodIndex]]==1} {
puts "INF Processing: installing \
[productInfoGet name $prodIndex] last"
set lastList [linsert $lastList end $prodIndex]
} else {
set firstList [linsert $firstList end $prodIndex]
}
}
set sortedSelectedProdIndexList [concat $firstList $lastList]
foreach prodIndex $sortedSelectedProdIndexList {
currentIndexSet $prodIndex
# Do preinstall if any
execute [productInfoGet name $prodIndex]/preInstall.tcl
# Append install info to the setup.log
set prodNum [productInfoGet number $prodIndex]
set desc [productInfoGet desc $prodIndex]
set current_product $desc
uninstLog setup "$prodNum\t$desc"
if ![info exists setupVals(confirmation)] {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -