2012-04-17 14:11:53 +00:00
|
|
|
# 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
|
|
|
|
|
|
|
|
SetDatablockOptimize on
|
|
|
|
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
|
2014-04-17 20:43:03 +00:00
|
|
|
# The "installer" that is generated by this file is a stub that generates the
|
|
|
|
# uninstaller at runtime in a temp directory and launches it.
|
|
|
|
# We call `WriteUninstaller` during `onInit` so this section is empty.
|
2012-04-17 14:11:53 +00:00
|
|
|
Section ""
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# This is where uninstallation happens
|
|
|
|
################################################################################
|
2014-04-17 20:43:03 +00:00
|
|
|
Function un.webappUninstall
|
2012-04-17 14:11:53 +00:00
|
|
|
; 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}
|
|
|
|
|
2014-04-17 20:43:03 +00:00
|
|
|
; Remove the uninstall directory that we control.
|
|
|
|
; The installer is in the uninstall directory, it generates
|
|
|
|
; the uninstaller in a temp directory and waits for its
|
|
|
|
; execution. Thus, we can't remove the uninstall directory
|
|
|
|
; now and need to wait for a restart.
|
|
|
|
; See bug 994965.
|
|
|
|
RmDir /r /REBOOTOK "$INSTDIR\uninstall"
|
2012-04-17 14:11:53 +00:00
|
|
|
|
|
|
|
; Remove the installation directory if it is empty
|
|
|
|
${RemoveDir} "$INSTDIR"
|
|
|
|
|
|
|
|
; Refresh shell icons to reflect the changes we've made
|
|
|
|
${un.RefreshShellIcons}
|
2014-04-17 20:43:03 +00:00
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function un.blankPage
|
|
|
|
MessageBox MB_OKCANCEL "$(UN_CONFIRM_UNINSTALL)" /SD IDOK IDCANCEL done
|
|
|
|
|
|
|
|
Call un.webappUninstall
|
2012-04-17 14:11:53 +00:00
|
|
|
|
|
|
|
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
|
2012-10-26 02:07:04 +00:00
|
|
|
; Remove the current exe directory from the search order.
|
|
|
|
; This only effects LoadLibrary calls and not implicitly loaded DLLs.
|
|
|
|
System::Call 'kernel32::SetDllDirectoryW(w "")'
|
|
|
|
|
2012-04-17 14:11:53 +00:00
|
|
|
GetTempFileName $0
|
|
|
|
Delete "$0"
|
|
|
|
CreateDirectory "$0"
|
|
|
|
SetOutPath "$0"
|
|
|
|
|
|
|
|
StrCpy $1 "$0\${UninstallerFilename}"
|
|
|
|
WriteUninstaller "$1"
|
|
|
|
|
|
|
|
${GetParameters} $2
|
2014-04-17 20:43:03 +00:00
|
|
|
StrCpy $2 "$2 _?=$EXEDIR"
|
|
|
|
ExecWait '"$1" $2'
|
2012-04-17 14:11:53 +00:00
|
|
|
Quit
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function un.onInit
|
2012-10-26 02:07:04 +00:00
|
|
|
; Remove the current exe directory from the search order.
|
|
|
|
; This only effects LoadLibrary calls and not implicitly loaded DLLs.
|
|
|
|
System::Call 'kernel32::SetDllDirectoryW(w "")'
|
|
|
|
|
2012-04-17 14:11:53 +00:00
|
|
|
StrCpy $LANGUAGE 0
|
|
|
|
|
|
|
|
${un.GetParent} "$INSTDIR" $INSTDIR
|
|
|
|
${un.GetLongPath} "$INSTDIR" $INSTDIR
|
|
|
|
|
2012-04-20 01:47:54 +00:00
|
|
|
ReadINIStr $AppFilename "$INSTDIR\webapp.ini" "Webapp" "Executable"
|
2012-04-17 14:11:53 +00:00
|
|
|
ReadINIStr $AppName "$INSTDIR\webapp.ini" "Webapp" "Name"
|
|
|
|
|
|
|
|
${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}"
|
|
|
|
Abort
|
|
|
|
${EndUnless}
|
|
|
|
|
|
|
|
StrCpy $AppRTTempDir "$TEMP\moz_webapprt"
|
|
|
|
RmDir /r "$AppRTTempDir"
|
2014-04-17 20:43:03 +00:00
|
|
|
|
|
|
|
${If} ${Silent}
|
|
|
|
Call un.webappUninstall
|
|
|
|
${EndIf}
|
2012-04-17 14:11:53 +00:00
|
|
|
FunctionEnd
|