📄 global.tcl
字号:
global setupVals
if {[info exists setupVals(destDir)]} {
if { [isUnix] } {
return [dosToUnix $setupVals(destDir)]
} else {
return [unixToDos $setupVals(destDir)]
}
} else {
return ""
}
}
##############################################################################
#
# destDirSet - sets the destination directory.
#
# Sets the global variable setupVals(destDir) to the destination directory.
#
# SYNOPSIS:
# destDirSet val
#
# PARAMETERS:
# <val>
# Contains the destination directory.
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc destDirSet {val} {
global setupVals
set setupVals(destDir) $val
}
##############################################################################
#
# sysDirGet - returns the Windows system directory.
#
# This routine returns the Windows system directory. If the system directory
# has not been set, an empty string is returned.
#
# SYNOPSIS:
# sysDirGet
#
# PARAMETERS: N/A
#
# RETURNS: the system directory if it exists, else an empty string.
#
# ERRORS: N/A
#
proc sysDirGet {} {
global setupVals
if {[info exists setupVals(sysDir)]} {
return $setupVals(sysDir)
} else {
return ""
}
}
##############################################################################
#
# sysDirSet - sets the system directory.
#
# Sets the global variable setupVals(sysDir) to the Windows system directory.
#
# SYNOPSIS:
# sysDirSet val
#
# PARAMETERS:
# <val>
# Contains the system directory.
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc sysDirSet {val} {
global setupVals
set setupVals(sysDir) $val
}
##############################################################################
#
# cdromBinDirGet - returns the host-specific CD-ROM executable files.
#
# This routine returns the CD-ROM directory containing the host-specific
# binary and executable files, for example env(CD_ROOT)/SUN4/SOLARIS2,
# env(CD_ROOT)\X86\WIN32, or env(CD_ROOT)/X86/LINUX2. If the bin directory
# has not been set an empty string is returned.
#
# SYNOPSIS:
# cdromBinDirGet
#
# PARAMETERS: N/A
#
# RETURNS: the bin directory if it exists, else an empty string.
#
# ERRORS: N/A
#
proc cdromBinDirGet {} {
global env
if {[info exists env(CD_BIN)]} {
return $env(CD_BIN)
} else {
return ""
}
}
##############################################################################
#
# windHostTypeGet - returns the WIND_HOST_TYPE.
#
# This routine returns the WIND_HOST_TYPE set by the global variable
# setupVals(windHostType). If the WIND_HOST_TYPE has not been set,
# an empty string is returned.
#
# SYNOPSIS:
# windHostTypeGet
#
# PARAMETERS: N/A
#
# RETURNS: the WIND_HOST_TYPE if it exists, else an empty string.
#
# ERRORS: N/A
#
proc windHostTypeGet {} {
global setupVals
if {[info exists setupVals(windHostType)]} {
return $setupVals(windHostType)
} else {
return ""
}
}
##############################################################################
#
# windHostTypeSet - sets the WIND_HOST_TYPE.
#
# Sets the global variable setupVals(windHostType) to the WIND_HOST_TYPE.
#
# SYNOPSIS:
# windHostTypeSet val
#
# PARAMETERS:
# <val>
# Contains the WIND_HOST_TYPE [x86-win32 | sun4-solaris2 |
# parisc-hpux10 | x86-linux2].
# RETURNS: N/A
#
# ERRORS: N/A
#
proc windHostTypeSet {val} {
global setupVals
set setupVals(windHostType) $val
}
##############################################################################
#
# lastErrorGet - returns the last setup error.
#
# This routine returns the last setup error set by the global variable
# setupVals(lastError). If the last error has not been set, an empty string
# is returned.
#
# SYNOPSIS:
# lastErrorGet
#
# PARAMETERS: N/A
#
# RETURNS: the last error if it exists, else an empty string.
#
# ERRORS: N/A
#
proc lastErrorGet {} {
global setupVals
if {[info exists setupVals(lastError)]} {
return $setupVals(lastError)
} else {
return ""
}
}
##############################################################################
#
# lastErrorSet - sets the last setup error and increments the error count.
#
# Sets the global variable setupVals(lastError) to the last setup error
# and increments the value of setupVals(errorCount).
#
# SYNOPSIS:
# lastErrorSet val
#
# PARAMETERS:
# <val>
# Contains the last setup error.
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc lastErrorSet {val} {
global setupVals
set setupVals(lastError) $val
incr setupVals(errorCount)
}
##############################################################################
#
# lastErrorMsgSet - sets the last setup error.
#
# Sets the global variable setupVals(lastError) to the last setup error.
# Note that unlike lastErrorSet the errorCount is not incremented.
#
# SYNOPSIS:
# lastErrorMsgSet val
#
# PARAMETERS:
# <val>
# Contains the last setup error.
# RETURNS: N/A
#
# ERRORS: N/A
#
proc lastErrorMsgSet {val} {
global setupVals
set setupVals(lastError) $val
}
##############################################################################
#
# errorCountGet - returns the error count.
#
# This routine returns the error count recorded by the global variable
# setupVals(errorCount).
#
# SYNOPSIS:
# errorCountGet
#
# PARAMETERS: N/A
#
# RETURNS: the error count.
#
# ERRORS: N/A
#
proc errorCountGet {} {
global setupVals
if {[info exists setupVals(errorCount)]} {
return $setupVals(errorCount)
} else {
return 0
}
}
##############################################################################
#
# arFlagsSet - sets the arflags for the current product index.
#
# Sets the global variable arFlags([currentIndexGet]) for the current
# product index.
#
# SYNOPSIS:
# arFlagsSet val
#
# PARAMETERS:
# <flags>
# Contains the arflags for the current product index.
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc arFlagsSet {flags} {
global arFlags
set arFlags([currentIndexGet]) $flags
}
##############################################################################
#
# arFlagsGet - returns the arFlags given the product index number.
#
# This routine returns the arFlags for the specified index based on the
# value of the global array arFlags($index). If no value has been set
# the default flags "-crus" are returned.
#
#
# SYNOPSIS:
# cdromDescGet
#
# PARAMETERS:
# <index>
# The product index number.
#
# RETURNS: the arflags for the specified product index, otherwise
# the default "-crus" if no arflags have been specified.
#
# ERRORS: N/A
#
proc arFlagsGet {index} {
global arFlags
if ![info exists arFlags($index)] {
set arFlags($index) "-crus"
}
return $arFlags($index)
}
##############################################################################
#
# currentIndexSet - sets the current product index.
#
# Sets the global variable currentIndex to the specified product
# index.
#
# SYNOPSIS:
# currentIndexSet index
#
# PARAMETERS:
# <index>
# The current product index.
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc currentIndexSet {index} {
global currentIndex
set currentIndex $index
}
##############################################################################
#
# currentIndexGet - returns the current product index.
#
# This routine returns the current product index set by the global
# variable currentIndex. If no value has been set an empty string is
# returned.
#
# SYNOPSIS:
# currentIndexGet
#
# PARAMETERS: N/A
#
# RETURNS: the current product index if it exists, else an empty string.
#
# ERRORS: N/A
#
proc currentIndexGet {} {
global currentIndex
if {[info exists currentIndex]} {
return $currentIndex
} else {
return ""
}
}
##############################################################################
#
# tempDirGet - returns the temporary directory.
#
# This routine returns the temporary directory set by the environment
# variable TMP.
#
# SYNOPSIS:
# tempDirGet
#
# PARAMETERS: N/A
#
# RETURNS: the temporary directory.
#
# ERRORS:
# "Temp dir not set"
#
proc tempDirGet {} {
global env
if {[info exists env(TMP)]} {
return $env(TMP)
} else {
error "Temp dir not set"
}
}
##############################################################################
#
# exitMsgSet - sets the exit message.
#
# Sets the global variable exitMessage to the specified exit message.
#
# SYNOPSIS:
# currentIndexSet msg
#
# PARAMETERS:
# <msg>
# The exit message.
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc exitMsgSet {msg} {
global exitMessage
set exitMessage $msg
}
##############################################################################
#
# exitMsgGet - returns the exit message.
#
# This routine returns the exit message. If it does not exist, it returns
# the message "Installation complete."
#
# SYNOPSIS:
# exitMsgGet
#
# PARAMETERS: N/A
#
# RETURNS: the exit message if it exists, else "Installation complete."
#
# ERRORS: N/A
#
proc exitMsgGet {} {
global exitMessage
if {![info exists exitMessage]} {
set exitMessage "Installation complete."
}
return $exitMessage
}
##############################################################################
#
# defGroupSet - sets the default group.
#
# Sets the global variable defGroup to the specified default group.
#
# SYNOPSIS:
# defGroupSet group
#
# PARAMETERS:
# <group>
# The default group.
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc defGroupSet {group} {
global defGroup setupVals
if { [isTornadoProduct] } {
if {[portMapperIconExist $group] == 1} {
set defGroup $setupVals(defGroup)
} else {
set defGroup $group
}
} else {
# non-tornado
set defGroup $group
}
}
##############################################################################
#
# defGroupGet - returns the default group.
#
# This routine returns the default group. If it does not exist an empty
# string is returned.
#
# SYNOPSIS:
# defGroupGet
#
# PARAMETERS: N/A
#
# RETURNS: the default group if it exists, else an empty string.
#
# ERRORS: N/A
#
proc defGroupGet {} {
global defGroup
if ![info exists defGroup] {
set defGroup ""
}
return $defGroup
}
##############################################################################
#
# dirSizeGet - returns the size of a directory
#
# This routine returns the size of a directory
#
# SYNOPSIS:
# setupSizeGet
#
# PARAMETERS: path
#
# RETURNS: the size of given directory or 0 if path is not a directory
#
# ERRORS: N/A
#
proc dirSizeGet {path} {
if {[file isdirectory $path] == 0} {
return 0
}
set totsz 0
set list [glob $path/*]
foreach file $list {
set totsz [expr $totsz + [file size [file join $path $file]]]
}
return $totsz
}
##############################################################################
#
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -