aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/nsis/uninstall.nsi
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2012-06-13 19:06:27 +0000
committerGerald Combs <gerald@wireshark.org>2012-06-13 19:06:27 +0000
commita9cb4061d456a0cd5d980d35110e4ae67a0c9973 (patch)
tree9db98cf0ba176dfbdfdc51e6bfa9fc9ff8e0569b /packaging/nsis/uninstall.nsi
parent75972ddcd90e3aea7b9eb036a8f969d9684b523b (diff)
Move the "uninstall" parts of wireshark.nsi to uninstall.nsi and the
common parts to common.nsh. Creating an installer now requires two NSIS runs: - uninstaller.nsi, which creates an installer (uninstall_installer.exe) that only writes uninstall.exe to ../../wireshark-gtk2. - wireshark.nsi, which bundles uninstall.exe along with the rest of our installation files. If we ever get around to signing our executables this will let us sign all of them. It also cleans up the .nsi file contents a bit. Instead of keeping separate list of file extensions, manage them from a single macro. Print the extensions we register / deregister in the detail pane. svn path=/trunk/; revision=43236
Diffstat (limited to 'packaging/nsis/uninstall.nsi')
-rwxr-xr-xpackaging/nsis/uninstall.nsi266
1 files changed, 266 insertions, 0 deletions
diff --git a/packaging/nsis/uninstall.nsi b/packaging/nsis/uninstall.nsi
new file mode 100755
index 0000000000..4d663295c1
--- /dev/null
+++ b/packaging/nsis/uninstall.nsi
@@ -0,0 +1,266 @@
+;
+; uninstall.nsi
+;
+; $Id$
+
+; Create an installer that only writes an uninstaller.
+; http://nsis.sourceforge.net/Signing_an_Uninstaller
+
+SetCompress off
+OutFile "..\..\wireshark-gtk2\uninstall_installer.exe"
+RequestExecutionLevel user
+
+InstType "un.Default (keep Personal Settings and WinPcap)"
+InstType "un.All (remove all)"
+
+!include "common.nsh"
+!include 'LogicLib.nsh'
+
+; Uninstaller icon
+UninstallIcon "..\..\image\wiresharkinst.ico"
+
+!include "MUI.nsh"
+
+!insertmacro MUI_UNPAGE_WELCOME
+!insertmacro MUI_UNPAGE_CONFIRM
+!insertmacro MUI_UNPAGE_COMPONENTS
+!insertmacro MUI_UNPAGE_INSTFILES
+!insertmacro MUI_UNPAGE_FINISH
+
+!insertmacro MUI_LANGUAGE "English"
+
+; ============================================================================
+; Section macros
+; ============================================================================
+!include "Sections.nsh"
+
+; ============================================================================
+; Uninstall page configuration
+; ============================================================================
+ShowUninstDetails show
+
+; ============================================================================
+; Functions and macros
+; ============================================================================
+
+Function .onInit
+ WriteUninstaller "${MAKEDIR}\..\..\wireshark-gtk2\uninstall.exe"
+ SetErrorLevel 0
+ Quit
+FunctionEnd
+
+Var EXTENSION
+Function un.Disassociate
+ Push $R0
+!insertmacro PushFileExtensions
+
+ Pop $EXTENSION
+ ${DoUntil} $EXTENSION == ${FILE_EXTENSION_MARKER}
+ ReadRegStr $R0 HKCR $EXTENSION ""
+ StrCmp $R0 ${WIRESHARK_ASSOC} un.Disassociate.doDeregister
+ Goto un.Disassociate.end
+un.Disassociate.doDeregister:
+ ; The extension is associated with Wireshark so, we must destroy this!
+ DeleteRegKey HKCR $EXTENSION
+ DetailPrint "Deregistered extension $EXTENSION"
+un.Disassociate.end:
+ Pop $EXTENSION
+ ${Loop}
+
+ Pop $R0
+FunctionEnd
+
+Section "-Required"
+SectionEnd
+
+Section "Uninstall" un.SecUinstall
+;-------------------------------------------
+
+;
+; UnInstall for every user
+;
+SectionIn 1 2
+SetShellVarContext all
+
+Delete "$INSTDIR\rawshark.exe"
+IfErrors 0 NoRawsharkErrorMsg
+ MessageBox MB_OK "Please note: rawshark.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if rawshark.exe removed
+ Abort "Please note: rawshark.exe could not be removed, it's probably in use! Abort uninstall process!"
+NoRawsharkErrorMsg:
+
+Delete "$INSTDIR\tshark.exe"
+IfErrors 0 NoTSharkErrorMsg
+ MessageBox MB_OK "Please note: tshark.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if tshark.exe removed
+ Abort "Please note: tshark.exe could not be removed, it's probably in use! Abort uninstall process!"
+NoTSharkErrorMsg:
+
+Delete "$INSTDIR\wireshark.exe"
+IfErrors 0 NoWiresharkErrorMsg
+ MessageBox MB_OK "Please note: wireshark.exe could not be removed, it's probably in use!" IDOK 0 ;skipped if wireshark.exe removed
+ Abort "Please note: wireshark.exe could not be removed, it's probably in use! Abort uninstall process!"
+NoWiresharkErrorMsg:
+
+DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Wireshark"
+DeleteRegKey HKEY_LOCAL_MACHINE "Software\Wireshark"
+DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\App Paths\wireshark.exe"
+
+Call un.Disassociate
+
+DeleteRegKey HKCR ${WIRESHARK_ASSOC}
+DeleteRegKey HKCR "${WIRESHARK_ASSOC}\Shell\open\command"
+DeleteRegKey HKCR "${WIRESHARK_ASSOC}\DefaultIcon"
+!insertmacro UpdateIcons
+
+Delete "$INSTDIR\etc\gtk-2.0\*.*"
+Delete "$INSTDIR\etc\pango\*.*"
+Delete "$INSTDIR\lib\gtk-2.0\2.2.0\engines\*.*"
+Delete "$INSTDIR\lib\gtk-2.0\2.2.0\loaders\*.*"
+Delete "$INSTDIR\lib\gtk-2.0\2.2.0\immodules\*.*"
+Delete "$INSTDIR\lib\gtk-2.0\2.4.0\engines\*.*"
+Delete "$INSTDIR\lib\gtk-2.0\2.4.0\loaders\*.*"
+Delete "$INSTDIR\lib\gtk-2.0\2.4.0\immodules\*.*"
+Delete "$INSTDIR\lib\gtk-2.0\2.10.0\engines\*.*"
+Delete "$INSTDIR\lib\gtk-2.0\2.10.0\loaders\*.*"
+Delete "$INSTDIR\lib\gtk-2.0\2.10.0\immodules\*.*"
+Delete "$INSTDIR\lib\gtk-2.0\modules\*.*"
+Delete "$INSTDIR\lib\pango\1.2.0\modules\*.*"
+Delete "$INSTDIR\lib\pango\1.4.0\modules\*.*"
+Delete "$INSTDIR\lib\pango\1.5.0\modules\*.*"
+Delete "$INSTDIR\share\themes\Default\gtk-2.0\*.*"
+Delete "$INSTDIR\help\*.*"
+Delete "$INSTDIR\diameter\*.*"
+Delete "$INSTDIR\snmp\mibs\*.*"
+Delete "$INSTDIR\snmp\*.*"
+Delete "$INSTDIR\tpncp\*.*"
+Delete "$INSTDIR\ui\*.*"
+Delete "$INSTDIR\wimaxasncp\*.*"
+Delete "$INSTDIR\*.exe"
+Delete "$INSTDIR\*.dll"
+Delete "$INSTDIR\*.html"
+Delete "$INSTDIR\ws.css"
+Delete "$INSTDIR\COPYING*"
+Delete "$INSTDIR\AUTHORS-SHORT"
+; previous versions installed these files
+Delete "$INSTDIR\*.manifest"
+; previous versions installed this file
+Delete "$INSTDIR\AUTHORS-SHORT-FORMAT"
+Delete "$INSTDIR\README*"
+Delete "$INSTDIR\NEWS.txt"
+Delete "$INSTDIR\manuf"
+Delete "$INSTDIR\services"
+Delete "$INSTDIR\pdml2html.xsl"
+Delete "$INSTDIR\pcrepattern.3.txt"
+Delete "$INSTDIR\user-guide.chm"
+Delete "$INSTDIR\example_snmp_users_file"
+Delete "$INSTDIR\ipmap.html"
+Delete "$INSTDIR\radius\*.*"
+Delete "$INSTDIR\dtds\*.*"
+Delete "$SMPROGRAMS\Wireshark\*.*"
+Delete "$SMPROGRAMS\Wireshark.lnk"
+Delete "$DESKTOP\Wireshark.lnk"
+Delete "$QUICKLAUNCH\Wireshark.lnk"
+
+RMDir "$INSTDIR\etc\gtk-2.0"
+RMDir "$INSTDIR\etc\pango"
+RMDir "$INSTDIR\etc"
+RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\engines"
+RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\loaders"
+RMDir "$INSTDIR\lib\gtk-2.0\2.2.0\immodules"
+RMDir "$INSTDIR\lib\gtk-2.0\2.2.0"
+RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\engines"
+RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\loaders"
+RMDir "$INSTDIR\lib\gtk-2.0\2.4.0\immodules"
+RMDir "$INSTDIR\lib\gtk-2.0\2.4.0"
+RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\engines"
+RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\loaders"
+RMDir "$INSTDIR\lib\gtk-2.0\2.10.0\immodules"
+RMDir "$INSTDIR\lib\gtk-2.0\2.10.0"
+RMDir "$INSTDIR\lib\gtk-2.0\modules"
+RMDir "$INSTDIR\lib\gtk-2.0"
+RMDir "$INSTDIR\lib\pango\1.2.0\modules"
+RMDir "$INSTDIR\lib\pango\1.2.0"
+RMDir "$INSTDIR\lib\pango\1.4.0\modules"
+RMDir "$INSTDIR\lib\pango\1.4.0"
+RMDir "$INSTDIR\lib\pango\1.5.0\modules"
+RMDir "$INSTDIR\lib\pango\1.5.0"
+RMDir "$INSTDIR\lib\pango"
+RMDir "$INSTDIR\lib"
+RMDir "$INSTDIR\share\themes\Default\gtk-2.0"
+RMDir "$INSTDIR\share\themes\Default"
+RMDir "$INSTDIR\share\themes"
+RMDir "$INSTDIR\share"
+RMDir "$SMPROGRAMS\Wireshark"
+RMDir "$INSTDIR\help"
+RMDir "$INSTDIR\diameter"
+RMDir "$INSTDIR\snmp\mibs"
+RMDir "$INSTDIR\snmp"
+RMDir "$INSTDIR\radius"
+RMDir "$INSTDIR\dtds"
+RMDir "$INSTDIR\tpncp"
+RMDir "$INSTDIR\ui"
+RMDir "$INSTDIR\wimaxasncp"
+RMDir "$INSTDIR"
+
+SectionEnd ; "Uinstall"
+
+Section "Un.Plugins" un.SecPlugins
+;-------------------------------------------
+SectionIn 1 2
+;Delete "$INSTDIR\plugins\${VERSION}\*.*"
+;Delete "$INSTDIR\plugins\*.*"
+;RMDir "$INSTDIR\plugins\${VERSION}"
+;RMDir "$INSTDIR\plugins"
+RMDir /r "$INSTDIR\plugins"
+SectionEnd
+
+Section "Un.Global Settings" un.SecGlobalSettings
+;-------------------------------------------
+SectionIn 1 2
+Delete "$INSTDIR\cfilters"
+Delete "$INSTDIR\colorfilters"
+Delete "$INSTDIR\dfilters"
+Delete "$INSTDIR\init.lua"
+Delete "$INSTDIR\console.lua"
+Delete "$INSTDIR\dtd_gen.lua"
+Delete "$INSTDIR\smi_modules"
+RMDir "$INSTDIR"
+SectionEnd
+
+Section /o "Un.Personal Settings" un.SecPersonalSettings
+;-------------------------------------------
+SectionIn 2
+SetShellVarContext current
+Delete "$APPDATA\Wireshark\*.*"
+RMDir "$APPDATA\Wireshark"
+SectionEnd
+
+;VAR un.WINPCAP_UNINSTALL
+
+Section /o "Un.WinPcap" un.SecWinPcap
+;-------------------------------------------
+SectionIn 2
+ReadRegStr $1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\WinPcapInst" "UninstallString"
+;IfErrors un.lbl_winpcap_notinstalled ;if RegKey is unavailable, WinPcap is not installed
+;MessageBox MB_OK "WinPcap $1"
+ExecWait '$1' $0
+DetailPrint "WinPcap uninstaller returned $0"
+;SetRebootFlag true
+;un.lbl_winpcap_notinstalled:
+SectionEnd
+
+Section "-Un.Finally"
+;-------------------------------------------
+SectionIn 1 2
+; this test must be done after all other things uninstalled (e.g. Global Settings)
+IfFileExists "$INSTDIR" 0 NoFinalErrorMsg
+ MessageBox MB_OK "Please note: The directory $INSTDIR could not be removed!" IDOK 0 ; skipped if dir doesn't exist
+NoFinalErrorMsg:
+SectionEnd
+
+!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
+ !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUinstall} "Uninstall all Wireshark components."
+ !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPlugins} "Uninstall all Plugins (even from previous Wireshark versions)."
+ !insertmacro MUI_DESCRIPTION_TEXT ${un.SecGlobalSettings} "Uninstall global settings like: $INSTDIR\cfilters"
+ !insertmacro MUI_DESCRIPTION_TEXT ${un.SecPersonalSettings} "Uninstall personal settings like your preferences file from your profile: $PROFILE."
+ !insertmacro MUI_DESCRIPTION_TEXT ${un.SecWinPcap} "Call WinPcap's uninstall program."
+!insertmacro MUI_UNFUNCTION_DESCRIPTION_END