📄 inf.tcl
字号:
infputs "INF Processing: will not add icon $item: osversion does not match OS: $osversion"
}
}
}
# check the control variable
if {$addicon == 1} {
if {[string compare $controlvar no_value] != 0} {
if {![info exists infVals($controlvar)]} {
# control variable is specified but does not exist
set addicon 0
infputs [array get infVals]
infputs "INF Processing: will not add icon $item: $controlvar specified but infVals($controlvar) not set"
} elseif {$infVals($controlvar)==0} {
# control variable is set to 0
set addicon 0
infputs "INF Processing: will not add icon $item: $controlvar specified but infVals($controlvar) = 0"
}
}
}
if {$addicon == 1} {
set completeDirName [completeDestinationDirName $dir]
# create the group
folderCreateLog $group $ctrlVals(admin) $logValue
# 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"
dbgputs "service installed: $serviceName"
} else {
# NT service registry data
set rootKey HKEY_LOCAL_MACHINE
set key "SYSTEM\\CurrentControlSet\\Services\\$serviceName"
set valueName ImagePath
set value [fullPathName $servicePath $serviceExe]
# check if "Tornado Registry" exists in the service registry
# if exists, that means the service has already been installed
# and we only have to overwrite the wtxregds.exe path and restart
# the service
if {[regValueExists $rootKey $key $valueName]} {
if {![catch {sysRegistryValueWrite \
$rootKey $key $valueName $value} error2]} {
dbgputs "New registry value written. Service Installed."
uninstLog resource "service\t$serviceName"
} else {
infputs "Unable to install service $serviceName: $error2"
uninstLog setuplog \
"\tFailed to install service $serviceName: $error2"
dbgputs "Failed to install $serviceName: $error2"
}
} else {
infputs "Unable to install service $serviceName: $error"
uninstLog setuplog \
"\tUnable to install service $serviceName: $error"
dbgputs "Unable to install $serviceName: $error"
}
}
if {[catch {setupServiceStart $serviceName} error]} {
dbgputs "Unable to confirm that $serviceName was started."
uninstLog setupLog \
"\tUnable to confirm that $serviceName was started."
} else {
dbgputs "service started: $serviceName"
}
}
}
#############################################################################
#
# 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} {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -