Bug 886842 - Add clang trunk builds for ASan. r=froydnj
[gecko.git] / webapprt / win / webapp-uninstaller.nsi.in
blob93c4d3900a74d01db0054b3a42ed14e10e030888
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 # You can obtain one at http://mozilla.org/MPL/2.0/.
5 # Required Plugins:
6 # ShellLink http://nsis.sourceforge.net/ShellLink_plug-in
8 ; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs
9 !verbose 3
11 ; 7-Zip provides better compression than the lzma from NSIS so we add the files
12 ; uncompressed and let the application installer compress it.
13 SetDatablockOptimize on
14 SetCompress off
15 CRCCheck on
16 SilentInstall silent
18 RequestExecutionLevel user
20 !addplugindir ./
22 ; prevents compiling of the reg write logging.
23 !define NO_LOG
25 ; Variables
26 Var AppFilename
27 Var AppName
28 Var AppRTTempDir
30 ; Variables/macros used by common.nsh
31 Var TmpVal
32 !define FileMainEXE "$AppFilename.exe"
34 ; Other included files may depend upon these includes!
35 ; The following includes are provided by NSIS.
36 !include "FileFunc.nsh"
37 !insertmacro GetParameters
38 !insertmacro un.RefreshShellIcons
39 !include "LogicLib.nsh"
40 !include "WinMessages.nsh"
41 !include "WinVer.nsh"
42 !include "WordFunc.nsh"
44 ; File properties, version strings, etc
45 !define CompanyName "Mozilla Corporation"
46 !define UninstallerName "Mozilla Webapp Runtime App Uninstaller"
47 !define UninstallerFilename "webapp-uninstaller.exe"
48 !define AppVersion "@APP_VERSION@"
49 VIProductVersion "1.0.0.0"
50 VIAddVersionKey "ProductName" "${UninstallerName}"
51 VIAddVersionKey "CompanyName" "${CompanyName}"
52 VIAddVersionKey "LegalCopyright" "${CompanyName}"
53 VIAddVersionKey "FileVersion" "${AppVersion}"
54 VIAddVersionKey "ProductVersion" "${AppVersion}"
55 VIAddVersionKey "FileDescription" "${UninstallerName}"
56 VIAddVersionKey "OriginalFilename" "${UninstallerFilename}"
58 ; Mozilla custom include
59 !include "common.nsh"
60 !insertmacro un.DeleteShortcuts
61 !insertmacro un.RegCleanUninstall
62 !insertmacro un.ParseUninstallLog
64 Name "Mozilla Web App Runtime App"
65 OutFile "${UninstallerFilename}"
66 ShowUnInstDetails nevershow
68 # Create a blank page so that the default pages (instfiles) don't appear
69 UninstPage custom un.blankPage
71 ################################################################################
72 # Install Sections
73 # The "installer" that is generated by this file will be run during the build
74 # process to generate an uninstaller. We call `WriteUninstaller` during
75 # `onInit` so this section is empty.
76 Section ""
77 SectionEnd
79 ################################################################################
80 # This is where uninstallation happens
81 ################################################################################
82 Function un.blankPage
83 MessageBox MB_OKCANCEL "$(UN_CONFIRM_UNINSTALL)" /SD IDOK IDCANCEL done
85 ; Delete the app exe to prevent launching the app while we are uninstalling.
86 ClearErrors
87 ${DeleteFile} "$INSTDIR\${FileMainEXE}"
88 ${If} ${Errors}
89 ; If the app is running, rename the EXE out of the way
90 CreateDirectory "$AppRTTempDir"
91 Rename "$INSTDIR\${FileMainEXE}" "$AppRTTempDir\${FileMainEXE}"
92 ClearErrors
93 ${EndIf}
96 SetShellVarContext current ; Set SHCTX to HKCU
98 ; Remove our entry in the "Uninstall" key
99 ${un.RegCleanUninstall}
101 ; Remove our shortcuts from start menu, desktop, and taskbar
102 ${un.DeleteShortcuts}
104 ; Parse the uninstall log to remove all installed
105 ; files / directories this install is responsible for.
106 ${un.ParseUninstallLog}
108 ; Remove the uninstall directory that we control
109 RmDir /r "$INSTDIR\uninstall"
111 ; Remove the installation directory if it is empty
112 ${RemoveDir} "$INSTDIR"
114 ; Refresh shell icons to reflect the changes we've made
115 ${un.RefreshShellIcons}
117 done:
118 FunctionEnd
120 ################################################################################
121 # Language
123 !verbose push
124 !verbose 3
125 !include "webapp-uninstaller-locale.nsh"
126 !verbose pop
128 ; Set this after the locale files to override it if it is in the locale. Using
129 ; " " for BrandingText will hide the "Nullsoft Install System..." branding.
130 BrandingText " "
132 # Initialization Functions
133 Function .onInit
134 ; Remove the current exe directory from the search order.
135 ; This only effects LoadLibrary calls and not implicitly loaded DLLs.
136 System::Call 'kernel32::SetDllDirectoryW(w "")'
138 GetTempFileName $0
139 Delete "$0"
140 CreateDirectory "$0"
141 SetOutPath "$0"
143 StrCpy $1 "$0\${UninstallerFilename}"
144 WriteUninstaller "$1"
146 ${GetParameters} $2
147 StrCpy $2 "_?=$EXEDIR $2"
148 Exec '"$1" $2'
149 Quit
150 FunctionEnd
152 Function un.onInit
153 ; Remove the current exe directory from the search order.
154 ; This only effects LoadLibrary calls and not implicitly loaded DLLs.
155 System::Call 'kernel32::SetDllDirectoryW(w "")'
157 StrCpy $LANGUAGE 0
159 ${un.GetParent} "$INSTDIR" $INSTDIR
160 ${un.GetLongPath} "$INSTDIR" $INSTDIR
162 ReadINIStr $AppFilename "$INSTDIR\webapp.ini" "Webapp" "Executable"
163 ReadINIStr $AppName "$INSTDIR\webapp.ini" "Webapp" "Name"
165 ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}"
166 Abort
167 ${EndUnless}
169 StrCpy $AppRTTempDir "$TEMP\moz_webapprt"
170 RmDir /r "$AppRTTempDir"
171 FunctionEnd