📄 install.tcl
字号:
# uninstStop - wraps up the uninstall process.
#
# This procedure copies uninstall agent, executes all queued commands, closes
# all tempfiles, saves the temporary uninstall records into a zip file.
#
# SYNOPSIS
# uninstStop
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
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
# Remove objects from vxworks directory
set saveDir [pwd]
cd "[destDirGet]/target/lib"
if {[windHostTypeGet] == "x86-win32"} {
set rmTool "[destDirGet]/host/[windHostTypeGet]/bin/rm"
set rmTool [dosToUnix $rmTool]
}
set objsToRemove "udm821.o udm821in.o uglDevMemUtil.o uglinfo.o ugldib.o ugltdib.o uglmdib.o uglfont2.o udgenstr.o udgmode.o udgenlin.o udg8str.o udg8fil.o udg16str.o udg16fil.o udg1str.o udg1fil.o udvgabmp.o uigs422bmp.o udsa8in.o udsa16in.o udx11.o udx11bmp.o udx11utl.o udx11evt.o udx11cur.o udx11kbd.o udx11ptr.o udmgx.o udmgxlin.o udmgxfil.o uglmsptr.o uglps2ptr.o uglabtts.o winroute.o udmgxbmp.o udmgxcrs.o udmgxgc.o udmgxgpw.o udmgxmod.o udmgxpg.o udmgxblt.o udmgx8.o udmgx16.o udsimnt.o uglpckbd.o uglinput.o uglevts.o uglevtq.o uglevth1.o uglevth.o uglEventLib.o uglevts1.o udbmffnt.o udvxwmem.o i8042Kbd.o i8042Mse.o uglInit.o igs5050Dsp.o igs5050Snd.o igsSndIo.o udAgfa.o udgenply.o udg8bmp.o udg1bmp.o udvga.o udvgalin.o udct8.o udct16.o udct16.o udct8ini.o udct16in.o udct8clr.o udigs8.o udigs16.o udigsutil.o ufpcl.o udq2sdbmp.o window.o"
if {[catch {set objDirList [glob obj*vx]}] == 0} {
foreach element $objDirList {
cd $element
set curDir [pwd]
puts "Removing WindML 2.0 objects from $curDir"
foreach element1 $objsToRemove {
if {[file exists $element1]} {
if {[windHostTypeGet] == "x86-win32"} {
if {[catch "exec $rmTool $element1" error]} {
puts "Error: couldn't remove $element1: $errArchive"
}
} else {
if {[catch "exec rm -f $element1" error]} {
puts "Error: couldn't remove $element1: $errArchive"
}
}
}
}
cd ..
}
} else {
puts "No vxworks object directories to clean up: OK"
}
cd "[destDirGet]/target/lib"
if {[catch {set objDirList [glob obj*Ugl]}] == 0} {
foreach element $objDirList {
cd $element
set curDir [pwd]
puts "Removing WindML 2.0 objects from $curDir"
foreach element1 $objsToRemove {
if {[file exists $element1]} {
if {[windHostTypeGet] == "x86-win32"} {
if {[catch "exec $rmTool $element1" error]} {
puts "Error: couldn't remove $element1: $errArchive"
}
} else {
if {[catch "exec rm -f $element1" error]} {
puts "Error: couldn't remove $element1: $errArchive"
}
}
}
}
cd ..
}
} else {
puts "No ugl object directories to clean up: OK"
}
cd $saveDir
# 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] {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -