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

📄 inf.tcl

📁 windml3.0.3
💻 TCL
📖 第 1 页 / 共 5 页
字号:
                    set check_for_patch 0
                    infputs "INF Processing: CheckPatch: will not check for patch $patchnumber:"
                    infputs "INF Processing: CheckPatch: condition user machine not Solaris 2.5"
                }
            } 
            Ultra -
            ultra {
                if {$user_machinemodel != "ultra"} {
                    set check_for_patch 0
                    infputs "INF Processing: CheckPatch: will not check for patch $patchnumber:"
                    infputs "INF Processing: CheckPatch: condition user machine not Ultra"
                }
            }
            pci -
            PCI {
                if {$user_pci != 1} {
                    set check_for_patch 0
                    infputs "INF Processing: CheckPatch: will not check for patch $patchnumber:"
                    infputs "INF Processing: CheckPatch: condition user machine not pci"
                }
            }
            default {
                infputs "INF Processing: CheckPatch: condition $condition not supported"
            }
        }
    }

    if {$check_for_patch == 1} {
        infputs "INF Processing: CheckPatch: checking for patch $patchnumber"
        regexp {[0-9]+} $patchnumber patchid
        regexp {\-[0-9]+} $patchnumber patchversion
        regexp {[0-9]+} $patchversion patchversion
        infputs "INF Processing: CheckPatch: required patch level: $patchversion"
        catch { exec /bin/showrev -p | /bin/grep $patchid } showrev
        # count the number of patch versions installed
        set num_patches_installed [regsub -all "$patchid-\[0-9\]+" $showrev {} ignore]

        # check the patches are equivalent or higher version
        set patch_installed 0

        for {set i $num_patches_installed} {$i > 0 && $patch_installed == 0} {incr i -1} {
            regexp "$patchid-\[0-9\]+" $showrev patch_compare
            regexp {\-[0-9]+} $patch_compare installed_patch_version
            regexp {[0-9]+} $installed_patch_version installed_patch_version
            if {$installed_patch_version >= $patchversion} {
                set patch_installed 1
                infputs "INF Processing: CheckPatch: $patch_compare installed for $patchnumber requirement"
            }
            regsub "$patchid-\[0-9\]+" $showrev {} showrev
        }
       
        # 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"     
            }
        }
    }
}

#############################################################################
#
# checkSolarisPatch_for_t3 - checks to make sure the specified patch is 
#                            installed for a Solaris machine.
#
# This procedure is used in T3 only
#
# This is the actual routine for Solaris that checks whether the required
# patch specified by <line> is installed on the user's machine.  Information
# about the user's machine is first gathered, then the list of conditions
# is iterated through to determine whether to actually check for the installed
# patch.
#
# The list of conditions is a tcl style list.  If no conditions are specified,
# the patch will automatically be checked to determine if it has been installed.
# If any of the conditions specified do not match the information gathered about
# the user's machine, installation of the patch is NOT checked.
# The following conditions are supported:
#
# 5.7 | 2.7: operating system is Solaris 2.7
# configuration-specific:
# PGX (M64 Graphics card): for patch 106146-06
# Creator/Creator3D graphics card: for patch 106145-04
# Elite3D graphics card: for patch 106144-06
#
# An example condition list: 2.7 m640
# specifies to check for the patch only if the user's machine has 
# m640 graphics card and is running on Solaris 2.7
#
# Any patches that are not found to be installed are appended
# to the global string setupVals(uninstalledPatches_required) or
# setupVals(uninstalledPatches_recommended).  This string is used
# in INSTW32.TCL to display to the user a messageBox detailing the required
# patches.
#
#
# SYNOPSIS
# checkSolarisPatch <line>
#
# PARAMETERS:
#   line : a comma delimited line containing required patches to be checked.
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc checkSolarisPatch_for_T3 {line} {
    global setupVals

    set patchnumber [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"
    }

    # os version
    catch {exec /bin/uname -r} user_osversion
    infputs "INF Processing: CheckPatch: osversion = $user_osversion"

    # graphics cards
    catch {exec /bin/ls /dev/fbs} user_graphicsCard

    # For Solaris 2.7, specifically check for "5.7".  This means that
    # only version 2.7 of the OS is checked for, not 2.7.x.

    if {$user_osversion == "5.7"} {
        set solaris27 1
    } else {
        set solaris27 0
    }

    # check for patch conditions
    set check_for_patch 1
    if {$conditions == "no_value"} {
        set conditions ""
    }
    foreach condition $conditions {
        switch -- $condition {
            5.7 -
                2.7 {
                if {$solaris27 == 0} {
                    set check_for_patch 0
                    infputs "INF Processing: CheckPatch:\
                             will not check for patch $patchnumber:"
                    infputs "INF Processing: CheckPatch:\
                             condition user machine not Solaris 2.7"
                }
            }
            m640 -
                M640 {
                if {$user_graphicsCard != "m640"} {
                    set check_for_patch 0
                    infputs "INF Processing: CheckPatch:\
                             will not check for patch $patchnumber:"
                    infputs "INF Processing: CheckPatch:\
                                     condition user machine not M640 graphics card"
                }
            }
            ffb -
                FFB {
                if {$user_graphicsCard != "ffb"} {
                    set check_for_patch 0
                    infputs "INF Processing: CheckPatch:\
                             will not check for patch $patchnumber:"
                    infputs "INF Processing: CheckPatch:\
                             condition user machine not FFB graphics card"
                }
            }
            afb -
                AFB {
                if {$user_graphicsCard != "afb"} {
                    set check_for_patch 0
                    infputs "INF Processing: CheckPatch:\
                             will not check for patch $patchnumber:"
                    infputs "INF Processing: CheckPatch:\
                             condition user machine AFB graphics card"
                }
            }
            default {
                infputs "INF Processing: CheckPatch:\
                         condition $condition not supported"
            }
        }
    }

    if {$check_for_patch == 1} {
        infputs "INF Processing: CheckPatch: checking for patch $patchnumber"
            regexp {[0-9]+} $patchnumber patchid
        regexp {\-[0-9]+} $patchnumber patchversion
        regexp {[0-9]+} $patchversion patchversion
        infputs "INF Processing: CheckPatch: required patch level: $patchversion"
        catch { exec /bin/showrev -p | /bin/grep $patchid } showrev        

        # count the number of patch versions installed
            set num_patches_installed [regsub -all "$patchid-\[0-9\]+" $showrev {} ignore]

        # check the patches are equivalent or higher version
        set patch_installed 0

        for {set i $num_patches_installed} {$i > 0 && $patch_installed == 0} {incr i -1} {
            regexp "$patchid-\[0-9\]+" $showrev patch_compare
            regexp {\-[0-9]+} $patch_compare installed_patch_version
            regexp {[0-9]+} $installed_patch_version installed_patch_version
            if {$installed_patch_version >= $patchversion} {
                set patch_installed 1
                infputs "INF Processing: CheckPatch: $patch_compare installed for $patchnumber requirement"
            }
            regsub "$patchid-\[0-9\]+" $showrev {} showrev
        }

        # 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"
            }
        }
    }
}


#############################################################################
#
# checkHPUXPatch - checks to make sure the specified patch is installed
#                     for an HPUX machine.
#
# 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.
    #

    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"
            }
        }

⌨️ 快捷键说明

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