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/.
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
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
18 RequestExecutionLevel user
22 ; prevents compiling of the reg write logging.
30 ; Variables/macros used by common.nsh
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"
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
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 ################################################################################
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.
79 ################################################################################
80 # This is where uninstallation happens
81 ################################################################################
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.
87 ${DeleteFile} "$INSTDIR\${FileMainEXE}"
89 ; If the app is running, rename the EXE out of the way
90 CreateDirectory "$AppRTTempDir"
91 Rename "$INSTDIR\${FileMainEXE}" "$AppRTTempDir\${FileMainEXE}"
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
}
120 ################################################################################
125 !include "webapp-uninstaller-locale.nsh"
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.
132 # Initialization Functions
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 "")'
143 StrCpy $1 "$0\${UninstallerFilename}"
144 WriteUninstaller "$1"
147 StrCpy $2 "_?=$EXEDIR $2"
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 "")'
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}"
169 StrCpy $AppRTTempDir "$TEMP\moz_webapprt"
170 RmDir
/r
"$AppRTTempDir"