📄 install.old
字号:
#
proc uninstStop {} {
global setupVals
if {"$setupVals(uninstLog)" > "0"} {
uninstBinCopy
if {[windHostTypeGet] == "x86-win32"} {
uninstallSetup
queueExecute
}
uninstFileClose
if [file exists $setupVals(uninstFile)] {
catch {setupUnzip -o -qq $setupVals(uninstFile) \
-d [tempDirGet] "install*"}
}
fileAppend [tempDirGet]/installFile.tmp [tempDirGet]/installFile
fileAppend [tempDirGet]/installResource.tmp [tempDirGet]/installResource
fileAppend [tempDirGet]/installBackup.tmp [tempDirGet]/installBackup
fileAppend [tempDirGet]/installInfo.tmp [tempDirGet]/installInfo
fileAppend [tempDirGet]/setup.log.tmp [destDirGet]/setup.log
cd [tempDirGet]
if [catch {exec ZIP $setupVals(uninstFile) -g -q -1 -m \
"installFile" "installInfo" "installBackup"\
"installResource"} error] {
puts "$error"
}
} {
uninstFileClose
}
}
##############################################################################
#
# fileAppend - appends the content of the source to the destination file.
#
# This procedure takes the content of the source file and appends it to the
# destination file.
#
# SYNOPSIS
# fileAppend <srcFilePath> <destFilePath>
#
# PARAMETERS:
# srcFilePath : a path to the source filename
# destFilePath : a path to the destination filename
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc fileAppend {srcFilePath destFilePath} {
global setupVals
set ftmp [open $srcFilePath "r"]
set f [open $destFilePath "a+"]
while {[gets $ftmp line] != "-1"} {
puts $f $line
}
close $ftmp
close $f
}
##############################################################################
#
# uninstLog - stores the specified string into the appropriate disk file.
#
# SYNOPSIS
# uninstLog <key> <string>
#
# PARAMETERS:
# key : a string that long enough to differentiate between disk filenames,
# <r>esource, <b>ackup, <f>ileNew, <i>nfo, <s>etupLog
# string : string to be stored.
#
# RETURNS: N/A
#
# ERRORS: N/A
#
set setupVals(uninstLog) 0
proc uninstLog {key string} {
global setupVals
uninstFileOpen
if [catch { switch -glob $key {
r* {
puts $setupVals(fInstallResource) $string
incr setupVals(uninstLog)
}
b* {
puts $setupVals(fInstallBackup) $string
incr setupVals(uninstLog)
}
f* {
puts $setupVals(fInstallFile) $string
incr setupVals(uninstLog)
}
i* {
puts $setupVals(fInstallInfo) $string
}
s* {
puts $setupVals(fSetupLog) "[installDate]\t$string"
}
default {
puts "uninstLog error: $key not match"
}
}
} error] {
puts "cannot record \"$string\": $error"
}
}
##############################################################################
#
# installDate - forms a simple date string
#
# SYNOPSIS
# installDate
#
# PARAMETERS: N/A
#
# RETURNS: a date string (i.e, 08-Apr-97.18:30)
#
# ERRORS: N/A
#
proc installDate {} {
return [clock format [clock second] -format "%d-%b-%y.%H:%M"]
}
##############################################################################
#
# 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
cd [destDirGet]
set setupVals(cancel) 0
set totalFiles [cdInfoGet totalFile]
set desc "Unknown component"
set i 0
uninstLog setup "[cdInfoGet number]\t$setupVals(version)"
foreach prodIndex [cdInfoGet selectedProdIndexList] {
currentIndexSet $prodIndex
messageBox "TEST"
# 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]
uninstLog setup "$prodNum\t$desc"
# Append info to the uninstall record
uninstLog info "$desc"
# Begin the copy loop
set prevFileName ""
foreach partIndex [productInfoGet selectedPartIndexList $prodIndex] {
set partDesc [partInfoGet desc $partIndex]
if [catch {setupFileSetMake $partIndex} error] {
uninstLog setup "\tskip installing $partDesc: $error"
if [debug] {
puts "unable to install $partDesc: $error"
}
lastErrorSet "$error"
continue
} elseif {[debug]} {
puts "Installing [productInfoGet desc $prodIndex] -> $partDesc"
}
while { 1 } {
if {$setupVals(cancel) == 1} {return}
set fileName [setupFileNameGet 0]
# update meter
set percent [expr $i * 100 / $totalFiles]
meterUpdate $percent $fileName
bbrdUpdate $percent
set f [destDirGet]/$fileName
catch {setupFileExtract} retVal
if [debug] {
puts [format "%20s\t%s" $retVal $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 -
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}_: not exist"
setupFileNext
continue
}
if [file exists $f] {
if {[file mtime $f] >= [file mtime $f._${prodIndex}_]} {
set retVal [fileRemove $f._${prodIndex}_]
if {"$retVal" == "RETRY"} {
continue
} elseif {"$retVal" == "IGNORE"} {
setupFileNext
continue
}
} else {
backup $fileName
set retVal [fileRemove $f]
if {"$retVal" == "RETRY"} {
continue
} elseif {"$retVal" == "IGNORE"} {
setupFileNext
continue
}
file rename $f._${prodIndex}_ $f
}
} {
uninstLog file "wind_base\t$fileName"
file rename $f._${prodIndex}_ $f
}
# Build archList for later updating the archirve.
archListPut $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 {continue}
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 {continue}
default {quitCallback}
}
}
NO_ZIP_FILE {
switch [dialog re_ig_cancel "Setup" \
[strTableGet 1171_FILE_COPY] question 0] {
0 { continue }
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 {continue}
default {quitCallback}
}
}
UNEXPECT_EOF {
set logMsg "\terror: can not copy $fileName: zip corrupt"
lastErrorSet $logMsg
uninstLog setup $logMsg
setupFileNext
}
END_OF_LIST {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 { continue }
1 {
set logMsg "\terror: can not copy $fileName : $retVal"
lastErrorSet $logMsg
uninstLog setup $logMsg
setupFileNext
}
default { quitCallback }
}
}
}
if {"$prevFileName" != "$fileName"} {
incr i
set prevFileName $fileName
}
}
}
execute [productInfoGet name $prodIndex]/postInstall.tcl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -