📄 uninst.tcl
字号:
# UNINST.TCL - Uninstallation program for Unix/Windows platforms.## modification history# --------------------# 04i,15may03,bjl added more instructions to exit tornado apps (spr 87392).# 04h,03oct02,bjl fixed text to use core product name rather than cdromDesc# (spr 77983).# 04g,25jul02,wmd Fix problem with uninstall icon being deleted before the# last layer of installed products.# 04f,24jul02,wmd Fix so unregister button is checked by default, and tcl# error upon exit.# 04e,23jul02,wmd Fix SPR 79921 - do not delete program group if not last# layer.# 04d,11jul02,wmd Add a checkbox for uninstalling the registry.# 04c,03may02,bwd SPR 76643: added backward compatibility support for patches# made pre-veloce setupSDK# 04b,05mar02,bwd Modified SETUP to be non-tornado centric# 04a,12jun01,j_w Modified for Tornado 2.2# 03o,13mar01,j_w update version 3.0 to 3.1# 03n,13nov00,j_w remove <install_dir>/host for full uninstallation# 03m,02nov00,j_w Name change - Tornado AE# 03l,30oct00,j_w catch errors when restoring setup files# 03k,09oct00,j_w Removed Tornado Registry Service before removing any# related files (SPR 35049)# 03j,25sep00,j_w Do not remove the Uninstall icon for partial uninstall# 03i,19sep00,j_w Restored uninstall start files if user aborted during # uninstallation (spr 34381)# 03h,07sep00,j_w removed setup.log.abort# 03g,31aug00,j_w Remove the .wind/tornado3.0 directory in HOMEDRIVE # if performing full uninstallation# 03f,30aug00,j_w Fixed SPR 33909# 03e,28aug00,j_w Added instructions for removing Tornado Registry.# 03d,19may00,j_w Fixed delete icon problem in setupLinkDelete{}# 03c,11may00,j_w Removed unregTornado{}# 03b,17apr00,j_w Removed ComTcl.dll and WrsDebugger.dll unregistration# 03a,18oct99,bjl renamed uitclcontrols to libuitclcontrols for Unix,# do not cd to root dir at end of uninstall for Unix.# 02z,14oct99,j_w Update dll loaded in seedUninstall and remove readonly# attribute for uninstall files in the tmp directory# 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 "[getProdInfo name] 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 boolean \ -title "Unregister Tornado Registry Service on this machine" \ -name uninstRegSvc -auto \ -xpos 117 -ypos 60 -width 180 -height 10 \ -callback {onUninstRegSvc callback}] \ [list label -title "" -name installInfo \ -xpos 130 -ypos 74 -width 186 -height 39] \ [list label -name warningMessage \ -xpos 117 -ypos 104 -width 199 -height 9] \ [list label -name message \ -xpos 117 -ypos 113 -width 199 -height 37] \ [list label -name exitMessage \ -xpos 117 -ypos 150 -width 199 -height 38] \ [list frame -gray -name separator \ -xpos 7 -ypos 188 -width 309 -height 1] \ [list button -title "Help" -name helpButt \ -xpos 10 -ypos 197 -width 50 -height 14 \ -callback onUITclDialogDetails] \ [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}]] set uninst(regSvc) 1 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 }}proc onUITclDialogDetails {} { set prod [getProdInfo name] set msg "Instructions to stop the $prod Registry: \n\n" append msg "If started as a Service, go to the\ Control Panel-->Services, select $prod Registry\ and hit Stop.\n\n" append msg "If started manually or on startup, open\ $prod Registry from the Taskbar and hit the\ \"Kill Registry\" button." messageBox $msg #dialog ok_with_title "[getProdInfo name] Uninstall" $msg "" ""}################################################################################ 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 set setupLog "" if {$uninst(mode) == "all"} { set finalwarning "WARNING: You have chosen to remove [getProdInfo name]\ entirely. Are you sure?" set messageboxtype -exclamationicon } elseif {$uninst(mode) == "part"} { set finalwarning \ "You have chosen to remove your previously installed session.\n\ \nPlease ensure that no Tornado processes are still running\ before proceeding. These include tornado, wtxregd, tgtsvr,\ gdb, etc. Refer to your documentation for instructions on\ how to do this correctly, or use the task manager (Windows).\n\ \nAre you sure you are ready to proceed?" set messageboxtype -questionicon } if {!$uninst(useInputScript)} { switch [messageBox -yesno $messageboxtype $finalwarning] { no {return} } } controlEnable uninstDlg.helpButt 0 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 # unregister tornado dlls if {"$uninst(mode)" == "all" && ![isUnix]} { unregTornado } uninstInfoGet # remove the service first if {$uninst(regSvc)} { uninstService } uninstFile print "uninst(errorCount): $uninst(errorCount)" uninstResource # restore uninstall files for future uninstall if error occurred if {$uninst(errorCount) > 0} { set fileList [glob -nocomplain $env(TMP)/*] foreach file $fileList { print "@@@@ restore uninstall file: $file" if [catch {file copy -force $file \ $uninst(WIND_BASE)\\SETUP\\X86\\WIN32} err] { print "@@@@ file copy failed: $file" } #file attributes $env(TMP)\\$file -readonly 0 } } if {$uninst(errorCount) == 0} { if {"$uninst(mode)" == "part"} { uninstBackup } if {[isUnix]} { set homeDir $env(HOME) } else { set homeDir $env(HOMEDRIVE) } 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 -force $uninst(WIND_BASE)/.wind} catch {file delete -force $uninst(WIND_BASE)/host} catch {file delete -force $uninst(WIND_BASE)/setup.log} catch {file delete -force $uninst(WIND_BASE)/setup.log.abort} 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} { if {"$uninst(mode)" == "part"} { set YPOS 114 set HEIGHT 75 set msg \ "Warning: Not all files/directories were able to be removed.\ You may need to remove them manually.\n\nIf the files that\ could not be removed were Tornado-related executables (tornado,\ wtxregd, tgtsvr, various .dll's, etc) you must kill all Tornado-related\ executables and re-run this uninstall in order to restore your install\ tree to a functioning state." } else { set YPOS 153 set HEIGHT 25 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 YPOS 153 set HEIGHT 25 set msg "Uninstall completed successfully.\ Press the OK button to exit." } if {"$setupLog" != ""} { puts $setupLog "" close $setupLog } controlCreate uninstDlg [list label -name message \ -xpos 117 -ypos $YPOS -width 199 -height $HEIGHT ]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -