📄 uninst.tcl
字号:
controlDestroy uninstDlg.helpButt 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} { global uninst set programPath [programPathGet $mode] if { "$folderName" == "" } { print "Error: folder name is null" return } if { "$linkName" == "" } { print "Error: link name is null" return } if {[regexp {.* Uninstall} $linkName match]} { if {"$uninst(mode)" == "part"} { print "Not deleting $linkName, not the last layer" return } } if {[catch {file delete "$programPath\\$folderName\\$linkName.lnk"} err]} { print "cannot delete icon, $linkName: $err" if {$uninst(useInputScript)} { autoUninstLog "cannot delete icon, $linkName: $err" } } else { print "deleted icon: $folderName\\$linkName" if {$uninst(useInputScript)} { autoUninstLog "deleted icon: $linkName" } }}################################################################################ uninstService - uninstalls the Tornado Registry Service## This procedure uninstalls the Tornado Registry Service if there is one # running## SYNOPSIS# uninstService## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc uninstService {} { global uninst set visitedList {} foreach line $uninst(resList) { if {[lsearch $visitedList $line] == "-1"} { lappend visitedList $line switch [lindex $line 0] { service { if {![isUnix]} { uninstMeterUpdate 0 "Removing" "[lindex $line 0]..." set serviceName [lindex $line 1] if {[catch {setupServiceStop $serviceName} err]} { print "cannot stop service, $serviceName: $err" if {$uninst(useInputScript)} { autoUninstLog "cannot stop service, $serviceName: $err" } } else { print "stopped service: $serviceName" if {$uninst(useInputScript)} { autoUninstLog "stopped service: $serviceName" } } if {[catch {setupServiceRemove $serviceName} err]} { print "cannot delete service: $serviceName: $err" if {$uninst(useInputScript)} { autoUninstLog "cannot delete service: $serviceName: $err" } } else { print "deleted service: $serviceName" if {$uninst(useInputScript)} { autoUninstLog "deleted service: $serviceName" } } } } } } }}################################################################################ 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 {} set iconList {} 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] lappend iconList $iconName if {$uninst(errorCount) == 0} { if {"$uninst(mode)" == "all"} { print "removed: $folderName $iconName" setupLinkDelete $folderName $iconName $common } else { if {![string match {[getProdInfo name] Uninstall} \ $iconName]} { print "removed: $folderName $iconName" setupLinkDelete $folderName $iconName \ $common } } } else { if {![string match {[getProdInfo name] Uninstall} $iconName]} { print "removed: $folderName $iconName $common" 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] if {[catch {sysRegistryValueDelete \ $rootKey $subKey $value} err]} { print "cannot delete registry value, $value: $err" if {$uninst(useInputScript)} { autoUninstLog "cannot delete registry value, $value: $err" } } else { print "deleted registry value: $value" if {$uninst(useInputScript)} { autoUninstLog "deleted registry value: $value" } } } } default {} } } } if {![isUnix]} { foreach folder $folderList { set folderName [lindex $folder 1] set common [lindex $folder 2] if {$uninst(errorCount) == 0} { if {"$uninst(mode)" != "part"} { print "remove folder: $folderName" setupFolderDelete $folderName $common } } else { # This is a workaround. After the links are deleted in # the tornado program group, some how the start menu still # shows the deleted links. This is probably a bug in NT. # The following will rename the tornado program group. Only # uninstall icon should be shown after the rename set programPath [programPathGet $common] file rename "$programPath\\$folderName" \ "$programPath\\$folderName.bak" file rename "$programPath\\$folderName.bak" \ "$programPath\\$folderName" } } }}################################################################################ uninstUITclDialogInit - initialization procedure for the uninstall dialog.## This procedure sets the dialog's check boxes based on the contents of the# uninst(mode) array variable. This procedure is a no-op if automation is# turned on.## SYNOPSIS### PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc uninstUITclDialogInit {} { global uninst global argv global env applicationTitleSet "[getProdInfo name] Uninstall" if {$uninst(useInputScript)} { return } if {$uninst(mode) == "none"} { messageBox -stop "Cannot find the uninstall information." windowClose uninstDlg } elseif {$uninst(mode) == "all"} { controlCheckSet uninstDlg.uninstAll 1 controlEnable uninstDlg.uninstPart 0 onUninstallAll } else { controlCheckSet uninstDlg.uninstAll 1 onUninstallAll } # disable this button for Unix, doesn't exist controlCheckSet uninstDlg.uninstRegSvc 1 if {[isUnix]} { controlEnable uninstDlg.uninstRegSvc 0 controlHide uninstDlg.uninstRegSvc 1 }}################################################################################ dosTempDirGet - returns a unique temporary directory name.### This procedure determine a temporary directory name based on the process# id.## SYNOPSIS### PARAMETERS: N/A## RETURNS: a unique string name for a temporary directory path.## ERRORS: N/A#proc dosTempDirGet {} { global env # Determine the "temp" directory set uninstTemp "_TMP[pid]" foreach elem [array names env] { if {[string compare [string tolower $elem] "tmp"] == 0} { set env(TMP) $env($elem) } if {[string compare [string tolower $elem] "temp"] == 0} { set env(TEMP) $env($elem) } if {[string compare [string tolower $elem] "tmpdir"] == 0} { set env(TMPDIR) $env($elem) } } if {[info exists env(TEMP)] && [file isdir $env(TEMP)]} { set TMP $env(TEMP)\\$uninstTemp } elseif {[info exists env(TMP)] && [file isdir $env(TMP)]} { set TMP $env(TMP)\\$uninstTemp } elseif {[info exists env(TMPDIR)] && [file isdir $env(TMPDIR)]} { set TMP $env(TMPDIR)\\$uninstTemp } else { set TMP "C:\\$uninstTemp" } return $TMP}################################################################################ seedUninstall - make a list of required files to delete.### This procedure, invoked for Windows based machines, makes a list of required# files that are used by the Uninstaller. It also creates a batch file# that is invoked to create a temporary directory where the uninstall program# is actually executed so that the directory where uninstall resides itself# can be deleted as well.## SYNOPSIS# seedUninstall## PARAMETERS: N/A## RETURNS: N/A## ERRORS: N/A#proc seedUninstall {} { global env argv0 uninst set env(TMP) [unixToDos [dosTempDirGet]] set uninstDir [unixToDos "$uninst(WIND_BASE)\\.wind\\uninst"] set binDir [unixToDos "$uninst(WIND_BASE)\\SETUP\\X86\\WIN32"]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -