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

📄 insttext.tcl

📁 基于VxWorks的图形界面开发工具Zinc6.0的升级补丁。
💻 TCL
📖 第 1 页 / 共 3 页
字号:
# INSTTEXT.TCL - an interactive text-based Installation program for#                Unix platforms.## history# -------# 01u,13jun97,pdn  replaced tclx id command w/ setupId.# 01t,28mar97,pdn  fixed the problem that torVarCreate get call too early# 01s,10mar97,tcy  added licenseShow () # 01r,09mar97,pdn  fixed normal exit code to 0# 01q,08mar97,tcy  moved needUpdateWlmd() from INSTALL.TCL back to this file ;#		   added productInstFlagSet # 01p,07mar97,tcy  clean up # 01o,28feb97,pdn  improved license setup.# 01n,26feb97,tcy  fixed license server pages# 01m,09feb97,pdn  added option to configure a floating license server# 01l,23jan97,tcy  handled error when fails to obtain free disk space; #                  rearranged column formats# 01k,22jan97,tcy  fixed a typo introduced by the last mod# 01j,21jan97,tcy  saved installation key ;#                  catched error when symbolic group id not defined# 01i,14jan97,tcy  added code to skip part information if product is deselected # 01h,18dec96,sks  changed location of TCL and BITMAP files; renamed#                  TEXT.TCL to MESSAGES.TCL                   # 01g,11dec96,tcy  added hierarchy selection option # 01f,08nov96,tcy  clean up# 01e,04nov96,tcy  rewritten to conform with GUI-based program# 01d,01oct96,tcy  moved umaskSet(), umaskGet(), getSelection() to INSTALL.TCL# 01c,27sep96,tcy  replace procedure with while loop to implement prompt# 01b,24sep96,tcy  modified to conform with GUI-based program# 01a,10sep96,tcy  written ############################################################################# Create the Welcome page#proc pageCreate(welcome) {} {    global setupVals    printPageTitle [strTableGet 1410_TITLE_WELCOME]    print "[strTableGet 1000_WELCOME1]\n"    print "[strTableGet 1010_WELCOME2]\n"    print "[strTableGet 3020_WELCOME3]\n"    print "[strTableGet 1030_WELCOME4]\n"    print "[strTableGet 1040_WELCOME5]\n"    while (1) {         switch -regexp -- [prompt [strTableGet 3000_RETURN_QUESTION]] {             "^-$"   { return 0 }            "^$"    { return 1 }            default { }        }    }}proc pageProcess(welcome) {} {    return 1}proc needUpdateWlmd {} {    global ctrlVals setupVals     set retVal 0    set installedWlmd [destDirGet]/host/[windHostTypeGet]/bin/wlmd    set cdWlmd [cdromBinDirGet]/WLM/WLMD     if {[file exists $installedWlmd]} {        set retVal [expr [file mtime $installedWlmd] < [file mtime $cdWlmd]]    }    return $retVal} proc pageCreate(wlmdDetect) {} {    global setupVals    printPageTitle "[strTableGet 1261_LICENSE] Detect"    print [strTableGet 1358_LICENSE_SERVER_DETECT]    set setupVals(isWlmdRunning) 0    if [needUpdateWlmd] {        set prog [cdromBinDirGet]/WLMUTILS	set setupVals(isWlmdRunning) [exec $prog -pingServer [info host]]    }    return 1} proc pageProcess(wlmdDetect) {} {    global setupVals     global ctrlVals     if {$setupVals(isWlmdRunning)} {        errorHandler "Warning" [strTableGet 1359_LICENSE_SERVER_SHUTDOWN]        exit 0    } {        set ctrlVals(currPage) destDir        pageRemove wlmdDetect        set ctrlVals(pageListBack) $ctrlVals(pageList)        return 1    }}proc pageCreate(privilege) {} {    global setupVals     printPageTitle [strTableGet 1420_TITLE_WARNING]    print "[strTableGet 3050_ROOT_WARN]\n"    while (1) {         switch -regexp -- [prompt [strTableGet 3000_RETURN_QUESTION]] {            "^-$"   { return 0 }            "^$"    { return 1 }            default { }         }    }}proc pageProcess(privilege) {} {    return 1}proc pageCreate(registrationName) {} {    global setupVals    printPageTitle [strTableGet 1430_TITLE_REGISTRATION]    print "[strTableGet 1060_REGISTRATION]\n"    if { "[userNameGet]" == "" } {        set msg "Enter your name:"     } {        set msg "Enter your name: \[[userNameGet]\]"    }    set ret [prompt "$msg"]        switch -regexp -- $ret {        "^-$"   { return 0 }        "^$"    { return 1 }        default { userNameSet $ret; return 1 }    }    }  proc pageProcess(registrationName) {} {    return 1}proc pageCreate(registrationCompany) {} {    global setupVals    if { "[companyNameGet]" == "" } {        set msg "Enter your company:"     } {        set msg "Enter your company: \[[companyNameGet]\]"    }    set ret [prompt "$msg"]        switch -regexp -- $ret {        "^-$"   { return 0 }        "^$"    { return 1 }        default { companyNameSet $ret; return 1 }    }    }proc pageProcess(registrationCompany) {} {    return 1}proc pageCreate(registrationKey) {} {    global setupVals    if { "[instKeyGet]" == "" } {        set msg "Enter your key:"     } {         set msg "Enter your key: \[[instKeyGet]\]"    }    set ret [prompt "$msg"]        switch -regexp -- $ret {        "^-$"   { return 0 }        "^$"    { return 1 }        default { instKeySet $ret; return 1 }    }    }proc pageProcess(registrationKey) {} {    global setupVals    global errorInfo    if [catch {setupKeyValidate [instKeyGet]} error] {        errorHandler "Error" [strTableGet 1070_WARN_1]        return 0    }    if [catch {setupInit [cdromZipDirGet]} error] {        if {"$error" == "BAD_CD_KEY"} {            errorHandler "Error" [strTableGet 1080_WARN_2]            return 0        } elseif {"$error" == "BAD_CD_REVISION"} {            errorHandler "Error" [strTableGet 1080_WARN_4]            exit 0        } elseif {"$error" == "BAD_CD_VENDOR_ID"} {            errorHandler "Error" [strTableGet 1080_WARN_3]            return 0        } {            errorHandler "Error" [strTableGet 1090_WARN_3 $error]            exit 0        }    }    objectConstruct     return 1}proc pageCreate(destDir) {} {    global setupVals        printPageTitle [strTableGet 1440_TITLE_DESTDIR]    print "[strTableGet 3100_DEST_DIR]\n"    set msg "\[[destDirGet]\]"    set ret [prompt "$msg"]    switch -regexp -- $ret {        "^-$"   { return 0 }        "^$"    { return 1 }        default { destDirSet $ret; return 1 }    }    }proc pageProcess(destDir) {} {    global setupVals    if [regexp {~} [destDirGet]] {        errorHandler "Error" "Invalid directory specified"        return 0    }     if {![file isdirectory [destDirGet]]} {        errorHandler "Warning" [strTableGet 3110_DEST_DIR_WARN]        switch -regexp -- [prompt [strTableGet 3115_DEST_DIR_QUESTION]] {            "^(N|n)|^-$" { return 0 }            "^(Y|y)|^$" {                 if [catch {file mkdir [destDirGet]} error] {                    errorHandler "Error" $error                    return 0                } {                    set status 1                }            }                default { }        }         }  {        set status 1    }    if {![file writable [destDirGet]]} {        errorHandler "Error" [strTableGet 1130_DEST_DIR_WARN3]        return 0        }    uninstStart [instTypeGet]    licenseHomeDirSet [destDirGet]/.wind/license    catch {        set windDir [file dirname $setupVals(profile)]        if ![file isdirectory $windDir] {            file mkdir $windDir        }        set f [open $setupVals(profile) "w"]        puts $f "userNameSet [userNameGet]"        puts $f "companyNameSet [companyNameGet]"        puts $f "destDirSet [destDirGet]"        if {[instKeyGet] == "none"} {             puts $f "instKeySet $setupVals(prevInstKey)"        } {             puts $f "instKeySet [instKeyGet]"        }        close $f    }    return $status}proc pageCreate(compSelect) {} {    printPageTitle [strTableGet 1450_TITLE_OPTION]    print "[strTableGet 3140_COMP_SELECT]\n"    productTextListUpdate     productTextSizeUpdate     while (1) {        set ret [prompt [strTableGet 3145_COMP_SELECT_CHANGE]]        switch -regexp -- $ret {            "^-$"   { return 0 }            "^$"    { return 1 }            "^[0-9]+([ ][0-9]+)*$" { productChange $ret ; return -1 }            default { }        }    }    return 1}proc productInstFlagSet {prodIndex} {    if {[llength [productInfoGet partIndexList $prodIndex]] == 1} {	errorHandler "error" "product $prodIndex does not contain parts!"    } {    	foreach partIndex [productInfoGet partIndexList $prodIndex] {            if {[partInfoGet instFlag $partIndex] == 1} {            	productInfoSet instFlag $prodIndex 1	        return 1            }        }        productInfoSet instFlag $prodIndex 0     }} 		proc productChange {idList} {    global prodToListMap    set idList [lsort -integer $idList]      foreach id $idList {        if {[regexp {^[0-9][0-9][0-9][0-9]+$} $id]} {            errorHandler "Error" [strTableGet 3145_COMP_SELECT_CHANGE_INVALID]            return 0        } elseif { [array size prodToListMap] < $id || $id == 0 } {             errorHandler "Error" [strTableGet 3145_COMP_SELECT_CHANGE_INVALID]            return 0        }     }    foreach id $idList {        if {[llength $prodToListMap($id)] == 1} {            set prodIndex [lindex $prodToListMap($id) 0]            if {[llength [productInfoGet partIndexList $prodIndex]] == 1} {                # length is 1 ; i.e. the item is a product                if {[productInfoGet instFlag $prodIndex] == 1} {                    productInfoSet instFlag $prodIndex 0                } {                    productInfoSet instFlag $prodIndex 1                }            } {                # the item is a product containing parts                # no detail of the product if it is deselected                if {[productInfoGet instFlag $prodIndex] == 1} {                    productInfoSet instFlag $prodIndex 0                } {                    print "The product \"[productInfoGet desc $prodIndex]\"\                           contains the following parts:"                    puts ""                    partTextListUpdate $prodIndex                    while (1) {                        set ret [prompt [strTableGet 3145_COMP_SELECT_CHANGE]]                        switch -regexp -- $ret {                            "^-$"   { return 0 }                            "^$"    { 				productInstFlagSet $prodIndex				 break 			    }                            "^[0-9]+([ ][0-9]+)*$" { 				partChange $ret                                partTextListUpdate $prodIndex 			    }                            default { }                        }                     }                }            }        } {             errorHandler "Error" \                "variable prodToListMap contains incorrect data"         }    }    return 1}proc partChange {idList} {    global partToListMap    set idList [lsort -integer $idList]     foreach id $idList {        if {[regexp {^[0-9][0-9][0-9][0-9]+$} $id]} {            errorHandler "Error" [strTableGet 3145_COMP_SELECT_CHANGE_INVALID]            return 0        } elseif { [array size partToListMap] < $id || $id == 0 } {            errorHandler "Error" [strTableGet 3145_COMP_SELECT_CHANGE_INVALID]            return 0        }    }     foreach id $idList {        if {[llength $partToListMap($id)] == 2} {            set prodIndex [lindex $partToListMap($id) 0]            set partIndex [lindex $partToListMap($id) 1]            if {[partInfoGet instFlag $partIndex] == 1} {                partInfoSet instFlag $partIndex 0            } {                partInfoSet instFlag $partIndex 1            }        } {            errorHandler "Error" \                "variable parToListMap contains incorrect data"         }    }    switch [productInfoGet stateInfo $prodIndex] {        changedIncr {            productInfoSet instFlag $prodIndex 1         }        changedToNone {            productInfoSet instFlag $prodIndex 0         }        unchanged {	}        changedDecr {	}    }    productInfoSet stateCommit $prodIndex    productInfoSet childStateCommit $prodIndex    return 1 }proc partTextListUpdate {prodIndex} {    global partToListMap    puts [format "%4s %-8s %-40s %-8s" \         item selected descriptions size(MB) ]     puts [format "%4s %-8s %-40s %-8s" \         ---- -------- ---------------------------------------- -------- ]     set count 1    foreach partIndex [productInfoGet partIndexList $prodIndex] {        set partToListMap($count) [list $prodIndex $partIndex]        set selected ""        if {[partInfoGet instFlag $partIndex] == 1} {             set selected "x"           }        set mbSize [byteToMbyte [partInfoGet size $partIndex]]        puts [format "%4s %2s %2s %2s %-40s %8s" "  $count" \                     "" $selected "" [partInfoGet desc $partIndex] $mbSize]        incr count    }    puts ""    return 1}proc productTextListUpdate {} {      global setupVals    global prodToListMap    puts [format "%4s %-8s %-40s %-8s" \         item selected descriptions size(MB) ]     puts [format "%4s %-8s %-40s %-8s" \         ---- -------- ---------------------------------------- -------- ]     set count 1     foreach prodIndex [cdInfoGet productIndexList] {        set prodToListMap($count) $prodIndex        set selected ""        if {[productInfoGet instFlag $prodIndex] == 1} {            set selected "x"           }        set mbSize [byteToMbyte [productInfoGet size $prodIndex]]        puts [format "%4s %2s %2s %2s %-40s %8s" "  $count" \              "" $selected "" [productInfoGet desc $prodIndex] $mbSize]        incr count    }    puts ""    return 1}proc productTextSizeUpdate {} {    global setupVals    set setupVals(totalSize) [byteToMbyte [cdInfoGet size]]

⌨️ 快捷键说明

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