?? inf.tcl
字號:
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 infputs "INF Processing: will not add display warnings file $warningsFile: $controlvar specified but infVals($controlvar) = 0" } } if {$displayWarning != 0} { if [catch {open [cdromRootDirGet]\\RESOURCE\\INF\\$warningsFile r} warningsFileId] { infputs "INF processing: Cannot open warnings file $warningsFile" return } set warningMessage [read $warningsFileId] messageBox $warningMessage }}############################################################################### filesCopyLine- copies a file from the values specified from an inf file line## Copies a source file to a destination file. The format of the line read# from the inf file is as follows (optional parameters in brackets):## source path, destination path, [option], [OS version], [control var]## source path : path of the source file to be copied# destination path : path of the destination file# [option] : none | update | overwrite. Set to none by default.# [OS version] : NT3x, NT4x, or WIN95. Specifies to copy the file only if the# current OS being used for installation is that which is# specified.# If no value is specified the icon will be added for any OS.# [control var] : conditional control variable allowing file to be copied.# 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 source file# will not be copied. This allows for conditional control of copying the source# file.## SYNOPSIS# filesCopyLine <line>## PARAMETERS:# line : a comma delimited line containing the path and values of the file to# be copied.## RETURNS: N/A## ERRORS: N/A#proc filesCopyLine {line} { global ctrlVals global infVals set sourcePath [nthValueFromCommaDelimitedLine $line 1] set destinationPath [nthValueFromCommaDelimitedLine $line 2] set option [nthValueFromCommaDelimitedLine $line 3] set osversion [nthValueFromCommaDelimitedLine $line 4] set controlvar [nthValueFromCommaDelimitedLine $line 5] if {[string compare $option no_value]==0} { set option none } if {[isUnix]} { set sourcePath [dosToUnix $sourcePath] set destinationPath [dosToUnix $destinationPath] } set docopy 1 # check the os version switch -exact -- $osversion { no_value { set docopy 1 } default { if {[string compare $osversion $ctrlVals(version)]==0} { set docopy 1 } else { set docopy 0 infputs "INF Processing: will not copy file $sourcePath: osversion does not match OS: $osversion" } } } # check the control variable if {$docopy == 1} { if {[string compare $controlvar no_value] != 0} { if {![info exists infVals($controlvar)]} { # control variable is specified but does not exist set docopy 0 infputs "INF processing: will not copy $sourcePath: $controlvar specified but infVals($controlvar) not set" } elseif {$infVals($controlvar)==0} { # control variable is set to 0 set docopy 0 infputs "INF processing: will not copy $sourcePath: specified but infVals($controlvar) = 0" } } } if {$docopy != 0} { infputs "INF processing: copying file: $sourcePath to $destinationPath" if {[fileDup $sourcePath $destinationPath $option] == 0} { infputs "INF processing: could not copy $sourcePath" } }}############################################################################### processInfSection - reads and processes an inf file section.## Processes an inf section until the next section or end of file is# reached. The function to process each data line must be specified.## SYNOPSIS# processInfSection <addFunction> [prodIndex]## PARAMETERS:# addFunction : the function that processes each individual line.# prodIndex : optional product Index. Necessary for the ArFlags section.## RETURNS: N/A## ERRORS: N/A#proc processInfSection {addFunction {prodIndex 0}} { set sectionOver 0 while {$sectionOver == 0} { set line [readLine] set lineType [getLineType $line] if {[string compare $lineType section_name] == 0} { set sectionOver 1 } elseif {[string compare $lineType comment] == 0} { # comment, do nothing } elseif {[string compare $lineType end_of_file] == 0} { return } else { if {[string compare $addFunction arFlagsLine] == 0} { # ArFlags is the only function that requires prodIndex $addFunction $line $prodIndex } else { $addFunction $line } # check for end of file if {[endOfFile]} { return } } }}############################################################################### searchAndProcessSection - searches for and processes an inf file section.## Searches for and processes the specified section of the inf file. The# procedure first processes the Strings section of the inf file if it has# not been done already.## SYNOPSIS# searchAndProcessSection <section> <fileName> [prodIndex]## PARAMETERS:# section : the name of the INF section to be processed.# fileName : the name of the INF file.# prodIndex : optional product Index. Necessary for the ArFlags section.## RETURNS:# 0 if processing the section was unsuccessful.# 1 if successful.## ERRORS: N/A#proc searchAndProces
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -