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

📄 install.tcl

📁 Berkeley DB 4.6.21VxWorks CD.NC.tar.gz
💻 TCL
📖 第 1 页 / 共 3 页
字号:
        cd [tempDirGet]        if [catch {exec ZIP $setupVals(uninstFile) -g -q -1 -m \                            "installFile" "installInfo" "installBackup"\                            "installResource" "installCDnumber"} error] {             puts "$error"        }	cd [cdromRootDirGet]    } else {        uninstFileClose    }}################################################################################ fileAppend - appends the content of the source to the destination file.## This procedure takes the content of the source file and appends it to the# destination file.## SYNOPSIS# fileAppend <srcFilePath> <destFilePath>## PARAMETERS: #    srcFilePath : a path to the source filename#    destFilePath : a path to the destination filename## RETURNS: N/A## ERRORS: N/A#proc fileAppend {srcFilePath destFilePath} {    set ftmp [open $srcFilePath "r"]    set f [open $destFilePath "a+"]    while {[gets $ftmp line] != "-1"} {        puts $f $line    }          close $ftmp    close $f}################################################################################ uninstLog - stores the specified string into the appropriate disk file.## SYNOPSIS# uninstLog <key> <string>## PARAMETERS: #    key : a string that long enough to differentiate between disk filenames,#          <r>esource, <b>ackup, <f>ileNew, <i>nfo, <s>etupLog, <c>dNumber#    string : string to be stored.## RETURNS: N/A## ERRORS: N/A#proc uninstLog {key string} {     global setupVals     uninstFileOpen     if [catch { switch -glob $key {                     c* {                          puts $setupVals(fInstallCDnumber) $string                      }                     r* {                          puts $setupVals(fInstallResource) $string                          incr setupVals(uninstLog)                     }                     b* {                          puts $setupVals(fInstallBackup) $string                          incr setupVals(uninstLog)                     }                     f* {                          puts $setupVals(fInstallFile) $string                          incr setupVals(uninstLog)                     }                     i* {                          puts $setupVals(fInstallInfo) $string                      }                     s* {                          puts $setupVals(fSetupLog) "[installDate]\t$string"                         if {[destDirGet] != ""} {                             flush $setupVals(fSetupLog)                             catch {file copy -force \                                         [tempDirGet]/setup.log.tmp \                                         [destDirGet]/setup.log.abort}                         }                     }                         default {                          puts "uninstLog error: $key does not exist"                      }                 }              } error] {          puts "cannot record \"$string\": $error"      } }################################################################################ installDate - forms a simple date string ## SYNOPSIS# installDate## PARAMETERS: N/A## RETURNS: a date string (i.e, 08-Apr-97.18:30)## ERRORS: N/A#proc installDate {} {    return [clock format [clock second] -format "%d-%b-%y.%H:%M"]}################################################################################ fileDup - copies a file## This routine copies srcFile to destFile.  The default option flag is 'none' # which means doing nothing if destFile exists, update: if srcFile is newer, # backup destFile then copies, overwrite: backup then copies.  In case of# failure, a message will be displayed, and user has a chance to decide next# action.  All successful copied filename will be logged for later uninstall.## SYNOPSIS# fileDup <srcFile> <destFile> [option]## PARAMETERS: #    <srcFile> : an absolute path filename#    <destFile> : an absolute path filename#    [option] : none | update | overwrite#               # RETURNS: True or False bases on success or failure.## ERRORS: N/A#proc fileDup {sourceFilePath destFilePath {option none}} {    global ctrlVals setupVals    if ![file exists $sourceFilePath] {        dbgputs "$sourceFilePath not found"        return 0    }    regsub -all {\\} $destFilePath {/} destFilePathUnixStyle    regsub -all {\\} [destDirGet] {/} destDir    regsub "$destDir/" $destFilePathUnixStyle "" relDestFilePathUnix    switch $option {        none {            if [file exists $destFilePath] {return 1}        }        checkVersion {            # this option is mainly used for checking version of DLLs in             # the Windows System directory; we don't backup the file and            # we don't keep track of the file for uninstall purpose            if [catch {setupFileVersionInfoGet $sourceFilePath} wrsVersion] {                dbgputs "Cannot get file version of $sourceFilePath: $wrsVersion"            }            if {[file exists $destFilePath] &&               [catch {setupFileVersionInfoGet $destFilePath} userVersion]} {               dbgputs "Cannot get file version of $destFilePath: $userVersion"            }            if {[file exists $destFilePath] && $wrsVersion < $userVersion} {                return 1            }            # if we reach this, we need to overwrite the old file            # no backup here because we'd like to keep the new version             set noLog 1        }        update {            if {[file exists $destFilePath] &&                 [file mtime $sourceFilePath] <= [file mtime $destFilePath]} {                return 1            } elseif {[file exists $destFilePath]} {                backup $relDestFilePathUnix	    }        }        overwrite {            if {[file exists $destFilePath]} {                backup $relDestFilePathUnix	    }	}        default {            puts "fileDup $sourceFilePath $destFilePath $option"            puts "unknown option: $option"        }    }    set destDir [file dirname $destFilePath]    if {![file isdirectory $destDir] && [catch {file mkdir $destDir} error]} {        puts "$error"        return 0    }    if [catch {file copy -force $sourceFilePath $destFilePath} error] {        set msg [strTableGet 1370_FILE_ACCESS_ERROR $destFilePath $error]        switch [dialog re_ig_cancel "Setup" $msg question 0] {            0 {return [fileDup $sourceFilePath $destFilePath $option]}            1 {                set msg "\tcannot create $destFilePath: $error"                lastErrorSet $msg                uninstLog setup $msg                return 0            }            default {quitCallback}        }    }    if {[info exists setupVals(fileMode)] && [windHostTypeGet] != "x86-win32"} {        catch {exec chmod $setupVals(fileMode) $destFilePath}    }    # logging for later uninstall    if ![info exists noLog] {        uninstLog file "wind_base\t$relDestFilePathUnix"    }    return 1}################################################################################ pageRemove - removes an installation step## This routine removes an element from the pageList which control the flow of# the setup script.  Once an element is removed from the list, their associate# functions, pageCreate() and pageProcess() will be skipped.## SYNOPSIS# pageRemove <pageName>## PARAMETERS: #    <pageName> : an element in the pageList## RETURNS: N/A## ERRORS: N/A#proc pageRemove {page} {    global ctrlVals    if {[lsearch $ctrlVals(pageList) $page] == "-1"} {        dbgputs "cannot find page $page to remove"    } else {        set tempList ""        foreach p $ctrlVals(pageList) {            if {"$p" != "$page"} {                lappend tempList $p            }        }        set ctrlVals(pageList) $tempList    }}################################################################################ cdInfoGet - returns the requested information## Following is the list of available commands:# # Command                 Meaning# -------                 -------# number                  the name of the CDROM# size                    the total size of unlocked products# totalFile               the total files of unlocked products# stateInfo               the global selection information# featureIdList           the feature list of unlocked products# productIndexList        the index list of unlocked products# selectedProdIndexList   the selected products index list# selectedProdNameList    the selected products name list# installedFeatureIdList  the selected feature id list## SYNOPSIS# cdInfoGet <command>## PARAMETERS: #    <command> : one of the above commands## RETURNS: the requested information## ERRORS: N/A#proc cdInfoGet {info} {    global cdObj    switch $info {        number { return $cdObj(number) }        productIndexList { return $cdObj(productIndexList) }         selectedProdIndexList {            set retVal {}            foreach prodIndex $cdObj(productIndexList) {                if {[productInfoGet instFlag $prodIndex]} {                    lappend retVal $prodIndex                }            }            return $retVal        }        selectedProdNameList {            set retVal {}                foreach prodIndex [cdInfoGet selectedProdIndexList] {                set prodName [productInfoGet name $prodIndex]                    if {[lsearch $retVal "$prodName"] == "-1"} {                    lappend retVal $prodName                }            }                return $retVal        }        size {            set retVal 0            foreach selProdIndex [cdInfoGet selectedProdIndexList] {                incr retVal [productInfoGet size $selProdIndex]            }            return $retVal        }        totalFile {            set retVal 0            foreach selProdIndex [cdInfoGet selectedProdIndexList] {                incr retVal [productInfoGet totalFile $selProdIndex]            }                    return $retVal        }        installedFeatureIdList {            set retVal {}            foreach selProdIndex [cdInfoGet selectedProdIndexList] {                set fId [productInfoGet featureId $selProdIndex]                if {($fId > 0) && ([lsearch $retVal $fId] == -1)} {                    lappend retVal $fId                }            }            return $retVal        }        featureIdList {            set retVal {}            foreach prodIndex [cdInfoGet productIndexList] {                set fId [productInfoGet featureId $prodIndex]                if {($fId > 0) && ([lsearch $retVal $fId] == -1)} {                    lappend retVal $fId                }            }            return $retVal        }        stateInfo {            set totalPrev 0            set totalCurr 0            set state "unchanged"            foreach prodIndex [cdInfoGet productIndexList] {                set prev [productInfoGet prevInstFlag $prodIndex]                set curr [productInfoGet instFlag  $prodIndex]                incr totalPrev $prev                incr totalCurr $curr                if {"$prev" != "$curr"} {                    set state "changed"                }            }            return [stateInfoHelper $state $totalCurr $totalPrev]        }        default { puts "cdInfoGet: unknown command: $info" }    }}################################################################################ featureDescGet - returns the feature name given the feature id## SYNOPSIS# featureDescGet <featureId>## PARAMETERS: #    <featureId> : an integer## RETURNS: the associated feature description or unknown if not exists.## ERRORS: N/A#proc featureDescGet {featureId} {    global featureObj    if [info exists featureObj($featureId)] {        return $featureObj($featureId)    } else {        return "unknown"    }}################################################################################ productInfoGet - returns the requested info of a product.## Attribute               Meaning# ---------               -------# partIndexList           a list of integer indentifies parts# number                  a string that represents a product, sale perpective# name                    a string that represents a product, mfg perpective# desc                    a string that describes a product

⌨️ 快捷键说明

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