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

📄 insttext.tcl

📁 vxWorks 下DosFs2的补丁包!
💻 TCL
📖 第 1 页 / 共 3 页
字号:

    set free [fspace [destDirGet]]
    if [regexp {^[0-9]+$} $free] {
        set setupVals(availSpace) [format "%3.1f" [expr $free / 1024.0]]
    } {
        set setupVals(availSpace) "???.?"
    }

    puts -nonewline "Space Required:  "
    puts [format "%15s MB" $setupVals(totalSize) ]
    puts -nonewline "Space Available: "
    if { $setupVals(availSpace) < $setupVals(totalSize) } {
        puts [format "%15s MB" "***$setupVals(availSpace)***" ]
    } { 
        puts [format "%15s MB" $setupVals(availSpace) ]
    }
    puts ""

}

proc pageProcess(compSelect) {} {

    global setupVals

    if { $setupVals(availSpace) < $setupVals(totalSize) } {
        errorHandler "Warning" [strTableGet 3150_COMP_SELECT_WARN]
    
        switch -regexp -- [prompt [strTableGet 3155_COMP_SELECT_QUESTION]] {
             ^-$"       { return 0 }
            "^(Y|y)|^$" { # goes to 2 pages earlier
                          return -1 }
            "^(N|n)"    { return 1 } 
            default     { return 0 }
        }
     }
     return 1
}

proc createString {char length} {

    set i 0
    set str ""
    while {$i < $length} {
        append str $char
        incr i
    }
    return $str
}

proc pageCreate(permission) {} {

    global setupVals
    global perVals 
 
    printPageTitle [strTableGet 1460_TITLE_PERMISSION]
    print "[strTableGet 3160_PERMISSION]\n"
    print "[strTableGet 3162_PERMISSION]\n"

    if {[catch {setupId effective group} gprName]} {
        set gprName "group"
    }

    if {[catch {setupId effective user} usrName]} {
        set usrName "user"
    }

    if ![info exists setupVals(umask)] umaskGet

    # find the maximum string length among other, usrName and gprName
    if { [string length "other"] > [string length $gprName] && \
        [string length "other"] > [string length $usrName] } {
        set perVals(colWidth) [string length "other"]    
    } elseif {
        [string length $usrName] > \
        [string length $gprName] } {
        set perVals(colWidth) [string length $usrName]
    } else {
        set perVals(colWidth) [string length $gprName]
    }

    # initialize the permission array     
    set perVals(infoList) "ur uw gr gw or ow"
    foreach item $perVals(infoList)  {
        set perVals($item) ""
        if { $setupVals($item) == 1 } {
            set perVals($item) "x" 
        }
    }
    set width [expr $perVals(colWidth)] 
    set str [createString - $width]

    puts [format "%4s %10s %-*s %-13s" "item" "    on    " $width \
                  user "   permission" ]
    puts [format "%4s %10s %-*s %-13s" "----" "   ----   " $width \
                  $str "   ----------" ]
    puts [format "%4s %10s %-*s %-13s"     "" "     $perVals(ur)    " \
          $width $usrName "   read" ]
    puts [format "%4s %10s %-*s %-13s"     "" "     $perVals(uw)    " \
          $width $usrName "   write" ]
    puts [format "%4s %10s %-*s %-13s"      1 "     $perVals(gr)    " \
          $width $gprName "   read" ]
    puts [format "%4s %10s %-*s %-13s"      2 "     $perVals(gw)    " \
          $width $gprName "   write" ]
    puts [format "%4s %10s %-*s %-13s"      3 "     $perVals(or)    " \
          $width other "   read" ]
    puts [format "%4s %10s %-*s %-13s"      4 "     $perVals(ow)    " \
          $width other "   write" ]
    puts ""

    while (1) {
        set ret [prompt [strTableGet 3165_PERMISSION_QUESTION]]
        switch -regexp -- $ret {
            "^-$"       { return 0 }
            "^[0-9]+([ ][0-9]+)*$" { changePermission $ret ; return -1 }
            "^$"        { return 1 }
            default     { }
        }
    }
    return 1
}

proc pageProcess(permission) {} {
    return 1
}

proc changePermission {idList} {

    global setupVals
    global perVals 

    set count 1
    foreach per "gr gw or ow"  {
        set perList($count) $per
        incr count
    } 

    foreach id $idList {
        if {[array size perList] < $id || $id == 0} {
            errorHandler "Error" [strTableGet 3145_COMP_SELECT_CHANGE_INVALID]
            return 0
        } 
    }

    foreach id $idList {
        flipPermission $perList($id) 
    }

    return 1
}

proc pageCreate(filesCopy) {} {

    global setupVals

    printPageTitle [strTableGet 1470_TITLE_FILECOPY]
    print "[strTableGet 1170_FILE_COPY]\n"

    filesCopy
    return 1
}


proc pageProcess(filesCopy) {} {

    # This global variable is set in the tornado/postInstall.tcl
    global tornadoInstalled
    global setupVals
    global objects

    if ![info exists tornadoInstalled] {
        pageRemove "remoteRegistryHost"
    } 

    set binDir "[destDirGet]/host/[windHostTypeGet]/bin"

    if {[array names objects] == ""} {
        pageRemove "libUpdate"
    }
    return 1
}

proc pageCreate(libUpdate) {} {

    printPageTitle [strTableGet 1480_TITLE_LIBUPDATE]
    print "[strTableGet 3180_LIB_UPDATE]\n"

    librariesUpdate
    return 1
}

proc pageProcess(libUpdate) {} {
    return 1
}

proc pageCreate(remoteLicenseHost) {} {

    global setupVals

    # Query the hostname which Tornado Registry will be running.

    printPageTitle [strTableGet 1561_TITLE_LICENSE_REMOTE]
    print "[strTableGet 1353_LICENSE_REMOTE]\n"

    if ![catch {open $setupVals(windLmHostHome)/WIND_LMHOST "r"} fLmHost] {
        set setupVals(licenseHost) [lindex [split [read $fLmHost] "\n"] 0]
        close $fLmHost
    }

    if { [info exists setupVals(licenseHost)] && \
         $setupVals(licenseHost) != "" } {
         set msg "Enter host name: \[$setupVals(licenseHost)\]"
    } {
         set msg "Enter host name:"
    }

    while (1) {
        set ret [prompt "$msg"]
            switch -regexp -- $ret {
            "^-$"   { return 0 }
            "^$"    { 
                if {$setupVals(licenseHost) != ""} {
                    return 1
                }
            }
            default { set setupVals(licenseHost) $ret; return 1 }
        }
    }
}

proc pageProcess(remoteLicenseHost) {} {

    global setupVals

    set retVal 1

    if {![file isdir $setupVals(windLmHostHome)] &&
         [catch {file mkdir $setupVals(windLmHostHome)} error]} {

        errorHandler "error" "$error"
        return 0
    }

    if {![regexp {^[ ]*$} "$setupVals(licenseHost)"]} {
        if ![catch {open $setupVals(windLmHostHome)/WIND_LMHOST "w"} fLmHost] {
            puts $fLmHost $setupVals(licenseHost)
            close $fLmHost
            exitMsgSet [strTableGet 1354_LICENSE_REMOTE]
        }
    } {
        errorHandler "Warning" [strTableGet 1072_WARN_1]
        set retVal 0
    }

    return $retVal
}

proc pageCreate(remoteRegistryHost) {} {

    global setupVals

    # Query the hostname which Tornado Registry will be running.
    printPageTitle [strTableGet 1490_TITLE_REGISTRY_HOST]
    print "[strTableGet 1190_REGISTRY_HOST]\n"
    if { [info exists setupVals(regHost)] && \
         $setupVals(regHost) != "" } {
         set msg "Enter host name: \[$setupVals(regHost)\]"
    } {
        set msg "Enter host name:" 
    }
    while (1) {
        set ret [prompt "$msg"]
            switch -regexp -- $ret {
            "^-$"   { return 0 }
            "^$"    { }
            default { set setupVals(regHost) $ret; return 1 }
        } 
    }   
}

proc pageProcess(remoteRegistryHost) {} {
    return 1
}

proc pageCreate(finish) {} {
    global setupVals
    global tornadoInstalled

    printPageTitle [strTableGet 1500_TITLE_FINISH]

    # Normal exit message

    exitMsgSet [strTableGet 1210_FINISH]

    # Remind the user that they may need to install license

    if {[llength [cdInfoGet installedFeatureIdList]] > 0} {
        exitMsgSet "[exitMsgGet]  [strTableGet 1205_FINISH]"
    }

    # Warn the user in case of error during the setup

    if {[errorCountGet] > 0} {
        exitMsgSet "[exitMsgGet]  [strTableGet 1200_FINISH_WARN]"
    }

    if [info exists tornadoInstalled] {
        torVarsCreate
    }

    print "[exitMsgGet]\n"

    return 1
}

proc pageProcess(finish) {} {
    uninstStop
    return 1
}

proc pageCreate(licenseFinish) {} {

    printPageTitle [strTableGet 1500_TITLE_FINISH]

    uninstLog setupLog "[cdInfoGet number] SETUP"
    uninstLog setupLog [strTableGet 1261_LICENSE]

    print "[exitMsgGet]\n"
    return 1
}

proc pageProcess(licenseFinish) {} {
    uninstStop
    return 1
}


proc meterUpdate {percent tag}  {
    puts "${percent}%\t $tag"
}

proc bbrdUpdate {percent} {
    #dummy function 
}

proc print {msg {lineLength 80}} {

    set newStr [split $msg " "]
    set str ""
    foreach word $newStr {
        set wordLength [string length $word]
        set strLength [string length $str]
        if {[expr $wordLength + $strLength] < $lineLength} {
            set str [append str $word " "]
        } {
            puts "$str"
            set str ""
            set str [append str $word " "] 
        }
    }
    # print the last line
    puts "$str"
}

proc mailSend {} {

    global setupVals

    set tmpFile [tempDirGet]/licInfo.[pid]
    set f [open $tmpFile "w"]
    puts $f $setupVals(mailMsg)
    close $f

    set to [strTableGet 1220_MAIL_TO]
    set subject [strTableGet 1230_MAIL_SUBJECT]

    if [catch {exec mail -s $subject $to < $tmpFile} error] {
        if [catch {exec mail $to < $tmpFile} e] {
            errorHandler "Error" [strTableGet 1240_MAIL_ERROR]
            return 0
        }
    }

    print "[strTableGet 1250_MAIL_OK]\n"
    return 1
}

proc pageCreate(licenseKey) {} {

    global setupVals

    printPageTitle [strTableGet 1510_TITLE_LICENSE_KEY]
    print "[strTableGet 1260_LICENSE_KEY [info host]\n"

    set setupVals(licenseKey) "" 
    while (1) {
        set ret [prompt "Enter License Key:"]
        switch -regexp -- $ret {
            "^$"    { }
            "^-$"   { return 0 }
            default { set setupVals(licenseKey) $ret ; break }
        }
    }    
    return 1
}

proc pageProcess(licenseKey) {} {
    validKey
    return 1
}
    
proc pageCreate(moreKey) {} {
    global setupVals

    while (1) {
        switch -regexp -- [prompt [strTableGet 3355_LICENSE_QUESTION]] {
            "^(y|Y|-$)"  { return 0 }
            "^(n|N)|^$"  { 
		licenseShow
		return 1 
	    }
            default      { } 
        }
    }
    return 1
}

proc validKey {} {
    global setupVals

    set retVal 1

    if {[string trim $setupVals(licenseKey)] != "" && \
        [lsearch $setupVals(licenseKeyList) $setupVals(licenseKey)] == -1} {
        
        set prog [cdromBinDirGet]/WLMUTILS
        if [catch {exec $prog -decodeKey $setupVals(licenseKey)} error] {
            errorHandler "Error"  [strTableGet 1281_LICENSE_KEY_ERROR_2 \
                                               $setupVals(licenseKey)]

            set retVal 0
        } {
            lappend setupVals(licenseKeyList) [list $setupVals(licenseKey)]
            updateKeyInfo $setupVals(licenseKey)
        }
    }

    set setupVals(licenseKey) ""
    return $retVal
}

proc updateKeyInfo {key} {
    global setupVals

    set prog [cdromBinDirGet]/WLMUTILS

    if [catch {exec $prog -decodeKey $key} retVal] {
        errorHandler "Error" "$retVal"
        return 0
    }

    set pList [split $retVal "\n"]

    set licenseInfo ""
    append licenseInfo "Feature Id:    [lindex $pList 0]\n"
    append licenseInfo "Feature Name:  [featureDescGet [lindex $pList 0]]\n"
    append licenseInfo "Licenses:      [lindex $pList 2]\n"
    append licenseInfo "Start date:    [clock format [lindex $pList 3] \
                                             -format "%b %d %Y"]\n" 
    append licenseInfo "Expire date:   [clock format [lindex $pList 4] \
                                             -format "%b %d %Y"]\n" 
    puts $licenseInfo
    return 1
}

proc licenseShow {} {
    
    global setupVals

    foreach key $setupVals(licenseKeyList) {
        set prog [cdromBinDirGet]/WLMUTILS
        if [catch {exec $prog -decodeKey [join $key ""]} retVal] {
            errorHandler "Error" "$retVal"
            return 0
        }
        set pList [split $retVal "\n"]
       	

⌨️ 快捷键说明

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