# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. # Required Plugins: # ShellLink http://nsis.sourceforge.net/ShellLink_plug-in ; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs !verbose 3 ; 7-Zip provides better compression than the lzma from NSIS so we add the files ; uncompressed and let the application installer compress it. SetDatablockOptimize on SetCompress off CRCCheck on SilentInstall silent RequestExecutionLevel user !addplugindir ./ ; prevents compiling of the reg write logging. !define NO_LOG ; Variables Var AppFilename Var AppName Var AppRTTempDir ; Variables/macros used by common.nsh Var TmpVal !define FileMainEXE "$AppFilename.exe" ; Other included files may depend upon these includes! ; The following includes are provided by NSIS. !include "FileFunc.nsh" !insertmacro GetParameters !insertmacro un.RefreshShellIcons !include "LogicLib.nsh" !include "WinMessages.nsh" !include "WinVer.nsh" !include "WordFunc.nsh" ; File properties, version strings, etc !define CompanyName "Mozilla Corporation" !define UninstallerName "Mozilla Webapp Runtime App Uninstaller" !define UninstallerFilename "webapp-uninstaller.exe" !define AppVersion "@APP_VERSION@" VIProductVersion "1.0.0.0" VIAddVersionKey "ProductName" "${UninstallerName}" VIAddVersionKey "CompanyName" "${CompanyName}" VIAddVersionKey "LegalCopyright" "${CompanyName}" VIAddVersionKey "FileVersion" "${AppVersion}" VIAddVersionKey "ProductVersion" "${AppVersion}" VIAddVersionKey "FileDescription" "${UninstallerName}" VIAddVersionKey "OriginalFilename" "${UninstallerFilename}" ; Mozilla custom include !include "common.nsh" !insertmacro un.DeleteShortcuts !insertmacro un.RegCleanUninstall !insertmacro un.ParseUninstallLog Name "Mozilla Web App Runtime App" OutFile "${UninstallerFilename}" ShowUnInstDetails nevershow # Create a blank page so that the default pages (instfiles) don't appear UninstPage custom un.blankPage ################################################################################ # Install Sections # The "installer" that is generated by this file will be run during the build # process to generate an uninstaller. We call `WriteUninstaller` during # `onInit` so this section is empty. Section "" SectionEnd ################################################################################ # This is where uninstallation happens ################################################################################ Function un.blankPage MessageBox MB_OKCANCEL "$(UN_CONFIRM_UNINSTALL)" /SD IDOK IDCANCEL done ; Delete the app exe to prevent launching the app while we are uninstalling. ClearErrors ${DeleteFile} "$INSTDIR\${FileMainEXE}" ${If} ${Errors} ; If the app is running, rename the EXE out of the way CreateDirectory "$AppRTTempDir" Rename "$INSTDIR\${FileMainEXE}" "$AppRTTempDir\${FileMainEXE}" ClearErrors ${EndIf} SetShellVarContext current ; Set SHCTX to HKCU ; Remove our entry in the "Uninstall" key ${un.RegCleanUninstall} ; Remove our shortcuts from start menu, desktop, and taskbar ${un.DeleteShortcuts} ; Parse the uninstall log to remove all installed ; files / directories this install is responsible for. ${un.ParseUninstallLog} ; Remove the uninstall directory that we control RmDir /r "$INSTDIR\uninstall" ; Remove the installation directory if it is empty ${RemoveDir} "$INSTDIR" ; Refresh shell icons to reflect the changes we've made ${un.RefreshShellIcons} done: FunctionEnd ################################################################################ # Language !verbose push !verbose 3 !include "webapp-uninstaller-locale.nsh" !verbose pop ; Set this after the locale files to override it if it is in the locale. Using ; " " for BrandingText will hide the "Nullsoft Install System..." branding. BrandingText " " # Initialization Functions Function .onInit GetTempFileName $0 Delete "$0" CreateDirectory "$0" SetOutPath "$0" StrCpy $1 "$0\${UninstallerFilename}" WriteUninstaller "$1" ${GetParameters} $2 StrCpy $2 "_?=$EXEDIR $2" Exec '"$1" $2' Quit FunctionEnd Function un.onInit StrCpy $LANGUAGE 0 ${un.GetParent} "$INSTDIR" $INSTDIR ${un.GetLongPath} "$INSTDIR" $INSTDIR ReadINIStr $AppFilename "$INSTDIR\webapp.ini" "WebappRT" "Executable" ReadINIStr $AppName "$INSTDIR\webapp.ini" "Webapp" "Name" ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}" Abort ${EndUnless} StrCpy $AppRTTempDir "$TEMP\moz_webapprt" RmDir /r "$AppRTTempDir" FunctionEnd