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

📄 uninst.tcl

📁 Berkeley DB 4.6.21VxWorks CD.NC.tar.gz
💻 TCL
📖 第 1 页 / 共 3 页
字号:
# UNINST.TCL - Uninstallation program for Unix/Windows platforms.## modification history# --------------------# 02z,18jul99,bjl  Do not cd to root dir at end of uninstall for Unix.  # 02y,02apr99,wmd  Fix a hole where pgr folders get deleted enmass.# 02x,02apr99,wmd  Install a pause after each unregister of a component or#                  executable.# 02w,02apr99,wmd  Add line to delete docs directory.# 02v,22mar99,tcy  replace batch file with t2UninstallCleanup.exe # 02u,16mar99,tcy  added saftguard to prevent SETUP from wiping out all#                  program folders# 02t,12mar99,wmd  Need to add a new required file: wrsCW.dll.# 02s,03mar99,tcy  destroy warning messages before starting UNINST process# 02r,01mar99,tcy  added warning message to advice users to kill any Tornado#                  applications before running UNINST (fix for SPR 25168)# 02q,22feb99,tcy  unregister dlls (fix for SPR 23331)# 02p,27jan99,tcy  renamed meterUpdate() to uninstMeterUpdate();#                  added sourcing of INCLUDE.TCL# 02o,26jan99,wmd  Need to add more output to autoUninst log file to monitor#                  uninstall.# 02n,26jan99,wmd  Fix a typo, mispelled UNINST for the uninstall log file.# 02m,19jan99,wmd  Modify so that uninstall can run automatically with a#                  script file.  Update procs to use WRS coding conventions,#                  remove all vestiges of TK and TEXT mode, env(UI), etc.# 02l,03dec98,tcy  copies setup engine from SETUP directory instead# 02k,17nov98,bjl  made uninstall entire Tornado the default choice, added#                  warning box after user presses OK (fixes SPR 23274).  # 02j,12nov98,tcy  look for env(TMP) for UNIX# 02i,12nov98,tcy  do not uninstall resources for UNIX# 02h,12nov98,tcy  do not set env(UI), env(TMP), and env(PATH) due to #                  possible lack of environmental space on Win95# 02g,15oct98,tcy  reduce height of progressmeter# 02f,01oct98,wmd  added waitcursor to uninstInfoGet# 02e,16sep98,tcy  added UNIX support# 02d,16sep98,tcy  msvcp50.dll required for uninstall# 02c,13aug98,tcy  fixed file for new T2 UITclSh# 02b,04aug98,tcy  changed meter to progressmeter# 02a,27jul98,tcy  changed to controlPropertySet in onUITclDialogOk ()# 01q,11aug97,pdn  fixed uninstFile() to handle case fileList is null.# 01p,13jun97,pdn  started to use the DLL version of the setup APIs.# 01o,15apr97,pdn  fixed the logging machanism.# 01n,28mar97,pdn  stopped removing user private files# 01m,12mar97,pdn  fixed typo.# 01l,04feb97,pdn  added retry option for uninstFile(), and fix uninstResource # 01k,27feb97,pdn  reset the PATH environment variable (Windows 95)# 01j,24feb97,pdn  reduced the time to switch between uninstall choices.# 01i,24jan97,pdn  added way to remove files under Windows directory# 01h,18dec96,sks  changed location of TCL and BITMAP files; renamed#                  TEXT.TCL to MESSAGES.TCL                   # 01g,09dec96,pdn  used tcl 7.6 file utilities# 01f,27nov96,pdn  used deltree to remove temp dir for Window 95# 01e,14nov96,pdn  fixed meter bug occurs when totalItem is 0# 01d,13nov96,pdn  added seedUninstall function.# 01c,08nov96,pdn  adjusted the binding of the Return key to match the default#                  button# 01c,08nov96,pdn  fixed uninstInfoGet() to obtain a completed list#                  of file when trying to uninstall all.# 01b,05nov96,pdn  added support for Windows.# 01a,16oct96,pdn  written.#set uninst(WIND_BASE) [lindex $argv 0]######################################################################### UNINST.TCL## This file contains implements the uninstall program that is part# of the setup and installation process.  # # On Windows hosts, Setup installs the Uninstall icon within the # program group created by the user.  The command line to execute# on Windows hosts is:# $WIND_BASE/SETUP/X86/WIN32/UITCLSH.EXE $WIND_BASE/.wind/uninst/UNINST.TCL#    $WIND_BASE -seed## On Unix hosts, the user invokes the executable script UNINST that is # located in the $WIND_BASE/host/<host-type>/bin,## To automate the use of UNINST, set the environment variable# UNINSTALL_ANS_FILE = <uninstCfg.tcl>#       where <uninstCfg.tcl> contains the following:##======== Start of Script ==================================================# # Auto uninstallation config file for setup## This is a config file used for auto uninstallation by UNINST. # The env. variables UNINSTALL_ANS_FILE and UNINSTALL_LOG_FILE are required# #set UNINSTALL_ANS_FILE=c:setupCfg.tcl    #set UNINSTALL_LOG_FILE=c:autoInst.log    # ########################################################## Variable edit section ###########################################################global env## User Name ##set userName "will"## Company Name ##set companyName "WIND RIVER SYSTEMS"## uninstallOption: can be "partial" or "all" ##set uninstallOption partial########################################################### End of edit section ##################################################################################################################### Do not change the following ########################################################### global uninst## end ##========= End of Script ===================================================## Note:  In the above script, the lines that do not end with # are the actual# executable lines, remove the '#' from the start of those lines.# By setting the uninstallOption variable to "all" or "partial," you can# simulate selection of remove all or remove last installation respectively.################################################################################# uninstWin32 - puts up the Uninstall dialogue## This procedure displays the Uninstall dialogue.  It is modal unless the# environment variable UNINSTALL_ANS_FILE contains a filename to a valid# tcl script which automates uninstall.  In that case the dialog is modeless.## SYNOPSIS# uninstWin32## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc uninstWin32 {} {    global string    global uninst    global uninstallOption    set modeLess "-nocontexthelp"    if {$uninst(useInputScript)} {        if {$uninstallOption == "partial"} {            set uninst(mode) part        } else {            set uninst(mode) all        }    set modeLess "-modeless"    }    dialogCreate \       -name uninstDlg \       -title "Tornado Uninstall" \       -width 323 -height 218 \       $modeLess -nocontexthelp \       -init uninstUITclDialogInit \       -control [list \           [list bitmap -name bitmap -title \                    [file join $uninst(home) UNINST.BMP] -stretch \                    -xpos 10 -ypos 10 -width 94 -height 170] \           [list label -name headerMsg \                   -title $string(header) \                   -xpos 117 -ypos 11 -width 199 -height 17] \           [list choice -title $string(button1) \                    -name uninstAll -newgroup -auto \                    -xpos 117 -ypos 35 -width 140 -height 10  \                    -callback {onUninstallAll callback}] \           [list choice -title $string(button2) \                   -name uninstPart -auto \                   -xpos 117 -ypos 47 -width 171 -height 10  \                   -callback {onUninstallPart callback}] \           [list label -title "" -name installInfo  \                   -xpos 130 -ypos 60 -width 186 -height 53] \           [list label -name warningMessage  \                   -xpos 117 -ypos 114 -width 199 -height 9] \           [list label -name message  \                   -xpos 117 -ypos 123 -width 199 -height 37] \           [list label -name exitMessage  \                   -xpos 117 -ypos 160 -width 199 -height 28] \           [list frame -gray -name separator  \                   -xpos 7 -ypos 188 -width 309 -height 1] \           [list button -title "OK" -name okButt -default \                   -xpos 207 -ypos 197 -width 50 -height 14  \                   -callback onUITclDialogOk] \           [list button -title "Cancel" -name cancelButt  \                   -xpos 266 -ypos 197 -width 50 -height 14  \                   -callback {windowClose uninstDlg}]]    if {$uninst(useInputScript)} {        set message "Uninstall is seeded with the $uninstallOption option"        autoUninstLog $message        if {$uninst(mode) == "part"} {            controlCheckSet uninstDlg.uninstPart 1        } else {            controlCheckSet uninstDlg.uninstAll 1        }        onUITclDialogOk    }}################################################################################ onUITclDialogOk - call back procedure for the OK button## This procedure begins the process of removing either the last install session# or all of Tornado depending on the contents of uninst(mode).  If the user# has chose 'all', he is asked to confirm his choice.## SYNOPSIS# ## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc onUITclDialogOk {} {    global uninst    global env    if {$uninst(mode) == "all"} {         set finalwarning "WARNING: You have chosen to remove Tornado\        entirely.  Are you sure?"        set messageboxtype -exclamationicon    } elseif {$uninst(mode) == "part"} {        set finalwarning "You have chosen to remove your\        previously installed session.  Are you sure?"           set messageboxtype -questionicon    }        if {!$uninst(useInputScript)} {        switch [messageBox -yesno $messageboxtype  $finalwarning] {            yes {# do nothing}            no {return}        }    }    controlEnable uninstDlg.okButt 0    controlEnable uninstDlg.cancelButt 0    controlEnable uninstDlg.uninstAll 0    controlEnable uninstDlg.uninstPart 0    controlDestroy uninstDlg.message    controlDestroy uninstDlg.warningMessage    controlDestroy uninstDlg.exitMessage    controlCreate uninstDlg { label -name progressTag  \                       -xpos 117 -ypos 151 -width 197 -height 8  \                  }    controlCreate uninstDlg { progressmeter -center -name progress \                       -xpos 117 -ypos 164 -width 199 -height 13 \                  }    controlPropertySet uninstDlg.progress \                       -background Blue -foreground Black    if {"$uninst(mode)" == "all" && ![isUnix]} {        unregTornado     }    uninstInfoGet    uninstResource    uninstFile    if {"$uninst(mode)" == "part"} {        uninstBackup    }    set setupLog ""    if {"$uninst(mode)" == "all"} {        catch {file delete -force $uninst(WIND_BASE)/docs}        catch {file delete -force $uninst(WIND_BASE)/.wind/uninst}        catch {file delete -force $uninst(WIND_BASE)/.wind/license}        catch {file delete -force $uninst(WIND_BASE)/SETUP}        catch {file delete $uninst(WIND_BASE)/.wind}        catch {file delete $uninst(WIND_BASE)/setup.log}        if {[catch {file delete $uninst(WIND_BASE)} error]} {   	    incr uninst(errorCount)	}    } else {	if [catch {            set setupLog [open $uninst(WIND_BASE)/setup.log "a+"]            foreach line [split $uninst(info) "\n"] {                if {"$line" != ""} {                    puts $setupLog "[getDate]\tUninst\t$line"                }            }            file delete $uninst(zipFile)	    } error] {                puts $error        }     }    controlDestroy uninstDlg.progress    controlDestroy uninstDlg.progressTag    if {$uninst(errorCount) > 0} {        set msg "Warning: Not all files/directories are removed.  You may\                 need to remove them manually.  Press the OK button to exit."       if {"$setupLog" != ""} {            puts $setupLog "\tUninstall did not complete successfully."       }    } else {       set msg "Uninstall completed successfully.\                Press the OK button to exit."    }    if {"$setupLog" != ""} {       puts $setupLog ""       close $setupLog    }    controlCreate uninstDlg { label -name message  \                   -xpos 117 -ypos 153 -width 199 -height 25 }    controlDestroy uninstDlg.okButt    controlValuesSet uninstDlg.message "$msg"    controlValuesSet uninstDlg.cancelButt "OK"    controlEnable uninstDlg.cancelButt 1}################################################################################ setupFolderDelete - removes the program group folder## SYNOPSIS# setupFolderDelete## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc setupFolderDelete {folderName mode {force 1}} {    global uninst    set programPath [programPathGet $mode]    if {$folderName == ""} {        print "folder name $folderName is NULL"        return    }    if {$force} {       if {[catch {file delete -force "$programPath\\$folderName"} err]} {           print "cannot delete folder, $folderName: $err"	   if {$uninst(useInputScript)} {	       autoUninstLog "cannot delete folder, $folderName: $err"	   }       } else {           print "deleted folder: $folderName"	   if {$uninst(useInputScript)} {	       autoUninstLog "deleted folder: $folderName"	   }       }    } else {       if {[catch {file delete "$programPath\\$folderName"} err]} {           print "cannot delete folder, $folderName: $err"	   if {$uninst(useInputScript)} { 	       autoUninstLog "cannot delete folder, $folderName: $err"	   }       } else {           print "deleted folder: $folderName"	   if {$uninst(useInputScript)} { 	       autoUninstLog "deleted folder: $folderName"	   }       }    }}    ################################################################################ setupLinkDelete - deletes the icons within a folder### SYNOPSIS# setupLinkDelete## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc setupLinkDelete {folderName linkName mode} {    set programPath [programPathGet $mode]    if { "$folderName" == "" } {        puts "Error: folder name is null"        return    }     if { "$linkName" == "" } {        puts "Error: link name is null"        return    }    if {[catch {file delete "$programPath\\$folderName\\$linkName"} err]} {        print "cannot delete icon, $linkName: $err"	if {$uninst(useInputScript)} { 	   autoUninstLog "cannot delete icon, $linkName: $err"	}    } else {        print "deleted icon: $linkName"	if {$uninst(useInputScript)} { 	   autoUninstLog "deleted icon: $linkName"	}    }}################################################################################ uninstResource - uninstalls the resources## This procedure uninstalls the list of resources contained in the tcl variable# uninst(resList).  This list is gathered in the proc uninstInfoGetHelper.## SYNOPSIS# uninstResource## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc uninstResource {} {    global uninst    set folderList {}    set visitedList {}    foreach line $uninst(resList) {       incr uninst(currItem)       set percent [expr ($uninst(currItem) * 99) / $uninst(totalItem)]       uninstMeterUpdate $percent "Removing" "[lindex $line 0]..."       if {[lsearch $visitedList $line] == "-1"} {           lappend visitedList $line           switch [lindex $line 0] {               icon {                   if {![isUnix]} {                       set folderName [lindex $line 1]                       set iconName [lindex $line 2]                       set common [lindex $line 3]                           setupLinkDelete $folderName $iconName $common                   }               }                   folder {                   if {![isUnix]} {                       # Need to remove all the icons first                           lappend folderList $line                   }               }                   regkey {                   if {![isUnix]} {                       set rootKey [lindex $line 1]                       set key [lindex $line 2]                           if {[catch {sysRegistryKeyDelete $rootKey $key} err]} {                           print "cannot delete registry key, $key: $err"			   if {$uninst(useInputScript)} { 	   		       autoUninstLog "deleted icon: $linkName"			   }                       } else {                           print "deleted registry key: $key"			   if {$uninst(useInputScript)} { 	   		       autoUninstLog "deleted registry key: $key"			   }                       }                   }               }                        regValue {                   if {![isUnix]} {                       set rootKey [lindex $line 1]                       set subKey [lindex $line 2]                       set value [lindex $line 3]    

⌨️ 快捷键说明

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