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

📄 inf.tcl

📁 这是vxworks 的图形界面开发软件windML2.0和另一个CP2可以构成完整的界面开发。
💻 TCL
📖 第 1 页 / 共 5 页
字号:

        # add the icon
        if {[string compare $iconPath no_value]==0} {
            # iconPath not specified, use default executable for icon
            infputs "INF Processing: \
                  adding Icon: $group $item $exe $args $completeDirName"
            linkCreateLog $group $item "$destinationDir$exe" $args \
                          $completeDirName $ctrlVals(admin) $fmin $iconIndex
        } else {            
            infputs "INF Processing: \
                  adding Icon: $group $item $exe $args $completeDirName \
                               $destinationDir$iconPath"
            linkCreateLog $group $item "$destinationDir$exe" $args \
                          $completeDirName $ctrlVals(admin) $fmin \
                          $iconIndex "$destinationDir$iconPath"
        }   
    }   
}

#############################################################################
#
# completeDestinationDirName - returns a directory path based on 
#                              the user selected destination directory
#               
# Prepends the destination directory specified by [destDirGet] to
# the directory value.  Slashes are correctly handled.  
#
# SYNOPSIS
# completeDestinationDirName <dir>
#
# PARAMETERS: 
#   dir : directory path to prepend the destination directory path
#          
# RETURNS: 
#   directory path with destination directory prepended
#   
# ERRORS: N/A
#


proc completeDestinationDirName {dir} {
    set destinationDir [destDirGet]
   
    # add trailing slash to destinationDir if it does not exist
    set lastCharacter [string index $destinationDir [expr [string length $destinationDir]-1]]
    if {[string compare $lastCharacter \\] != 0} {
        append destinationDir \\
    }
   
    # remove beginning slash from dir if it exists       
    set firstCharacter [string index $dir 0]
    if {[string compare $firstCharacter \\] == 0} {
        set dir [string range $dir 1 [expr [string length $dir]-1]]
    }  

    # dir might be equal to no_value.  Set it to an empty string if this is the case.  
    if {[string compare $dir no_value]==0} {
        set dir ""
    }      

    return "$destinationDir$dir" 
}

#############################################################################
#
# fullPathName - returns a full path to the specified executable.
# 
# Returns a complete pathname given, including the destination directory
# prepended to the path, given an executable or file and the path to the executable.
# 
# SYNOPSIS
# fullPathName <path> <exe>
#
# PARAMETERS: 
#   path : directory path to the executable
#   exe : executable or file
#          
# RETURNS: 
#   complete directory path to the executable, including the destination 
#   directory prepended to the path.
#   
# ERRORS: N/A
#

proc fullPathName {path exe} {
    set completeDirName [completeDestinationDirName $path]

    set endStringIndex [expr [string length $completeDirName]-1]
    set lastCharacter [string index $completeDirName $endStringIndex]

    # add the trailing slash to completeDirName if it does not exist
    if {[string compare $lastCharacter \\] != 0} {
        append completeDirName \\
    }    

    # append the executable name to completeDirName
    append completeDirName $exe
    return $completeDirName
}

#############################################################################
#
# addServiceLine - adds a service to Windows NT from the values read from
#                  a line from an inf file 
#
# Adds and starts the specified service if the OS is Windows NT.  If the OS
# is not Windows NT the procedure simply returns.  The format of the line read 
# from the inf file is as follows (optional parameters in brackets):
#
#   service name, executable, path, [dependency], [control var]
#   
#   service name : name of the service to be added to Windows NT
#   executable : filename of the service executable
#   path : directory path to the executable         
#   dependency : any dependencies that must be started before this service
#   [control var] : conditional control variable allowing service to be added.
#                   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 service will not
# be added.  This allows for conditional control of adding the service.
#
# SYNOPSIS
# addServiceLine <line>
#
# PARAMETERS: 
#   line : a comma delimited line containing values to be added as a service to 
#          Windows NT.
#
# RETURNS: N/A
#   
# ERRORS: N/A
#

proc addServiceLine {line} {
    global ctrlVals
    global infVals

    if {$ctrlVals(NT) != 1} {
        infputs "INF Processing: will not add service: OS is not NT"
        return
    }

    set serviceName [nthValueFromCommaDelimitedLine $line 1]
    set serviceExe  [nthValueFromCommaDelimitedLine $line 2]
    set servicePath [nthValueFromCommaDelimitedLine $line 3]
    set dependency  [nthValueFromCommaDelimitedLine $line 4]
    set controlvar  [nthValueFromCommaDelimitedLine $line 5]


   
    if {[string compare $dependency no_value]==0} {
        set dependency ""
    }
    if {[string compare $servicePath no_value]==0} {
        set servicePath ""
    }

    # check the control variable
    set addservice 1
    if {[string compare $controlvar no_value] != 0} {         
        if {![info exists infVals($controlvar)]} {
            # control variable is specified but does not exist
            set addservice 0
            infputs "INF Processing: will not add service $serviceName: $controlvar specified but infVals($controlvar) not set"
        } elseif {$infVals($controlvar)==0} {
            # control variable is set to 0            
            set addservice 0
            infputs "INF Processing: will not add service $serviceName: $controlvar specified but infVals($controlvar) = 0"
        }
    }
    
    if {$addservice != 0} {
        infputs "INF processing: adding service: $serviceName $servicePath $serviceExe $dependency"        
        if {![catch {setupServiceInstall $serviceName [fullPathName $servicePath $serviceExe] $dependency} error]} {
            uninstLog resource "service\t$serviceName"            
        } else {
            infputs "Unable to install service $serviceName: $error" 
            uninstLog setuplog \
                   "\tFailed to install service $serviceName"
        }
        catch {setupServiceStart $serviceName} error
    }
}

#############################################################################
#
# checkSolarisPatch - checks to make sure the specified patch is installed
#                     for a Solaris machine.
#
# 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.6 | 2.6: operating system is Solaris 2.6
# 5.5 | 2.5: operating system is Solaris 2.5 
# ultra:     user's machine model is an Ultra
# pci:       user's machine uses a PCI bus 
#
# An example condition list: 2.6 ultra pci  
# specifies to check for the patch only if the user's machine is an Ultra with a
# PCI bus running Solaris 2.6.
#
# 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 {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
    set user_osversion [catch {exec /bin/uname -r}]
    infputs "INF Processing: CheckPatch: osversion = $user_osversion"

    # For Solaris 2.6, specifically check for "5.6".  This means that 
    # only version 2.6 of the OS is checked for, not 2.6.x.  If in 
    # the future we need to check for 2.6.x, do a regsub check as 
    # with the 5.5 check done below.  The reason this has been done is
    # for the required XServer patch for Solaris 2.6(.0) machines that
    # will crash without the required patch, for which 2.6.1 most likely
    # will fix.  
    if {$user_osversion == "5.6"} {
        set solaris26 1
    } else {
        set solaris26 0
    }
    
    if {[regsub 5\.5 $user_osversion {} ignore]} {
        set solaris25 1
    } else {
        set solaris25 0
    }

    # model (e.g. Ultra)
    set user_machinemodel [catch {exec /bin/uname -i}] 
    if {[regsub -nocase Ultra $user_machinemodel {} ignore]} {
        set user_machinemodel ultra
    } else {
        set user_machinemodel sparcstation
    }            
            
    infputs "INF Processing: CheckPatch: model = $user_machinemodel"
            
    # check for pci
    catch { exec /bin/ls /devices | /bin/grep -i pci } pci_check
    if {[regsub -nocase pci $pci_check {} ignore]} {
        set user_pci 1
        infputs "INF Processing: CheckPatch: pci present"
    } else {
        set user_pci 0
        infputs "INF Processing: CheckPatch: pci not present"
    }  

    
    # check for patch conditions
    set check_for_patch 1
    if {$conditions == "no_value"} {
        set conditions ""
    }
    foreach condition $conditions {
        switch -- $condition {
            5.6 -
	    2.6 {
                if {$solaris26 == 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.6"
		}
	    } 
            5.5 -
	    2.5 {
                if {$solaris25 == 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.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"     
	    }
        }
    }
}


#############################################################################
#
# checkHPUXPatch - checks to make sure the specified patch is installed
#                     for an HPUX machine.

⌨️ 快捷键说明

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