⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inf.tcl

📁 windml3.0.3
💻 TCL
📖 第 1 页 / 共 5 页
字号:
    }
}

#############################################################################
#
# 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
            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 mu

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -