📄 inf.tcl
字号:
#
# This is the actual routine for HPUX that checks whether the required
# patch specified by <line> is installed on the user's machine.
#
# Currently there are no special conditions to check for HPUX.
# The condition list is ignored.
#
# Any patches that are not found to be installed are appended
# to the global string uninstalledPatches. This string is used
# in INSTW32.TCL to display to the user a messageBox detailing the required
# patches.
#
#
# SYNOPSIS
# checkHPUXPatch <line>
#
# PARAMETERS:
# line : a comma delimited line containing required patches to be checked.
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc checkHPUXPatch {line} {
global setupVals
global ctrlVals
global env
set patchlist [nthValueFromCommaDelimitedLine $line 1]
set description [nthValueFromCommaDelimitedLine $line 2]
set os [nthValueFromCommaDelimitedLine $line 3]
set conditions [nthValueFromCommaDelimitedLine $line 4]
set requirements [nthValueFromCommaDelimitedLine $line 5]
if {$requirements == "no_value" || $requirements != "required"} {
set requirements "recommended"
}
set check_for_patch 1
#
# check for any necessary conditions here. Currently there are no
# special conditions for parisc-hpux10.
#
if {$check_for_patch == 1} {
infputs "INF Processing: CheckPatch: checking for patch $patchlist"
# run swlist once to save time.
if {![info exists ctrlVals(swlist)]} {
catch { exec /usr/sbin/swlist -l product | /bin/grep PH } ctrlVals(swlist)
if {[catch {open $env(TMP)/swlist w} swlist_fileid]} {
# Cannot open the file
puts "Cannot open $env(TMP)/swlist"
} else {
puts $swlist_fileid $ctrlVals(swlist)
close $swlist_fileid
}
}
# this should be the minimum patch version required to be installed.
set minimum_patch_version [lindex $patchlist end]
# this should be the latest patch version we know of and will
# be used in the message displayed to the user.
set patchnumber [lindex $patchlist 0]
# check if the patch is installed.
set patch_installed 0
# first use the patch list directly to check for the patch.
foreach patch $patchlist {
if {[regsub -all $patch $ctrlVals(swlist) {} ignore]} {
set patch_installed 1
}
}
# if using the patch list is unsucessful, use the description
# to check for the patch. The last value in $patchlist is the
# minimum patch version to check for as well.
if { $patch_installed == 0 } {
# if a version of the patch is installed, the following command
# should return the patch version and the description of the
# patch.
catch { exec /bin/fgrep -i "$description" $env(TMP)/swlist } grep_result
# now check to see if $description is part of $grep_result.
# If it is, check to make sure the version installed is the
# minimum required. If both criterias are true, a valid
# version of the patch has been installed.
if {[string last [string toupper $description] [string toupper $grep_result]] > -1} {
set user_patch_version [lindex $grep_result 0]
# extract the prefix portion of the patch version
# e.g. extract PHSS_ from PHSS_15043
regexp {[^0-9]+} $user_patch_version user_patch_version_prefix
# extract the prefix portion of the minimum patch version
regexp {[^0-9]+} $minimum_patch_version minimum_patch_version_prefix
# make sure the prefixes match
if {$user_patch_version_prefix == $minimum_patch_version_prefix} {
# extract the number portion of the patch version
# e.g. extract 15043 from PHSS_15043
regexp {[0-9]+} $user_patch_version user_patch_version_number
# extract the number portion of the minimum patch version
regexp {[0-9]+} $minimum_patch_version minimum_patch_version_number
if { $user_patch_version_number >= $minimum_patch_version_number } {
set patch_installed 1
}
}
}
}
# if patch is not installed, append patch number and description
# to global string uninstalledPatches, which will be displayed
# later
if {$patch_installed == 0} {
infputs "INF Processing: CheckPatch: $requirements patch $patchnumber not installed"
if {$requirements == "required"} {
append setupVals(uninstalledPatches_required) "$patchnumber\t$description\n"
} else {
append setupVals(uninstalledPatches_recommended) "$patchnumber\t$description\n"
}
}
}
}
#############################################################################
#
# checkPatchLine - checks to make sure the specified patch is installed.
#
# Checks that the required patch specified is installed on the user's
# machine. Any required patches that are not found to be installed are
# appended to the global string uninstalledPatches. This string is used
# in INSTW32.TCL to display to the user a messageBox detailing the required
# patches. Currently Solaris and HPUX10 is supported.
#
# The format of the line read from the inf file is as follows (optional
# parameters in brackets):
#
# patch number, patch description, os version (wind host type), conditions, [requirements]
#
# patch number : number and version of patch to be checked
# patch description : string description of required patch
# os version/wind host type: sun4-solaris2 | parisc-hpux10
# conditions : a list of required conditions that specify whether to check
# if the patch is installed. See checkSolarisPatch and
# and checkHPUXPatch for more details.
# requirements: required | recommended
# if the patch is required to be installed, Setup will inform
# the user and not allow installation to continue. Default
# is recommended, in which case Setup will inform the user that
# it is recommended to install the patch, but will allow
# installation to continue.
#
# SYNOPSIS
# checkPatchLine <line>
#
# PARAMETERS:
# line : a comma delimited line containing required patches to be checked.
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc checkPatchLine {line} {
global env
global infVals
global setupVals
set os [nthValueFromCommaDelimitedLine $line 3]
if {![info exists setupVals(uninstalledPatches_required)]} {
set setupVals(uninstalledPatches_required) ""
}
if {![info exists setupVals(uninstalledPatches_recommended)]} {
set setupVals(uninstalledPatches_recommended) ""
}
if {[isUnix]} {
if {$os == $env(WIND_HOST_TYPE)} {
switch $os {
sun4-solaris2 {
checkSolarisPatch $line
}
parisc-hpux10 {
checkHPUXPatch $line
}
}
}
}
}
#############################################################################
#
# checkStringsLineFormat - checks whether a Strings line from the inf file
# is in the correct format.
#
# Checks to make sure whether the given line is in the correct format
# for the Strings section. The format is string_variable=string_value.
#
# SYNOPSIS
# checkStringsLineFormat <line>
#
# PARAMETERS:
# line : a line containing Strings section data.
#
# RETURNS:
# 0 if the line is not in the correct format.
# 1 if the line has the correct format.
#
# ERRORS: N/A
#
proc checkStringsLineFormat {line} {
return [regexp {[^=]+=.+} $line]
}
#############################################################################
#
# addStringName - adds string variable and replacement value to the global
# space
#
# Adds the string variable and replacement value to the global array
# infString. This global array is used to determine whether a variable
# from the Strings section exists and contains its replacement value.
# $infString(string variable name) contains the string replacement
# value.
#
# SYNOPSIS
# addStringName <line>
#
# PARAMETERS:
# line : a line containing Strings section data.
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc addStringName {line} {
global infString
set string_name [lindex [split $line =] 0]
set string_replacement [lindex [split $line =] 1]
set infString($string_name) $string_replacement
}
#############################################################################
#
# addStringsLine - adds a string variable and replacement value to the global
# space from values read from an inf line.
#
# Given a line from the Strings section in the inf file, adds a string
# variable and its replacement value to the global space. This is used
# for substitution of substrings in the inf file between % signs. If a
# line contains an invalid format the procedure simly returns.
#
# A Strings section line is of this format:
# string_name=string_value
#
# SYNOPSIS
# addStringLine <line>
#
# PARAMETERS:
# line : a line containing Strings section data.
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc addStringsLine {line} {
if {[checkStringsLineFormat $line] == 0} {
infputs "INF Processing: the Strings section contains an invalid line: $line"
return
}
addStringName $line
}
#############################################################################
#
# arFlagsLine - sets the arFlags for a specified product index
#
# Sets the arFlag for the specified product index by modifying the
# global array variable arFlags. A - is prepended to the
# specified arflags if it does not already exist.
#
# The format of the line read from the inf file is as follows:
# -arflags
#
# SYNOPSIS
# arFlagsLine <line> <prodIndex>
#
# PARAMETERS:
# line : a line containing the arflags to set.
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc arFlagsLine {line prodIndex} {
global arFlags
set arflags [nthValueFromCommaDelimitedLine $line 1]
# prepend a - to the arflags if it does not exist
set firstCharacter [string index $arflags 0]
if {[string compare $firstCharacter \-] != 0} {
set completeArFlags "\-"
append completeArFlags $arflags
} else {
set completeArFlags $arflags
}
infputs "INF Processing: setting arFlags for [productInfoGet name $prodIndex] to $completeArFlags"
set arFlags($prodIndex) $completeArFlags
}
#############################################################################
#
# warningsFileLine - reads and displays the warning file for the product
#
# Reads the specified warnings file for the product and displays
# a warning message box with the contents of the file. The warnings file must
# be ascii text and located in RESOURCE/TCL/INF. This procedure is called last
# for the compSelect page in INSTW32.TCL.
#
# The format of the line read from the inf file is as follows:
# name_of_warnings_file.txt, [control var]
#
# SYNOPSIS
# warningsFileLine <line> [control var]
#
# PARAMETERS:
# line : a line containing the warnings file with the contents to display.
# [control var] : conditional control variable allowing warning message to be
# displayed. infVals(control var) must exist and be set to any
# value other than 0.
#
# If [control var] is specified, the global variable infVars(control var)
# must exist and be set to a value other than 0. Otherwise the warning message
# will not be displayed. This allows for conditional control of displaying the
# warning message.
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc warningsFileLine {line} {
global infVals
set warningsFile [nthValueFromCommaDelimitedLine $line 1]
set controlvar [nthValueFromCommaDelimitedLine $line 2]
# check the control variable
set displayWarning 1
if {[string compare $controlvar no_value] != 0} {
if {![info exists infVals($controlvar)]} {
# control variable is specified but does not exist
set displayWarning 0
infputs "INF Processing: will not add display warnings file $warningsFile: $controlvar specified but infVals($controlvar) not set"
} elseif {$infVals($controlvar)==0} {
# control variable is set to 0
set displayWarning 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -