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

📄 filecopy.tcl

📁 vxworks WindML 3.0补丁包3 (CP3)
💻 TCL
📖 第 1 页 / 共 4 页
字号:
            lastErrorSet $logMsg
            uninstLog setup $logMsg
            setupFileNext
        }

        MEMORY_LOW {
            set msg [strTableGet FILESCOPY_MEMORY_LOW_WARN]

            if { [isGUImode] } {
                if { $ctrlVals(useInputScript) } {
                    autoSetupLog "$msg"
                    autoSetupLog "Application Exit\n"
                    set setupVals(cancel) 1                
                    applicationExit
                    return 0
                }
            }

            if { [isGUImode] } {
                set ret [dialog ok_cancel "Setup" $msg question 0]
            } else {
                puts "\n\n$msg\n\nChoose 0: Continue\nChoose 1: Exit SETUP\n"
                set ret [prompt]
            }
            switch -- $ret {
                0 { return NULL }
                1 { 
                    # if TEXT mode, exit
                    if { ![isGUImode] } { return 0 }

                    quitCallback
                }
            }
        }

        NO_ZIP_FILE {
            set msg [strTableGet FILESCOPY_CDROM_READ_ERROR]
            set logMsg "\terror: cannot copy $fileName : no zip file"

            if { [isGUImode] } {
                if { $ctrlVals(useInputScript) } {
                    autoSetupLog "$logMsg"
                    autoSetupLog "Application Exit\n"
                    set setupVals(cancel) 1                
                    applicationExit
                    return 0
                }
            }
 
            if { [isGUImode] } {
                set ret [dialog re_ig_cancel "Setup" $msg question 0]
            } else {
                puts "\n\n$msg\n\nChoose 0: Retry\nChoose 1: Ignore\nChoose 2: Abort\n"
                set ret [prompt]
            }

            switch -- $ret {
                0 { return NULL }
                1 {
                    lastErrorSet $logMsg
                    uninstLog setup $logMsg
                    setupFileNext
                }
                2 { 
                    # if TEXT mode, exit
                    if { ![isGUImode] } { return 0 }

                    quitCallback
                }
            }
        }

        BAD_PARAM {
            set logMsg "\terror: cannot copy $fileName: bad param"
            lastErrorSet $logMsg
            uninstLog setup $logMsg
            setupFileNext
        }

        DISK_FULL {
            set msg [strTableGet FILESCOPY_DISK_FULL_WARN]

            if { [isGUImode] } {
                if { $ctrlVals(useInputScript) } {
                    autoSetupLog "$msg"
                    autoSetupLog "Application Exit\n"
                    set setupVals(cancel) 1                
                    applicationExit
                    return 0
                }
            }

            if { [isGUImode] } {
                set ret [dialog ok_cancel "Setup" $msg question 0]
            } else {
                puts "\n\n$msg\n\nChoose 0: Continue\nChoose 1: Exit SETUP\n"
                set ret [prompt]
            }
            switch -- $ret {
                0 {return NULL}
                1 {
                    set setupVals(diskfull) 1
                                    
                    # if TEXT mode, exit
                    if { ![isGUImode] } { return 0 }
    
                    quitCallback
                }
            }
        }

        UNEXPECT_EOF {
            set logMsg "\terror: can not copy $fileName: zip corrupt"
            lastErrorSet $logMsg
            uninstLog setup $logMsg
            setupFileNext
        }

        END_OF_LIST { return break }

        default {
            set msg "Setup was unable to copy $fileName from \
                    the CDROM due to $retVal.\n\n"

            if { [isGUImode] } {
                if { $ctrlVals(useInputScript) } {
                    autoSetupLog "$msg"
                    autoSetupLog "Application Exit\n"
                    set setupVals(cancel) 1                
                    applicationExit
                    return 0
                }
            } 
            if { [isGUImode] } {
                set ret [dialog re_ig_cancel "Setup" $msg question 0]
            } else {
                puts "\n\n$msg\nChoose 0: Retry\nChoose 1: Ignore\nChoose 2: Abort\n"
                set ret [prompt]
            }

            switch -- $ret {    
                0 { return NULL }
                1 {
                    set logMsg "\terror: cannot copy $fileName : $retVal"
                    lastErrorSet $logMsg
                    uninstLog setup $logMsg
                    setupFileNext
                }
                2 { 
                    # if TEXT mode, exit
                    if { ![isGUImode] } { return 0 }

                    quitCallback
                }
            }
        }
    }
    return NULL
}

##############################################################################
#
# fileRemove - remove the specified file
#
# This procedure removes the specified file, and if fails to do so, it's then
# popping up a dialog to query for the next action.
#
# SYNOPSIS
# fileRemove <fileName>
#
# PARAMETERS:
#    fileName : a path filename
#
# RETURNS:
#    OK     : successful removing <filename>
#    RETRY  : failed to remove the file, and user wants to retry.
#    IGNORE : failed to remove the file, and user wants to ignore it.
#
# ERRORS: N/A
#

proc fileRemove {fileName} {

    if [catch {file delete $fileName} error] {
        set msg [strTableGet FILESCOPY_FILE_ACCESS_ERROR $fileName $error]

        if { [isGUImode] } {
            set ret [dialog re_ig_cancel "Setup" $msg question 0]
        } else {
            puts "\n$msg\n\nChoose 0: Retry\nChoose 1: Ignore\nChoose 2: Cancel\n"
            set ret [prompt]
        }

        switch -- $ret {
            0 { return "RETRY" }
            1 {
                set logMsg "\terror: $fileName: $error"
                lastErrorSet $logMsg
                uninstLog setup $logMsg
                return "IGNORE"
            }
            2 { # cancel
                # if TEXT mode, exit
                if { ![isGUImode] } { return 0 }

                quitCallback
            }
        }
    }
    return "OK"
}

##############################################################################
#
# filesCopy - copies all the selected product files into the user destination
#             directory.
#
# This routine walks thru each selected product, and do the following actions:
#
#   - runs the preInstall.tcl if any
#   - creates a record to the setup.log
#   - obtains a list of sub-products, and do the following actions:
#
#      + calls setupFileSetMake to build the sub-product filelist
#      + calls setupFileExtract to extract each file from the filelist.
#        An internal pointer is advanced until it hits the end of the list.
#        The setupFileExtract function returns one of the following messages:
#
#        Message           Next actions
#        -------           ------------
#        OK                - creates uninstall record,  advances file pointer.
#        EXIST_AND_SAME    - skips this file
#        EXIST_AND_NEWER   - backup the original file, and extracts this file
#                            again
#        EXIST_AND_OLDER   - same as above
#        MULTIPLE_VERSION  - keeps the newer version of the file, backup the
#                            original if it's older.
#        NOT_FOUND         - queries for retry until user gives up.
#        ZIP_ERROR         - logs the error message into the setup.log
#        MEMORY_LOW        - queries user for continue or not.
#        NO_ZIP_FILE       - queries for retry until user gives up.
#        BAD_PARAM         - logs the error message into the setup.log
#        DISK_FULL         - queries user for continue or not.
#        UNEXPECT_EOF      - logs the error message into the setup.log
#        END_OF_LIST       - continues w/ the next sub-product.
#
#   - runs the postInstall.tcl if any
#
#
# SYNOPSIS
# filesCopy
#
# PARAMETERS: N/A
#
# RETURNS: N/A
#
# ERRORS: N/A
#

proc filesCopy {} {
    global setupVals
    global ctrlVals
    global current_file
    global multipleVersion

    cd [destDirGet]

    set setupVals(cancel) 0
    set totalFiles [cdInfoGet totalFile]
    set desc "Unknown component"
    set i 0

    uninstLog setup "CD manufacturing time: [cdNameGet time]"
    uninstLog setup "[cdInfoGet number]\t$setupVals(version)\t[destDirGet]"
    uninstLog setup [cdNameGet description]

    # Append CD Info to the uninstall record

    uninstLog cdNumber "$setupVals(CDnumber)"

    # Add host OS to setup log

    if {[isUnix]} {
        catch {exec uname -a} hostOS
    } else {
        if [catch {setupWinVerGetEx} hostOS] {
            puts "error: $hostOS"
        }
    }
    uninstLog setup "$hostOS"

    # find products that specify to be installed last

    set firstList ""
    set lastList ""
    foreach prodIndex [cdInfoGet selectedProdIndexList] {
        if {[searchAndProcessSection InstallLast \
            [chooseInfFile $prodIndex]]==1} {
            puts "INF Processing: installing \
                  [productInfoGet name $prodIndex] last"
            set lastList [linsert $lastList end $prodIndex]
        } else {
            set firstList [linsert $firstList end $prodIndex]
        }
    }

    set sortedSelectedProdIndexList [concat $firstList $lastList]
    set licensedProds ""

    foreach prodIndex $sortedSelectedProdIndexList {

        currentIndexSet $prodIndex

        # Do preinstall if any
        execute [productInfoGet name $prodIndex]/preInstall.tcl

        # Append install info to the setup.log

        set featureID [productInfoGet featureId $prodIndex]
        set productName [productInfoGet name $prodIndex]
        set prodNum [productInfoGet number $prodIndex]
        set desc [productInfoGet desc $prodIndex]
        set current_product $desc

        # compile the list of licensed products

        if {[licensedProductCheck $featureID]} {
            lappend licensedProds "licensed product: $productName $featureID"
        }

        uninstLog setup "$prodNum\t$desc"
        if ![info exists setupVals(confirmation)] {
            set setupVals(confirmation) ""
        }

        lappend setupVals(confirmation) "$desc"

        # Append info to the uninstall record

        uninstLog info "$desc"

        # Begin the copy loop

        set prevFileName ""

        foreach partIndex [productInfoGet selectedPartIndexList $prodIndex] {

            set partDesc [partInfoGet desc $partIndex]

            if [catch {setupFileSetMake $partIndex} error] {
                uninstLog setup "\tskip installing $partDesc: $error"
                dbgputs "unable to install $partDesc: $error"
                lastErrorSet "$error"
                continue
            } else {
                dbgputs "Installing [productInfoGet desc $prodIndex] -> $partDesc"
            }

            while { 1 } {
                if {$setupVals(cancel) == 1} {return}

                set fileName [setupFileNameGet 0]
                set current_file [checkPathLen $fileName]

                # update meter

                set percent [expr $i * 100 / $totalFiles]
                meterUpdate $percent $fileName

                # GUI mode only
                if { [isGUImode] } {
                    if {![limitColors]} { bbrdUpdate $percent }
                }

                set f [destDirGet]/$fileName

                catch {setupFileExtract} retVal

                # change "group" and "other" execute permissions for Unix files.

                if {[isUnix]} { setExecutePermissions $f }

                dbgputs [format "%20s\t%s" $retVal $fileName]

                set instRet [processInstall $retVal $fileName $prodIndex]

                if { $instRet == "break" } {
                    break
                } elseif { $instRet == 0 } {
                    # for TEXT mode, return value = 0, exit SETUP
                    if { ![isGUImode] } { return 0 }
                }

                if {"$prevFileName" != "$fileName"} {
                    incr i
                    set prevFileName $fileName
                }
            }

        }
        execute [productInfoGet name $prodIndex]/postInstall.tcl
    }

    #
    # fix up multiple versions of file
    #
    set count 0
    set totalFiles [llength [array names multipleVersion]]

    foreach fileName [array names multipleVersion] {
        set percent [expr $count * 100 / $totalFiles]
        meterUpdate $percent "Resolving version conflicts..."
        incr count

        set f [destDirGet]/$fileName
        set numProdIndex [llength $multipleVersion($fileName)]
        set pIndx [lindex $multipleVersion($fileName) 0]

⌨️ 快捷键说明

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