📄 compslct.tcl
字号:
set prodList ""
set poolID [string range $pool 0 [expr [string first "ZC" $pool] -1]]
if {$poolID == ""} {
set poolID $pool
}
# open the setup.log file and determine if there are any installed products
# from the specified CD pool
set logfile [file join [destDirGet] setup.log]
if [catch {open $logfile r} logfd] {
return ""
} else {
set text [split [read $logfd] \n]
set nlines [llength $text]
close $logfd
for {set ix 0} {$ix < $nlines} {incr ix} {
# iterate each line and search for the pool ID passed in
set textLine [split [lindex $text $ix ]]
if {[lsearch $textLine $poolID*] != -1} {
# check to see if destination dir is same
set instDir [lindex $textLine 3]
# make sure case is not an issue when doing comparison
if {[string tolower $instDir] == \
[string tolower [destDirGet]]} {
incr ix
# accumulate product numbers that are in this group
set line [split [lindex $text $ix]]
while {$ix < $nlines} {
if {[string range [lindex $line 1] 0 3] == "100-"} {
lappend prodList [lindex $line 1]
}
incr ix
set line [split [lindex $text $ix]]
if {[lsearch -regexp $line "TDK-"] == 1} {
break
}
}
}
}
}
}
# make the list unique
set prodList [lunique $prodList]
set setupVals(instProdList) $prodList
}
#############################################################################
#
# analyzeInstFiles - check if any selected products are already installed
#
# This procedure will check if any selected products are already installed.
#
# SYNOPSIS
# .tS
# analyzeInstFiles
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc analyzeInstFiles {} {
global ctrlVals
global setupVals
set setupVals(instProdList) ""
set setupVals(dupCoreInstall) 0
set setupVals(duplicateProducts) ""
if { [isGUImode] } {
windowTimerCallbackSet analyzing_setup_files 0 ""
beginWaitCursor
}
# check and setup list of installed products if any
installedProdGet $setupVals(CDnumber)
foreach prodIndex [cdInfoGet selectedProdIndexList] {
if { [isGUImode] } {
uiEventProcess
}
# if there are installed products in the destDir
if {$setupVals(instProdList) != ""} {
set prodNum [productInfoGet number $prodIndex]
if {[lsearch $setupVals(instProdList) $prodNum] != -1} {
# check for existence of a core product in the selected list
set productName [productInfoGet name $prodIndex]
set productDesc [productInfoGet desc $prodIndex]
if {[tornadoProductCheck $productName $productDesc]} {
set setupVals(dupCoreInstall) 1
} elseif {[productInfoGet coreProd $prodIndex] == "core"} {
set setupVals(dupCoreInstall) 1
}
lappend setupVals(duplicateProducts) \
[productInfoGet desc $prodIndex]
}
}
}
if { [isGUImode] } {
endWaitCursor
windowClose analyzing_setup_files
}
}
#############################################################################
#
# checkForPreviouslyInstalledProds - create dialog box for checking whether
# any selected products have been
# previously installed
#
# SYNOPSIS
# .tS
# checkForPreviouslyInstalledProds
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc checkForPreviouslyInstalledProds {} {
global ctrlVals
global setupVals
set setupVals(coreInstallation) 0
if { [isGUImode] } {
dialogCreate \
-name analyzing_setup_files \
-notitle \
-parent $ctrlVals(parentDialog) \
-helpfile $setupVals(setupHelp) \
-width 200 -height 32 \
-init {
controlPropertySet analyzing_setup_files.analyze_ctrl -bold 1; \
windowTimerCallbackSet analyzing_setup_files \
-milliseconds 200 analyzeInstFiles
} \
-controls [list \
[list label -name "analyze_ctrl" -center \
-title [strTableGet COMPSELECT_ANALYZING_BANNER] \
-x 15 -y 12 -w 170 -h 10 ]
]
} else {
# TEXT mode
analyzeInstFiles
}
}
#############################################################################
#
# onDupProdContinue - set dupRetVal to 0 and close the duplicate product
# dialog box
#
# This procedure will set dupRetVal to 0 and close the duplicate product
# dialog box
#
# SYNOPSIS
# .tS
# onDupProdContinue
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc onDupProdContinue {} {
global dupRetVal
set dupRetVal 0
windowClose duplicate_products_warn
}
#############################################################################
#
# onDupProdSelComp - set dupRetVal to 1 and close the duplicate product
# dialog box
#
# This procedure will set dupRetVal to 1 and close the duplicate product
# dialog box
#
# SYNOPSIS
# .tS
# onDupProdSelComp
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc onDupProdSelComp {} {
global dupRetVal
set dupRetVal 1
windowClose duplicate_products_warn
}
#############################################################################
#
# dupProdDlgInit - initialize values for dupProdDlg dialog box
#
# This procedure will initialize values for dupProdDlg dialog box
#
# SYNOPSIS
# .tS
# dupProdDlgInit
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc dupProdDlgInit {} {
global setupVals
foreach item $setupVals(duplicateProducts) {
set lst [format %s\r\n $item]
append prodList $lst
}
controlTextSet duplicate_products_warn.dupProdText $prodList
controlSelectionSet duplicate_products_warn.dupProdText 0 0
}
#############################################################################
#
# dupProdDlg - display warnings if products are being re-installed
#
# This procedure will display warnings if products are being re-installed
#
# SYNOPSIS
# .tS
# dupProdDlg
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: dupRetVal which is set to 1 by onDupProdSelComp or
# 0 by onDupProdContinue
#
# ERRORS: N/A
#
proc dupProdDlg {} {
global setupVals
global ctrlVals
global dupRetVal
if { [isGUImode] } {
set controls [list \
[list label -title \
"Setup has detected that the following products \
were previously installed in [destDirGet] \
and you are about to re-install them:" \
-name dupProdLabel \
-xpos 7 -ypos 9 -width 186 -height 30] \
[list text -name dupProdText -border \
-xpos 7 -ypos 37 -width 185 -height 40 \
-readonly -multiline -vscroll] \
[list label -title [strTableGet COMPSELECT_DUP_PRODUCT_WARN] \
-name dupProdLabel2 \
-xpos 7 -ypos 84 -width 186 -height 40] \
[list button -title "&Continue" -name continue -default \
-xpos 8 -ypos 129 -width 67 -height 14 \
-callback onDupProdContinue] \
[list button -title "&Select Products" -name cancelButt \
-xpos 127 -ypos 129 -width 67 -height 14 \
-callback onDupProdSelComp ] \
]
dialogCreate \
-name duplicate_products_warn \
-title Setup\
-init dupProdDlgInit \
-parent $ctrlVals(parentDialog) \
-helpfile $setupVals(setupHelp) \
-width 200 -height 150 \
-controls $controls
return $dupRetVal
} else { # TEXT mode
printPageTitle "Setup"
puts "Setup has detected that the following products\
were previously install in [destDirGet] and you\
are about to re-install them:\n"
foreach item $setupVals(duplicateProducts) {
puts [format %s\r\n $item]
}
puts [strTableGet COMPSELECT_DUP_PRODUCT_WARN_TEXT]
puts "1 - To Continue, 2 - To Select Products"
while (1) {
set ret [prompt]
switch -regexp -- $ret {
"1" { set dupRetVal 0 ; break }
"2" { set dupRetVal 1 ; break }
default { }
}
}
return $dupRetVal
}
}
#############################################################################
#
# previousTornadoInstalled - check for existing T1
#
# This procedure will check if T1 tree exists or not
#
# SYNOPSIS
# .tS
# prevousTornadoInstalled
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: 0 if no T1 tree installed
# 1 if T1 tree installed
#
# ERRORS: N/A
#
proc previousTornadoInstalled {} {
global ctrlVals setupVals
set installVal 0
# check for SETUP version in setup.log
if { [file exists [destDirGet]/setup.log] } {
if { ![catch {open [destDirGet]/setup.log r} fileId] } {
# read each line and search for SETUP-1.x
while {[gets $fileId line] >= 0} {
set i [split $line]
if {[regexp {SETUP-1\.*} $i]} {
if {[regexp {patch-*} $i] == 0} {
set installVal 1
#dbgputs "setup.log: $i"
break
}
}
}
} else {
# error in open setup.log
puts "Error in open setup.log"
}
close $fileId
} else {
# no setup.log
dbgputs "setup.log does not exists"
# check for existing T101
set t101File "host/resource/tcl/app-config/Tornado/01WindCFG.win32.tcl"
set t101File [file join [destDirGet] $t101File]
if {[file exists $t101File]} {
set installVal 1
}
}
return $installVal
}
#############################################################################
#
# pageProcess(compSelect) - process inputs from compSelect page
#
# This procedure will process inputs from compSelect page
#
# SYNOPSIS
# .tS
# pageProcess(compSelect)
# .tE
#
# PARAMETERS: N/A
#
# RETURNS: 0 if the user needs to re-select the products
# 1 if the user is allowed to continue with installation
# 2 if user decides to quit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -