📄 install.tcl
字号:
0 {continue}
1 {
lastErrorSet $logMsg
uninstLog setup $logMsg
setupFileNext
}
default {quitCallback}
}
}
ZIP_ERROR {
set logMsg "\terror: can not copy $fileName: zip error"
lastErrorSet $logMsg
uninstLog setup $logMsg
setupFileNext
}
MEMORY_LOW {
set msg [strTableGet 1390_MEMORY_LOW]
switch [dialog ok_cancel "Setup" $msg question 0] {
0 {continue}
default {quitCallback}
}
}
NO_ZIP_FILE {
switch [dialog re_ig_cancel "Setup" \
[strTableGet 1171_FILE_COPY] question 0] {
0 { continue }
1 {
set logMsg "\terror: can not copy $fileName : no zip file"
lastErrorSet $logMsg
uninstLog setup $logMsg
setupFileNext
}
default { quitCallback }
}
}
BAD_PARAM {
set logMsg "\terror: can not copy $fileName: bad param"
lastErrorSet $logMsg
uninstLog setup $logMsg
setupFileNext
}
DISK_FULL {
set msg [strTableGet 1400_DISK_FULL]
switch [dialog ok_cancel "Setup" $msg question 0] {
0 {continue}
default {quitCallback}
}
}
UNEXPECT_EOF {
set logMsg "\terror: can not copy $fileName: zip corrupt"
lastErrorSet $logMsg
uninstLog setup $logMsg
setupFileNext
}
END_OF_LIST {break}
default {
set msg "Setup was unable to copy $fileName from \
the CDROM due to $retVal."
switch [dialog re_ig_cancel "Setup" $msg question 0] {
0 { continue }
1 {
set logMsg "\terror: can not copy $fileName : $retVal"
lastErrorSet $logMsg
uninstLog setup $logMsg
setupFileNext
}
default { quitCallback }
}
}
}
if {"$prevFileName" != "$fileName"} {
incr i
set prevFileName $fileName
}
}
}
execute [productInfoGet name $prodIndex]/postInstall.tcl
}
}
##############################################################################
#
# makefileCreate - creating a make file for use in the updating library step.
#
# SYNOPSIS
# makefileCreate
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc makefileCreate {} {
if {[windHostTypeGet] == "x86-win32"} {
set Makefile "[tempDirGet]\\Makefile"
} {
set Makefile "[tempDirGet]/Makefile"
}
if ![file exists $Makefile] {
set f [open $Makefile "w"]
if {"[windHostTypeGet]" == "x86-win32"} {
puts $f "include [destDirGet]\\target\\h\\make\\make.$(CPU)$(TOOL)"
puts $f "ARFLAGS = -cru"
puts $f "ar:"
puts $f "\t- $(AR) $(ARFLAGS) ..\\lib$(CPU)$(TOOL)$(TYPE).a $(OBJS)"
puts $f "ranlib:"
puts $f "\t- $(RANLIB) ..\\lib$(CPU)$(TOOL)$(TYPE).a"
} {
puts $f "include [destDirGet]/target/h/make/make.$(CPU)$(TOOL)"
puts $f "ARFLAGS = -cru"
puts $f "ar:"
puts $f "\t- $(AR) $(ARFLAGS) ../lib$(CPU)$(TOOL)$(TYPE).a $(OBJS)"
puts $f "ranlib:"
puts $f "\t- $(RANLIB) ../lib$(CPU)$(TOOL)$(TYPE).a"
}
close $f
}
return $Makefile
}
##############################################################################
#
# libUpdateHelper - invokes make to carry out the requested action.
#
# a -n option is used to obtain a list of commands that 'make' supposes to
# carry out. Each command is then evaluated separately. Asking make to carry
# out the real action will cause many console windows to pop up.
#
# SYNOPSIS
# libUpdateHelper <cpu> <tool> <type> <action> [arFlags] [objs]
#
# PARAMETERS:
# <cpu> : CPU family, i.e. MC68000
# <tool>: compiler family, i.e 'gnu'
# <type>: library type, i.e. 'vx'
# <action>: build target, i.e. 'ar' or 'ranlib'
# [arFlags] : the default value is -cru
# [objs] : object file list separated by space, needed when <action> is ar
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc libUpdateHelper {cpu tool type action {arFlags "-cru"} {objs ""}} {
set binDir [destDirGet]/host/[windHostTypeGet]/bin
regsub -all {\\} $binDir {/} binDir
if {![catch {exec $binDir/make -n -f [makefileCreate] CPU=$cpu \
TOOL=$tool TYPE=$type \
OBJS=$objs \
ARFLAGS=$arFlags $action} retVal]} {
regsub -all {\\} $retVal {/} retVal
if {[catch {eval "exec $binDir/$retVal"} error1]} {
if {[catch {eval "exec $retVal"} error2]} {
puts "$error1\n$error2"
uninstLog setup "\t$error1"
uninstLog setup "\t$error2"
} elseif {[debug]} {
puts "\n$retVal"
}
} elseif {[debug]} {
puts "\n$binDir/$retVal"
}
} {
puts $retVal
uninstLog setup "\t$retVal"
}
}
##############################################################################
#
# librariesUpdate - updating the vxWorks libraries.
#
# This routine walks thru each product, updates the vxWorks libraries w/ the
# object list which was obtained and saved by the archListPut() function. The
# default updating flag is -cru. A particular product can override this default
# setting by provide a postInstall.tcl file that contains a call to the
# arFlagsSet() function. The object list is broken into smaller list to
# accommodate the limitation on command line length.
#
# SYNOPSIS
# librariesUpdate
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc librariesUpdate {} {
global setupVals
global objects
set setupVals(cancel) 0
# Determine the total number of new object files for GUI updating purpose.
set totalObjFile 0
foreach objDir [array names objects] {
incr totalObjFile [llength $objects($objDir)]
}
set i 0
set percent 0
# Updating the libraries.
if {$totalObjFile != "0"} {
meterUpdate $percent ""
foreach prodIndex [cdInfoGet selectedProdIndexList] {
foreach archKey [array names objects] {
# typex is useful when updating special component.
# ex: windview,...
if {[regexp {^(.*),(.*),(.*),(.*),(.*),(.*)$} $archKey \
junk index obj cpu tool type typex] && \
"$prodIndex" == "$index"} {
set archiveFile \
[destDirGet]/target/lib/lib$cpu$tool$type.a
if {[file exists $archiveFile]} {
meterUpdate $percent "Updating lib$cpu$tool${type}.a"
# don't backup library if this is the first installation
if {[file extension $setupVals(uninstFile)] != ".001"} {
backup target/lib/lib$cpu$tool$type.a
}
cd [destDirGet]/target/lib/obj$cpu$tool$type$typex
if [debug] {
puts "\nProduct: [productInfoGet desc $prodIndex]"
puts "Library: lib$cpu$tool$type.a"
puts "Object directory: [pwd]"
puts "ARFLAGS: [arFlagsGet $prodIndex]"
puts "Objects: $objects($archKey)"
}
set objs ""
foreach objFile $objects($archKey) {
if {"$setupVals(cancel)" == "1"} { return }
# ar the new objects into the lib
if {[string length $objs] > 200} {
set objs "$objs $objFile"
libUpdateHelper $cpu $tool $type ar \
[arFlagsGet $prodIndex] $objs
set objs ""
} {
# Gather a bunch of obj files, then ar them all.
# This technique improves speed of installation.
set objs "$objs $objFile"
}
set tag "Updating lib$cpu$tool${type}.a"
set percent [expr $i * 100 / $totalObjFile]
meterUpdate $percent $tag
incr i
}
if {[string length $objs] > 0} {
libUpdateHelper $cpu $tool $type ar \
[arFlagsGet $prodIndex] $objs
}
# Ranlib to update the lib table of content.
libUpdateHelper $cpu $tool $type ranlib
} elseif {[debug]} {
puts "skip updating $archiveFile : no such file"
}
}
}
}
}
}
##############################################################################
#
# torVarsCreate - creates a Tornado environment variables startup file.
#
# SYNOPSIS
# torVarsCreate
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc torVarsCreate {} {
global setupVals
set binDir [destDirGet]/host/[windHostTypeGet]/bin
if {"[windHostTypeGet]" == "x86-win32" && [file isdirectory $binDir]} {
if ![file exists $binDir/torVars.bat] {
uninstLog file "wind_base\thost/[windHostTypeGet]/bin/torVars.bat"
}
if ![catch {open $binDir/torVars.bat "w"} f] {
puts $f "rem Command line build environments"
puts $f "set WIND_HOST_TYPE=[windHostTypeGet]"
puts $f "set WIND_BASE=[destDirGet]"
if [info exists setupVals(regHost)] {
puts $f "set WIND_REGISTRY=$setupVals(regHost)"
}
puts $f "set PATH=%WIND_BASE%\\host\\%WIND_HOST_TYPE%\\bin;%PATH%"
close $f
}
} elseif [file isdirectory $binDir] {
if ![file exists $binDir/torVars.csh] {
uninstLog file "wind_base\thost/[windHostTypeGet]/bin/torVars.csh"
}
if ![catch {open $binDir/torVars.csh "w"} f] {
puts $f "# Command line build environments"
puts $f "setenv WIND_HOST_TYPE [windHostTypeGet]"
puts $f "setenv WIND_BASE [destDirGet]"
if [info exists setupVals(regHost)] {
puts $f "setenv WIND_REGISTRY $setupVals(regHost)"
}
puts $f {setenv PATH $WIND_BASE/host/$WIND_HOST_TYPE/bin:$PATH}
close $f
}
if ![file exists $binDir/torVars.sh] {
uninstLog file "wind_base\thost/[windHostTypeGet]/bin/torVars.sh"
}
if ![catch {open $binDir/torVars.sh "w"} f] {
puts $f "# Command line build environments"
puts $f "WIND_HOST_TYPE=[windHostTypeGet]"
puts $f "export WIND_HOST_TYPE"
puts $f "WIND_BASE=[destDirGet]"
puts $f "export WIND_BASE"
if [info exists setupVals(regHost)] {
puts $f "WIND_REGISTRY=$setupVals(regHost)"
puts $f "export WIND_REGISTRY"
}
puts $f {PATH=$WIND_BASE/host/$WIND_HOST_TYPE/bin:$PATH}
puts $f "export PATH"
close $f
}
}
}
##############################################################################
#
# umaskGet - getting the user umask value
#
# This routine gets the current umask setting, converts it to file permision
# format.
#
# SYNOPSIS
# umaskGet
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#
proc umaskGet {} {
global setupVals
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -