зеркало из https://github.com/mozilla/gecko-dev.git
Bug 349551 - Updated builds won't uninstall via Windows Control Panel. r=bsmedberg
This commit is contained in:
Родитель
c838d76e4d
Коммит
47f8b75946
|
@ -54,12 +54,10 @@ ifdef MOZ_BRANDING_DIRECTORY
|
|||
DEFINES += -DOFFICIAL_BRANDING=1
|
||||
endif
|
||||
|
||||
# Generate uninstall.ini (en-US only for now)
|
||||
UNINSTALLER_INC = $(topsrcdir)/browser/installer/windows/uninstaller.inc
|
||||
$(FINAL_TARGET)/uninstall/uninstall.ini: $(topsrcdir)/browser/installer/windows/uninstall.it $(UNINSTALLER_INC)
|
||||
$(NSINSTALL) -D $(@D)
|
||||
$(PERL) $(topsrcdir)/config/preprocessor.pl $(DEFINES) $(ACDEFINES) -I$(UNINSTALLER_INC) $< > $@
|
||||
libs:: $(FINAL_TARGET)/uninstall/uninstall.ini
|
||||
# For Windows build the uninstaller during the application build since the
|
||||
# uninstaller is included with the application for mar file generation.
|
||||
libs::
|
||||
$(MAKE) -C installer/windows uninstaller
|
||||
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -50,13 +50,12 @@ SFX_MODULE = $(topsrcdir)/other-licenses/7zstub/firefox/7zSD.sfx
|
|||
|
||||
PP_LOCALIZED_FILES = \
|
||||
packages-static \
|
||||
installer.cfg \
|
||||
$(NULL)
|
||||
|
||||
INSTALLER_FILES = \
|
||||
app.tag \
|
||||
nsis/installer.nsi \
|
||||
nsis/SetProgramAccess.nsi \
|
||||
nsis/uninstaller.nsi \
|
||||
$(NULL)
|
||||
|
||||
BRANDING_FILES = \
|
||||
|
@ -81,11 +80,14 @@ installer::
|
|||
$(MAKE) -C .. installer-stage
|
||||
$(MAKE) $(CONFIG_DIR)/setup.exe
|
||||
|
||||
# For building the uninstaller during the application build so it can be
|
||||
# included for mar file generation.
|
||||
uninstaller::
|
||||
|
||||
$(CONFIG_DIR)/setup.exe::
|
||||
$(RM) -rf $(CONFIG_DIR) && mkdir $(CONFIG_DIR)
|
||||
$(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR)
|
||||
$(INSTALL) $(addprefix $(DIST)/branding/,$(BRANDING_FILES)) $(CONFIG_DIR)
|
||||
cp $(topsrcdir)/browser/EULA $(CONFIG_DIR)/license.txt
|
||||
cp $(topsrcdir)/browser/EULA.rtf $(CONFIG_DIR)/license.rtf
|
||||
$(EXIT_ON_ERROR) \
|
||||
for i in $(PP_LOCALIZED_FILES); do \
|
||||
|
|
|
@ -1,126 +0,0 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Mozilla Installer code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Mozilla Foundation
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Robert Strong <robert.bugzilla@gmail.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
; Provides the Set Access portion of the "Set Program Access and Defaults" that
|
||||
; is available with Win2K Pro SP3 and WinXP SP1 (this does not specifically call
|
||||
; out Windows Vista which has not been released at the time of this comment or
|
||||
; any other future versions of Windows).
|
||||
|
||||
; This is fairly evil. We have a reg key of
|
||||
; Software\Clients\StartMenuInternet\firefox.exe\InstallInfo
|
||||
; yet we can have multiple installations of the program.
|
||||
; this key provides info as to whether shortcuts are displayed and can hide
|
||||
; and unhide these same shortcuts. This just seems wrong and prone to problems.
|
||||
; For example, one instance installed in c:\firefox1 has set this key. Another
|
||||
; instance is then installed in c:\firefox2. Under what specific circumstances
|
||||
; do we set this key? What if the other instance is not the default browser...
|
||||
; which shortcuts should be displayed on the desktop and quicklaunch as well as
|
||||
; which ones affect the "set program access and defaults", etc.
|
||||
|
||||
; We probably need to have some verification of whether we are installing as the
|
||||
; new default browser, etc.
|
||||
; When installing with defaults we should always install into the previous location
|
||||
; ReadRegStr $0 HKCR "http\shell\open\command" ""
|
||||
|
||||
; Sets program access and defaults - hide / show shortcuts on the Desktop and in
|
||||
; QuickLaunch. This is a royal PITA since the application version can change out
|
||||
; from under us and there may also be more than one version of the application
|
||||
; installed. This also needs to respect whether the shortcuts have been modified
|
||||
; since their initial creation and take into account whether the shortcut is
|
||||
; located in all users or the current user desktop.
|
||||
; To remove a shortcut it must point to this installation main executable and it
|
||||
; must not have additional arguments.
|
||||
; To create a shortcut a shortcut must not already exist with the same name.
|
||||
Function un.SetAccess
|
||||
${un.GetParameters} $R0
|
||||
|
||||
StrCpy $R1 "Software\Clients\StartMenuInternet\${FileMainEXE}\InstallInfo"
|
||||
SetShellVarContext all ; Set $DESKTOP to All Users
|
||||
|
||||
; Hide icons - initiated from Set Program Access and Defaults
|
||||
${If} $R0 == '/ua "${AppVersion} (${AB_CD})" /hs browser'
|
||||
WriteRegDWORD HKLM $R1 "IconsVisible" 0
|
||||
${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
|
||||
SetShellVarContext current ; Set $DESKTOP to the current user's desktop
|
||||
${EndUnless}
|
||||
|
||||
${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
|
||||
ShellLink::GetShortCutArgs "$DESKTOP\${BrandFullName}.lnk"
|
||||
Pop $0
|
||||
${If} $0 == ""
|
||||
ShellLink::GetShortCutTarget "$DESKTOP\${BrandFullName}.lnk"
|
||||
Pop $0
|
||||
${If} $0 == "$INSTDIR\${FileMainEXE}"
|
||||
Delete "$DESKTOP\${BrandFullName}.lnk"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk"
|
||||
ShellLink::GetShortCutArgs "$QUICKLAUNCH\${BrandFullName}.lnk"
|
||||
Pop $0
|
||||
${If} $0 == ""
|
||||
ShellLink::GetShortCutTarget "$QUICKLAUNCH\${BrandFullName}.lnk"
|
||||
Pop $0
|
||||
${If} $0 == "$INSTDIR\${FileMainEXE}"
|
||||
Delete "$QUICKLAUNCH\${BrandFullName}.lnk"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
Abort
|
||||
${EndIf}
|
||||
|
||||
; Show icons - initiated from Set Program Access and Defaults
|
||||
${If} $R0 == '/ua "${AppVersion} (${AB_CD})" /ss browser'
|
||||
WriteRegDWORD HKLM $R1 "IconsVisible" 1
|
||||
${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
|
||||
CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\${FileMainEXE}" 0
|
||||
ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR"
|
||||
${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
|
||||
SetShellVarContext current ; Set $DESKTOP to the current user's desktop
|
||||
${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
|
||||
CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\${FileMainEXE}" 0
|
||||
ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR"
|
||||
${EndUnless}
|
||||
${EndUnless}
|
||||
${EndUnless}
|
||||
${Unless} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk"
|
||||
CreateShortCut "$QUICKLAUNCH\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\${FileMainEXE}" 0
|
||||
ShellLink::SetShortCutWorkingDirectory "$QUICKLAUNCH\${BrandFullName}.lnk" "$INSTDIR"
|
||||
${EndUnless}
|
||||
Abort
|
||||
${EndIf}
|
||||
FunctionEnd
|
|
@ -37,11 +37,8 @@
|
|||
# Also requires:
|
||||
# ShellLink plugin http://nsis.sourceforge.net/ShellLink_plug-in
|
||||
|
||||
; NOTES
|
||||
; Size matters! Try different methods to accomplish the same result and use the
|
||||
; one that results in the smallest size. Every KB counts!
|
||||
; LogicLib.nsh must be included in all installers to ease script creation and
|
||||
; readability. It adds a couple of KB to the size but it is worth it.
|
||||
; 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 use 7-Zip to create a SFX archive of it
|
||||
|
@ -49,14 +46,24 @@ SetDatablockOptimize on
|
|||
SetCompress off
|
||||
CRCCheck on
|
||||
|
||||
!addplugindir ./
|
||||
|
||||
; empty files - except for the comment line - for generating custom pages.
|
||||
!system 'echo ; > options.ini'
|
||||
!system 'echo ; > components.ini'
|
||||
!system 'echo ; > shortcuts.ini'
|
||||
|
||||
!addplugindir ./
|
||||
Var TmpVal
|
||||
Var StartMenuDir
|
||||
Var InstallType
|
||||
Var AddStartMenuSC
|
||||
Var AddQuickLaunchSC
|
||||
Var AddDesktopSC
|
||||
Var fhInstallLog
|
||||
Var fhUninstallLog
|
||||
|
||||
; Other files may depend upon these includes!
|
||||
; Other included files may depend upon these includes!
|
||||
; The following includes are provided by NSIS.
|
||||
!include FileFunc.nsh
|
||||
!include LogicLib.nsh
|
||||
!include TextFunc.nsh
|
||||
|
@ -67,48 +74,30 @@ CRCCheck on
|
|||
!insertmacro FileJoin
|
||||
!insertmacro GetTime
|
||||
!insertmacro LineFind
|
||||
!insertmacro un.LineFind
|
||||
!insertmacro StrFilter
|
||||
!insertmacro TrimNewLines
|
||||
!insertmacro un.TrimNewLines
|
||||
!insertmacro WordFind
|
||||
!insertmacro WordReplace
|
||||
!insertmacro GetSize
|
||||
!insertmacro GetParameters
|
||||
!insertmacro un.GetParameters
|
||||
!insertmacro GetOptions
|
||||
!insertmacro GetRoot
|
||||
!insertmacro DriveSpace
|
||||
|
||||
; Use the pre-processor where ever possible
|
||||
; Remember that !define's create smaller packages than Var's!
|
||||
Var TmpVal
|
||||
Var StartMenuDir
|
||||
Var InstallType
|
||||
Var AddStartMenuSC
|
||||
Var AddQuickLaunchSC
|
||||
Var AddDesktopSC
|
||||
Var fhInstallLog
|
||||
Var fhUninstallLog
|
||||
|
||||
; The following includes are custom.
|
||||
!include branding.nsi
|
||||
!include defines.nsi
|
||||
!include SetProgramAccess.nsi
|
||||
!include common.nsh
|
||||
!include locales.nsi
|
||||
!include version.nsh
|
||||
|
||||
!insertmacro RegCleanMain
|
||||
!insertmacro un.RegCleanMain
|
||||
!insertmacro RegCleanUninstall
|
||||
!insertmacro un.RegCleanUninstall
|
||||
!insertmacro CloseApp
|
||||
!insertmacro un.CloseApp
|
||||
!insertmacro WriteRegStr2
|
||||
!insertmacro WriteRegDWORD2
|
||||
!insertmacro WriteRegStrHKCR
|
||||
!insertmacro CreateRegKey
|
||||
!insertmacro un.GetSecondInstallPath
|
||||
!insertmacro CanWriteToInstallDir
|
||||
!insertmacro CheckDiskSpace
|
||||
|
||||
|
@ -120,28 +109,22 @@ Name "${BrandFullName}"
|
|||
OutFile "setup.exe"
|
||||
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${AppVersion})" "InstallLocation"
|
||||
InstallDir "$PROGRAMFILES\${BrandFullName}"
|
||||
|
||||
ShowInstDetails nevershow
|
||||
ShowUnInstDetails nevershow
|
||||
|
||||
ReserveFile options.ini
|
||||
ReserveFile components.ini
|
||||
ReserveFile shortcuts.ini
|
||||
|
||||
################################################################################
|
||||
# Modern User Interface - MUI
|
||||
|
||||
ReserveFile options.ini
|
||||
ReserveFile shortcuts.ini
|
||||
ReserveFile components.ini
|
||||
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_COMPONENTSPAGE_SMALLDESC
|
||||
|
||||
!define MUI_ICON setup.ico
|
||||
!define MUI_UNICON setup.ico
|
||||
|
||||
!define MUI_WELCOMEPAGE_TITLE_3LINES
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP wizWatermark.bmp
|
||||
!define MUI_UNWELCOMEFINISHPAGE_BITMAP wizWatermark.bmp
|
||||
!define MUI_HEADERIMAGE
|
||||
!define MUI_HEADERIMAGE_RIGHT
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP wizWatermark.bmp
|
||||
|
||||
; Use a right to left header image when the language is right to left
|
||||
!ifdef ${AB_CD}_rtl
|
||||
|
@ -161,27 +144,22 @@ ReserveFile components.ini
|
|||
!insertmacro MUI_PAGE_LICENSE license.rtf
|
||||
|
||||
; Custom Options Page
|
||||
Page custom preOptions ChangeOptions
|
||||
Page custom preOptions leaveOptions
|
||||
|
||||
|
||||
Page custom preComponents checkComponents
|
||||
|
||||
|
||||
; Select Install Components Page
|
||||
;!define MUI_PAGE_CUSTOMFUNCTION_PRE preComponents
|
||||
;!insertmacro MUI_PAGE_COMPONENTS
|
||||
; Custom Components Page
|
||||
Page custom preComponents leaveComponents
|
||||
|
||||
; Select Install Directory Page
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE preCheckInstallDir
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE leaveCheckInstallDir
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE preDirectory
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE leaveDirectory
|
||||
!define MUI_DIRECTORYPAGE_VERIFYONLEAVE
|
||||
!insertmacro MUI_PAGE_DIRECTORY
|
||||
|
||||
; Custom Shortcuts Page - CheckCustom is Called in Shortcuts
|
||||
Page custom preShortcuts ChangeShortcuts
|
||||
; Custom Shortcuts Page
|
||||
Page custom preShortcuts leaveShortcuts
|
||||
|
||||
; Start Menu Folder Page Configuration
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE preCheckStartMenu
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE preStartMenu
|
||||
!define MUI_STARTMENUPAGE_NODISABLE
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
|
||||
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})\Main"
|
||||
|
@ -189,7 +167,7 @@ Page custom preShortcuts ChangeShortcuts
|
|||
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuDir
|
||||
|
||||
; Install Files Page
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE FinishInstall
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE leaveInstFiles
|
||||
!insertmacro MUI_PAGE_INSTFILES
|
||||
|
||||
; Finish Page
|
||||
|
@ -198,180 +176,11 @@ Page custom preShortcuts ChangeShortcuts
|
|||
!define MUI_FINISHPAGE_RUN
|
||||
!define MUI_FINISHPAGE_RUN_FUNCTION LaunchApp
|
||||
!define MUI_FINISHPAGE_RUN_TEXT $(LAUNCH_TEXT)
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE disableCancel
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE preFinish
|
||||
!insertmacro MUI_PAGE_FINISH
|
||||
|
||||
/**
|
||||
* Uninstall Pages
|
||||
*/
|
||||
; Welcome Page
|
||||
!insertmacro MUI_UNPAGE_WELCOME
|
||||
|
||||
; Uninstall Confirm Page
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
|
||||
; Remove Files Page
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.checkIfAppIsLoaded
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
; Finish Page
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.disableCancel
|
||||
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
|
||||
!define MUI_FINISHPAGE_SHOWREADME ""
|
||||
|
||||
; Setup the survey controls, functions, etc. except when the application has
|
||||
; defined NO_UNINSTALL_SURVEY
|
||||
!ifndef NO_UNINSTALL_SURVEY
|
||||
!define MUI_FINISHPAGE_SHOWREADME_TEXT $(SURVEY_TEXT)
|
||||
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION un.survey
|
||||
!endif
|
||||
|
||||
!insertmacro MUI_UNPAGE_FINISH
|
||||
|
||||
/**
|
||||
* Adds a section divider to the human readable log.
|
||||
*/
|
||||
Function WriteLogSeparator
|
||||
FileWrite $fhInstallLog "$\r$\n-------------------------------------------------------------------------------$\r$\n"
|
||||
FunctionEnd
|
||||
|
||||
; Callback used to check if the app being uninstalled is running.
|
||||
Function un.checkIfAppIsLoaded
|
||||
; Try to delete the app executable and if we can't delete it try to close the
|
||||
; app. This allows running an instance that is located in another directory.
|
||||
ClearErrors
|
||||
${If} ${FileExists} "$INSTDIR\${FileMainEXE}"
|
||||
${DeleteFile} "$INSTDIR\${FileMainEXE}"
|
||||
${EndIf}
|
||||
${If} ${Errors}
|
||||
ClearErrors
|
||||
${un.CloseApp} "true" $(WARN_APP_RUNNING_UNINSTALL)
|
||||
; Try to delete it again to prevent launching the app while we are
|
||||
; installing.
|
||||
${DeleteFile} "$INSTDIR\${FileMainEXE}"
|
||||
ClearErrors
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
; Setup the survey controls, functions, etc. except when the application has
|
||||
; defined NO_UNINSTALL_SURVEY
|
||||
!ifndef NO_UNINSTALL_SURVEY
|
||||
Function un.survey
|
||||
Exec "$\"$TmpVal$\" $\"${SurveyURL}$\""
|
||||
FunctionEnd
|
||||
!endif
|
||||
|
||||
; Check whether to display the current page (e.g. if we aren't performing a
|
||||
; custom install don't display the custom pages).
|
||||
Function CheckCustom
|
||||
${If} $InstallType != 4
|
||||
Abort
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function preCheckInstallDir
|
||||
${If} $InstallType != 4
|
||||
${CheckDiskSpace} $R9
|
||||
${If} $R9 != "false"
|
||||
${CanWriteToInstallDir} $R9
|
||||
${If} $R9 != "false"
|
||||
Abort
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function leaveCheckInstallDir
|
||||
${CheckDiskSpace} $R9
|
||||
${If} $R9 == "false"
|
||||
MessageBox MB_OK "$(WARN_DISK_SPACE)"
|
||||
Abort
|
||||
${EndIf}
|
||||
|
||||
${CanWriteToInstallDir} $R9
|
||||
${If} $R9 == "false"
|
||||
MessageBox MB_OK "$(WARN_WRITE_ACCESS)"
|
||||
Abort
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function preCheckStartMenu
|
||||
Call CheckCustom
|
||||
${If} $AddStartMenuSC != 1
|
||||
Abort
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function onInstallDeleteFile
|
||||
${TrimNewLines} "$R9" "$R9"
|
||||
StrCpy $R1 "$R9" 5
|
||||
${If} $R1 == "File:"
|
||||
StrCpy $R9 "$R9" "" 6
|
||||
${If} ${FileExists} "$INSTDIR$R9"
|
||||
ClearErrors
|
||||
Delete "$INSTDIR$R9"
|
||||
${If} ${Errors}
|
||||
${LogMsg} "** ERROR Deleting File: $INSTDIR$R9 **"
|
||||
${Else}
|
||||
${LogMsg} "Deleted File: $INSTDIR$R9"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
ClearErrors
|
||||
Push 0
|
||||
FunctionEnd
|
||||
|
||||
; The previous installer removed directories even when they aren't empty so this
|
||||
; funtion does as well.
|
||||
Function onInstallRemoveDir
|
||||
${TrimNewLines} "$R9" "$R9"
|
||||
StrCpy $R1 "$R9" 4
|
||||
${If} $R1 == "Dir:"
|
||||
StrCpy $R9 "$R9" "" 5
|
||||
StrCpy $R1 "$R9" "" -1
|
||||
${If} $R1 == "\"
|
||||
StrCpy $R9 "$R9" -1
|
||||
${EndIf}
|
||||
${If} ${FileExists} "$INSTDIR$R9"
|
||||
ClearErrors
|
||||
RmDir /r "$INSTDIR$R9"
|
||||
${If} ${Errors}
|
||||
${LogMsg} "** ERROR Removing Directory: $INSTDIR$R9 **"
|
||||
${Else}
|
||||
${LogMsg} "Removed Directory: $INSTDIR$R9"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
ClearErrors
|
||||
Push 0
|
||||
FunctionEnd
|
||||
|
||||
Function FinishInstall
|
||||
FileClose $fhUninstallLog
|
||||
; Diff and add missing entries from the previous file log if it exists
|
||||
${If} ${FileExists} "$INSTDIR\uninstall\uninstall.bak"
|
||||
SetDetailsPrint textonly
|
||||
DetailPrint $(STATUS_CLEANUP)
|
||||
SetDetailsPrint none
|
||||
${LogHeader} "Updating Uninstall Log With Previous Uninstall Log"
|
||||
StrCpy $R0 "$INSTDIR\uninstall\uninstall.log"
|
||||
StrCpy $R1 "$INSTDIR\uninstall\uninstall.bak"
|
||||
GetTempFileName $R2
|
||||
FileOpen $R3 $R2 w
|
||||
${TextCompareNoDetails} "$R1" "$R0" "SlowDiff" "GetDiff"
|
||||
FileClose $R3
|
||||
${Unless} ${Errors}
|
||||
${FileJoin} "$INSTDIR\uninstall\uninstall.log" "$R2" "$INSTDIR\uninstall\uninstall.log"
|
||||
${EndUnless}
|
||||
${DeleteFile} "$INSTDIR\uninstall\uninstall.bak"
|
||||
${DeleteFile} "$R2"
|
||||
${EndIf}
|
||||
|
||||
Call WriteLogSeparator
|
||||
${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
|
||||
FileWrite $fhInstallLog "${BrandFullName} Installation Finished: $2-$1-$0 $4:$5:$6$\r$\n"
|
||||
FileClose $fhInstallLog
|
||||
FunctionEnd
|
||||
################################################################################
|
||||
# Install Sections
|
||||
|
||||
Section "-Application" Section1
|
||||
SectionIn 1 RO
|
||||
|
@ -521,9 +330,9 @@ Section "-Application" Section1
|
|||
Call DoCopyFiles
|
||||
|
||||
${If} $InstallType != 4
|
||||
Call install_talkback
|
||||
Call installTalkback
|
||||
${If} ${FileExists} "$INSTDIR\extensions\inspector@mozilla.org"
|
||||
Call install_inspector
|
||||
Call installInspector
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
|
@ -640,14 +449,14 @@ Section "-Application" Section1
|
|||
; The Reinstall Command is defined at
|
||||
; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_adv/registeringapps.asp
|
||||
StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo"
|
||||
StrCpy $1 "$\"$INSTDIR\uninstall\uninstaller.exe$\" /ua $\"${AppVersion} (${AB_CD})$\" /hs browser"
|
||||
StrCpy $1 "$\"$INSTDIR\uninstall\uninst.exe$\" /ua $\"${AppVersion} (${AB_CD})$\" /hs browser"
|
||||
${WriteRegStr2} $TmpVal "$0" "HideIconsCommand" "$1" 0
|
||||
${WriteRegDWORD2} $TmpVal "$0" "IconsVisible" 1 0
|
||||
|
||||
StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo"
|
||||
StrCpy $1 "$\"$INSTDIR\${FileMainEXE}$\" -silent -setDefaultBrowser"
|
||||
${WriteRegStr2} $TmpVal "$0" "ReinstallCommand" "$1" 0
|
||||
StrCpy $1 "$\"$INSTDIR\uninstall\uninstaller.exe$\" /ua $\"${AppVersion} (${AB_CD})$\" /ss browser"
|
||||
StrCpy $1 "$\"$INSTDIR\uninstall\uninst.exe$\" /ua $\"${AppVersion} (${AB_CD})$\" /ss browser"
|
||||
${WriteRegStr2} $TmpVal "$0" "ShowIconsCommand" "$1" 0
|
||||
|
||||
StrCpy $0 "Software\Clients\StartMenuInternet\$R9\shell\open\command"
|
||||
|
@ -672,7 +481,7 @@ Section "-Application" Section1
|
|||
|
||||
; Write the uninstall registry keys
|
||||
StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${AppVersion})"
|
||||
StrCpy $1 "$\"$INSTDIR\uninstall\uninstaller.exe$\" $\"/ua ${AppVersion} (${AB_CD})$\""
|
||||
StrCpy $1 "$INSTDIR\uninstall\uninst.exe"
|
||||
|
||||
${WriteRegStr2} $TmpVal "$0" "Comments" "${BrandFullNameInternal}" 0
|
||||
${WriteRegStr2} $TmpVal "$0" "DisplayIcon" "$INSTDIR\${FileMainEXE},0" 0
|
||||
|
@ -711,27 +520,27 @@ Section "-Application" Section1
|
|||
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
|
||||
; Refresh destop icons
|
||||
; Refresh desktop icons
|
||||
System::Call "shell32::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)"
|
||||
|
||||
WriteUninstaller "$INSTDIR\uninstall\uninstaller.exe"
|
||||
|
||||
SectionEnd
|
||||
|
||||
Section /o "Developer Tools" Section2
|
||||
Call install_inspector
|
||||
Call installInspector
|
||||
SectionEnd
|
||||
|
||||
Section /o "Quality Feedback Agent" Section3
|
||||
Call install_talkback
|
||||
Call installTalkback
|
||||
SectionEnd
|
||||
|
||||
Function install_inspector
|
||||
################################################################################
|
||||
# Helper Functions
|
||||
|
||||
Function installInspector
|
||||
${If} ${FileExists} "$EXEDIR\optional\extensions\inspector@mozilla.org"
|
||||
SetDetailsPrint textonly
|
||||
DetailPrint $(STATUS_INSTALL_OPTIONAL)
|
||||
SetDetailsPrint none
|
||||
${RemoveDir} "$INSTDIR\extensions\extensions\inspector@mozilla.org"
|
||||
${RemoveDir} "$INSTDIR\extensions\inspector@mozilla.org"
|
||||
ClearErrors
|
||||
${LogHeader} "Installing Developer Tools"
|
||||
StrCpy $R0 "$EXEDIR\optional\extensions\inspector@mozilla.org"
|
||||
|
@ -740,7 +549,7 @@ Function install_inspector
|
|||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function install_talkback
|
||||
Function installTalkback
|
||||
StrCpy $R0 "$EXEDIR\optional\extensions\talkback@mozilla.org"
|
||||
${If} ${FileExists} "$R0"
|
||||
SetDetailsPrint textonly
|
||||
|
@ -777,152 +586,61 @@ Function install_talkback
|
|||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Section "Uninstall"
|
||||
SetDetailsPrint textonly
|
||||
DetailPrint $(STATUS_UNINSTALL_MAIN)
|
||||
SetDetailsPrint none
|
||||
; Remove registry entries for non-existent apps and for apps that point to our
|
||||
; install location in the Software\Mozilla key.
|
||||
SetShellVarContext current ; Sets SHCTX to HKCU
|
||||
${un.RegCleanMain} "Software\Mozilla"
|
||||
SetShellVarContext all ; Sets SHCTX to HKLM
|
||||
${un.RegCleanMain} "Software\Mozilla"
|
||||
|
||||
; Remove uninstall entries that point to our install location
|
||||
${un.RegCleanUninstall}
|
||||
|
||||
SetShellVarContext all ; Set SHCTX to HKLM
|
||||
${un.GetSecondInstallPath} "Software\Mozilla" $R9
|
||||
${If} $R9 == "false"
|
||||
SetShellVarContext current ; Set SHCTX to HKCU
|
||||
${un.GetSecondInstallPath} "Software\Mozilla" $R9
|
||||
${EndIf}
|
||||
|
||||
StrCpy $0 "Software\Clients\StartMenuInternet\${FileMainEXE}\shell\open\command"
|
||||
ReadRegStr $1 HKLM "$0" ""
|
||||
Push $1
|
||||
${GetPathFromRegStr}
|
||||
Pop $R0
|
||||
Push $R0
|
||||
${GetParentDir}
|
||||
Pop $R1
|
||||
|
||||
; Only remove the StartMenuInternet key if it refers to this install location.
|
||||
; The StartMenuInternet registry key is independent of the default browser
|
||||
; settings. The XPInstall base un-installer always removes this key if it is
|
||||
; uninstalling the default browser and it will always replace the keys when
|
||||
; installing even if there is another install of Firefox that is set as the
|
||||
; default browser. Now the key is always updated on install but it is only
|
||||
; removed if it refers to this install location.
|
||||
${If} $INSTDIR == $R1
|
||||
; XXXrstrong - if there is another installation of the same app ideally we
|
||||
; would just modify these values. The GetSecondInstallPath macro could be
|
||||
; made to provide enough information to do this.
|
||||
DeleteRegKey HKLM "Software\Clients\StartMenuInternet\${FileMainEXE}"
|
||||
${EndIf}
|
||||
|
||||
StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}"
|
||||
${If} $R9 == "false"
|
||||
DeleteRegKey HKLM "$0"
|
||||
DeleteRegKey HKCU "$0"
|
||||
StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\$R9"
|
||||
DeleteRegKey HKLM "$0"
|
||||
DeleteRegKey HKCU "$0"
|
||||
StrCpy $0 "MIME\Database\Content Type\application/x-xpinstall;app=firefox"
|
||||
DeleteRegKey HKCR "$0"
|
||||
${Else}
|
||||
ReadRegStr $1 HKLM "$0" ""
|
||||
Push $1
|
||||
${GetPathFromRegStr}
|
||||
Pop $R0
|
||||
Push $R0
|
||||
${GetParentDir}
|
||||
Pop $R1
|
||||
${If} $INSTDIR == $R1
|
||||
WriteRegStr HKLM "$0" "" "$R9"
|
||||
Push $R9
|
||||
${GetParentDir}
|
||||
Pop $R1
|
||||
WriteRegStr HKLM "$0" "Path" "$R1"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
; Remove files. If we don't have a log file skip
|
||||
${If} ${FileExists} "$INSTDIR\uninstall\uninstall.log"
|
||||
; Copy the uninstall log file to a temporary file
|
||||
GetTempFileName $TmpVal
|
||||
CopyFiles "$INSTDIR\uninstall\uninstall.log" "$TmpVal"
|
||||
|
||||
; Unregister DLL's
|
||||
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.UnRegDLLsCallback"
|
||||
|
||||
; Delete files
|
||||
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.RemoveFilesCallback"
|
||||
|
||||
; Remove directories we always control
|
||||
RmDir /r "$INSTDIR\uninstall"
|
||||
RmDir /r "$INSTDIR\updates"
|
||||
RmDir /r "$INSTDIR\defaults\shortcuts"
|
||||
|
||||
; Remove empty directories
|
||||
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.RemoveDirsCallback"
|
||||
|
||||
; Delete the temporary uninstall log file
|
||||
${DeleteFile} "$TmpVal"
|
||||
|
||||
; Remove the installation directory if it is empty
|
||||
${RemoveDir} "$INSTDIR"
|
||||
${EndIf}
|
||||
|
||||
; Refresh destop icons otherwise the start menu internet item won't be removed
|
||||
; and other ugly things will happen like recreation of the registry key by the
|
||||
; OS under some conditions.
|
||||
System::Call "shell32::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)"
|
||||
SectionEnd
|
||||
|
||||
; When we add an optional action to the finish page the cancel button is
|
||||
; enabled. The next two function disable it for install and uninstall and leave
|
||||
; the finish button as the only choice.
|
||||
Function disableCancel
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0"
|
||||
; Adds a section divider to the human readable log.
|
||||
Function WriteLogSeparator
|
||||
FileWrite $fhInstallLog "$\r$\n-------------------------------------------------------------------------------$\r$\n"
|
||||
FunctionEnd
|
||||
|
||||
Function un.disableCancel
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0"
|
||||
|
||||
; Setup the survey controls, functions, etc. except when the application has
|
||||
; defined NO_UNINSTALL_SURVEY
|
||||
!ifdef NO_UNINSTALL_SURVEY
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3"
|
||||
!else
|
||||
StrCpy $TmpVal "SOFTWARE\Microsoft\IE Setup\Setup"
|
||||
ClearErrors
|
||||
ReadRegStr $0 HKLM $TmpVal "Path"
|
||||
${If} ${Errors}
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3"
|
||||
${Else}
|
||||
ExpandEnvStrings $0 "$0" ; this value will usually contain %programfiles%
|
||||
${If} $0 != "\"
|
||||
StrCpy $0 "$0\"
|
||||
${EndIf}
|
||||
StrCpy $0 "$0\iexplore.exe"
|
||||
ClearErrors
|
||||
GetFullPathName $TmpVal $0
|
||||
${If} ${Errors}
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
!endif
|
||||
FunctionEnd
|
||||
|
||||
Function ChangeShortcuts
|
||||
${MUI_INSTALLOPTIONS_READ} $0 "shortcuts.ini" "Settings" "State"
|
||||
${If} $0 != 0
|
||||
; Check whether to display the current page (e.g. if we aren't performing a
|
||||
; custom install don't display the custom pages).
|
||||
Function CheckCustom
|
||||
${If} $InstallType != 4
|
||||
Abort
|
||||
${EndIf}
|
||||
${MUI_INSTALLOPTIONS_READ} $AddDesktopSC "shortcuts.ini" "Field 2" "State"
|
||||
${MUI_INSTALLOPTIONS_READ} $AddStartMenuSC "shortcuts.ini" "Field 3" "State"
|
||||
${MUI_INSTALLOPTIONS_READ} $AddQuickLaunchSC "shortcuts.ini" "Field 4" "State"
|
||||
FunctionEnd
|
||||
|
||||
Function onInstallDeleteFile
|
||||
${TrimNewLines} "$R9" "$R9"
|
||||
StrCpy $R1 "$R9" 5
|
||||
${If} $R1 == "File:"
|
||||
StrCpy $R9 "$R9" "" 6
|
||||
${If} ${FileExists} "$INSTDIR$R9"
|
||||
ClearErrors
|
||||
Delete "$INSTDIR$R9"
|
||||
${If} ${Errors}
|
||||
${LogMsg} "** ERROR Deleting File: $INSTDIR$R9 **"
|
||||
${Else}
|
||||
${LogMsg} "Deleted File: $INSTDIR$R9"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
ClearErrors
|
||||
Push 0
|
||||
FunctionEnd
|
||||
|
||||
; The previous installer removed directories even when they aren't empty so this
|
||||
; function does as well.
|
||||
Function onInstallRemoveDir
|
||||
${TrimNewLines} "$R9" "$R9"
|
||||
StrCpy $R1 "$R9" 4
|
||||
${If} $R1 == "Dir:"
|
||||
StrCpy $R9 "$R9" "" 5
|
||||
StrCpy $R1 "$R9" "" -1
|
||||
${If} $R1 == "\"
|
||||
StrCpy $R9 "$R9" -1
|
||||
${EndIf}
|
||||
${If} ${FileExists} "$INSTDIR$R9"
|
||||
ClearErrors
|
||||
RmDir /r "$INSTDIR$R9"
|
||||
${If} ${Errors}
|
||||
${LogMsg} "** ERROR Removing Directory: $INSTDIR$R9 **"
|
||||
${Else}
|
||||
${LogMsg} "Removed Directory: $INSTDIR$R9"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
ClearErrors
|
||||
Push 0
|
||||
FunctionEnd
|
||||
|
||||
Function GetDiff
|
||||
|
@ -975,119 +693,13 @@ Function CopyFile
|
|||
; If the file is installed into the installation directory remove the
|
||||
; installation directory's path from the file path when writing to the
|
||||
; uninstall.log so it will be a relative path. This allows the same
|
||||
; uninstaller.exe to be used with zip builds if we supply an uninstall.log.
|
||||
; uninst.exe to be used with zip builds if we supply an uninstall.log.
|
||||
${WordReplace} "$R1$R3\$R7" "$INSTDIR" "" "+" $R3
|
||||
${LogUninstall} "File: $R3"
|
||||
${EndIf}
|
||||
Push 0
|
||||
FunctionEnd
|
||||
|
||||
Function un.RemoveFilesCallback
|
||||
${un.TrimNewLines} "$R9" "$R9"
|
||||
StrCpy $R1 "$R9" 5
|
||||
${If} $R1 == "File:"
|
||||
StrCpy $R9 "$R9" "" 6
|
||||
StrCpy $R0 "$R9" 1
|
||||
; If the path is relative prepend the install directory
|
||||
${If} $R0 == "\"
|
||||
StrCpy $R0 "$INSTDIR$R9"
|
||||
${Else}
|
||||
StrCpy $R0 "$R9"
|
||||
${EndIf}
|
||||
${If} ${FileExists} "$R0"
|
||||
${DeleteFile} "$R0"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
ClearErrors
|
||||
Push 0
|
||||
FunctionEnd
|
||||
|
||||
; Using locate will leave file handles open to some of the directories which
|
||||
; will prevent the deletion of these directories. This parses the uninstall.log
|
||||
; and uses the file entries to find / remove empty directories.
|
||||
Function un.RemoveDirsCallback
|
||||
${un.TrimNewLines} "$R9" "$R9"
|
||||
StrCpy $R1 "$R9" 5
|
||||
${If} $R1 == "File:"
|
||||
StrCpy $R9 "$R9" "" 6
|
||||
StrCpy $R1 "$R9" 1
|
||||
${If} $R1 == "\"
|
||||
StrCpy $R2 "INSTDIR"
|
||||
StrCpy $R1 "$INSTDIR$R9"
|
||||
${Else}
|
||||
StrCpy $R2 " "
|
||||
StrCpy $R1 "$R9"
|
||||
${EndIf}
|
||||
loop:
|
||||
Push $R1
|
||||
Call un.GetParentDir
|
||||
Pop $R0
|
||||
GetFullPathName $R1 "$R0"
|
||||
; We only try to remove empty directories but the Desktop, StartMenu, and
|
||||
; QuickLaunch directories can be empty so guard against removing them.
|
||||
SetShellVarContext all
|
||||
${If} $R1 == "$DESKTOP"
|
||||
${OrIf} $R1 == "$STARTMENU"
|
||||
GoTo end
|
||||
${EndIf}
|
||||
SetShellVarContext current
|
||||
${If} $R1 == "$QUICKLAUNCH"
|
||||
${OrIf} $R1 == "$DESKTOP"
|
||||
${OrIf} $R1 == "$STARTMENU"
|
||||
GoTo end
|
||||
${EndIf}
|
||||
${If} ${FileExists} "$R1"
|
||||
RmDir "$R1"
|
||||
${EndIf}
|
||||
${If} ${Errors}
|
||||
${OrIf} $R1 != "$INSTDIR"
|
||||
GoTo end
|
||||
${EndIf}
|
||||
GoTo loop
|
||||
${EndIf}
|
||||
|
||||
end:
|
||||
ClearErrors
|
||||
Push 0
|
||||
FunctionEnd
|
||||
|
||||
Function un.UnRegDLLsCallback
|
||||
${un.TrimNewLines} "$R9" "$R9"
|
||||
StrCpy $R1 "$R9" 7
|
||||
${If} $R1 == "DLLReg:"
|
||||
StrCpy $R9 "$R9" "" 8
|
||||
StrCpy $R1 "$R9" 1
|
||||
${If} $R1 == "\"
|
||||
StrCpy $R1 "$INSTDIR$R9"
|
||||
${Else}
|
||||
StrCpy $R1 "$R9"
|
||||
${EndIf}
|
||||
UnRegDLL $R1
|
||||
${EndIf}
|
||||
ClearErrors
|
||||
Push 0
|
||||
FunctionEnd
|
||||
|
||||
Function un.GetParentDir
|
||||
Exch $R0 ; old $R0 is on top of stack
|
||||
Push $R1
|
||||
Push $R2
|
||||
Push $R3
|
||||
StrLen $R3 $R0
|
||||
loop:
|
||||
IntOp $R1 $R1 - 1
|
||||
IntCmp $R1 -$R3 exit exit
|
||||
StrCpy $R2 $R0 1 $R1
|
||||
StrCmp $R2 "\" exit
|
||||
Goto loop
|
||||
exit:
|
||||
StrCpy $R0 $R0 $R1
|
||||
Pop $R3
|
||||
Pop $R2
|
||||
Pop $R1
|
||||
Exch $R0 ; put $R0 on top of stack, restore $R0 to original value
|
||||
FunctionEnd
|
||||
|
||||
; Clean up the old log files. We only diff the first two found since it is
|
||||
; possible for there to be several MB and comparing that many would take a very
|
||||
; long time to diff.
|
||||
|
@ -1167,11 +779,13 @@ Function CleanOldLogFilesCallback
|
|||
Push 0
|
||||
FunctionEnd
|
||||
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Section1} $(APP_DESC)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Section2} $(DEV_TOOLS_DESC)
|
||||
!insertmacro MUI_DESCRIPTION_TEXT ${Section3} $(QFA_DESC)
|
||||
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
||||
Function LaunchApp
|
||||
${CloseApp} "true" $(WARN_APP_RUNNING_INSTALL)
|
||||
Exec "$INSTDIR\${FileMainEXE}"
|
||||
FunctionEnd
|
||||
|
||||
################################################################################
|
||||
# Language
|
||||
|
||||
!insertmacro MOZ_MUI_LANGUAGE 'baseLocale'
|
||||
!verbose push
|
||||
|
@ -1184,18 +798,15 @@ FunctionEnd
|
|||
; using " " for BrandingText will hide the "Nullsoft Install System..." branding
|
||||
BrandingText " "
|
||||
|
||||
Function preShortcuts
|
||||
Call CheckCustom
|
||||
!insertmacro MUI_HEADER_TEXT "$(SHORTCUTS_PAGE_TITLE)" "$(SHORTCUTS_PAGE_SUBTITLE)"
|
||||
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "shortcuts.ini"
|
||||
FunctionEnd
|
||||
################################################################################
|
||||
# Page pre and leave functions
|
||||
|
||||
Function preOptions
|
||||
!insertmacro MUI_HEADER_TEXT "$(OPTIONS_PAGE_TITLE)" "$(OPTIONS_PAGE_SUBTITLE)"
|
||||
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "options.ini"
|
||||
FunctionEnd
|
||||
|
||||
Function ChangeOptions
|
||||
Function leaveOptions
|
||||
${MUI_INSTALLOPTIONS_READ} $0 "options.ini" "Settings" "State"
|
||||
${If} $0 != 0
|
||||
Abort
|
||||
|
@ -1222,7 +833,7 @@ Function preComponents
|
|||
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "components.ini"
|
||||
FunctionEnd
|
||||
|
||||
Function checkComponents
|
||||
Function leaveComponents
|
||||
; If DOMi exists then it will be Field 2.
|
||||
; If DOMi doesn't exist and talkback exists then TalkBack will be Field 2 but
|
||||
; if DOMi doesn't exist we won't display this page anyways.
|
||||
|
@ -1247,15 +858,95 @@ Function checkComponents
|
|||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function LaunchApp
|
||||
${CloseApp} "true" $(WARN_APP_RUNNING_INSTALL)
|
||||
Exec "$INSTDIR\${FileMainEXE}"
|
||||
Function preDirectory
|
||||
${If} $InstallType != 4
|
||||
${CheckDiskSpace} $R9
|
||||
${If} $R9 != "false"
|
||||
${CanWriteToInstallDir} $R9
|
||||
${If} $R9 != "false"
|
||||
Abort
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function leaveDirectory
|
||||
${CheckDiskSpace} $R9
|
||||
${If} $R9 == "false"
|
||||
MessageBox MB_OK "$(WARN_DISK_SPACE)"
|
||||
Abort
|
||||
${EndIf}
|
||||
|
||||
${CanWriteToInstallDir} $R9
|
||||
${If} $R9 == "false"
|
||||
MessageBox MB_OK "$(WARN_WRITE_ACCESS)"
|
||||
Abort
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function preShortcuts
|
||||
Call CheckCustom
|
||||
!insertmacro MUI_HEADER_TEXT "$(SHORTCUTS_PAGE_TITLE)" "$(SHORTCUTS_PAGE_SUBTITLE)"
|
||||
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "shortcuts.ini"
|
||||
FunctionEnd
|
||||
|
||||
Function leaveShortcuts
|
||||
${MUI_INSTALLOPTIONS_READ} $0 "shortcuts.ini" "Settings" "State"
|
||||
${If} $0 != 0
|
||||
Abort
|
||||
${EndIf}
|
||||
${MUI_INSTALLOPTIONS_READ} $AddDesktopSC "shortcuts.ini" "Field 2" "State"
|
||||
${MUI_INSTALLOPTIONS_READ} $AddStartMenuSC "shortcuts.ini" "Field 3" "State"
|
||||
${MUI_INSTALLOPTIONS_READ} $AddQuickLaunchSC "shortcuts.ini" "Field 4" "State"
|
||||
FunctionEnd
|
||||
|
||||
Function preStartMenu
|
||||
Call CheckCustom
|
||||
${If} $AddStartMenuSC != 1
|
||||
Abort
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function leaveInstFiles
|
||||
FileClose $fhUninstallLog
|
||||
; Diff and add missing entries from the previous file log if it exists
|
||||
${If} ${FileExists} "$INSTDIR\uninstall\uninstall.bak"
|
||||
SetDetailsPrint textonly
|
||||
DetailPrint $(STATUS_CLEANUP)
|
||||
SetDetailsPrint none
|
||||
${LogHeader} "Updating Uninstall Log With Previous Uninstall Log"
|
||||
StrCpy $R0 "$INSTDIR\uninstall\uninstall.log"
|
||||
StrCpy $R1 "$INSTDIR\uninstall\uninstall.bak"
|
||||
GetTempFileName $R2
|
||||
FileOpen $R3 $R2 w
|
||||
${TextCompareNoDetails} "$R1" "$R0" "SlowDiff" "GetDiff"
|
||||
FileClose $R3
|
||||
${Unless} ${Errors}
|
||||
${FileJoin} "$INSTDIR\uninstall\uninstall.log" "$R2" "$INSTDIR\uninstall\uninstall.log"
|
||||
${EndUnless}
|
||||
${DeleteFile} "$INSTDIR\uninstall\uninstall.bak"
|
||||
${DeleteFile} "$R2"
|
||||
${EndIf}
|
||||
|
||||
Call WriteLogSeparator
|
||||
${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
|
||||
FileWrite $fhInstallLog "${BrandFullName} Installation Finished: $2-$1-$0 $4:$5:$6$\r$\n"
|
||||
FileClose $fhInstallLog
|
||||
FunctionEnd
|
||||
|
||||
; When we add an optional action to the finish page the cancel button is
|
||||
; enabled. This disables it and leaves the finish button as the only choice.
|
||||
Function preFinish
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0"
|
||||
FunctionEnd
|
||||
|
||||
################################################################################
|
||||
# Initialization Functions
|
||||
|
||||
Function .onInit
|
||||
${GetParameters} $R0
|
||||
${If} $R0 != ""
|
||||
; Command line argument found
|
||||
ClearErrors
|
||||
${GetOptions} "$R0" "-ms" $R1
|
||||
${If} ${Errors}
|
||||
; Default install type
|
||||
|
@ -1360,8 +1051,8 @@ Function .onInit
|
|||
|
||||
StrCpy $LANGUAGE 0
|
||||
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "options.ini"
|
||||
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "shortcuts.ini"
|
||||
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "components.ini"
|
||||
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "shortcuts.ini"
|
||||
!insertmacro createBasicCustomOptionsINI
|
||||
!insertmacro createComponentsINI
|
||||
!insertmacro createShortcutsINI
|
||||
|
@ -1390,11 +1081,3 @@ Function .onInit
|
|||
SectionSetText 2 ""
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
Function un.onInit
|
||||
GetFullPathName $INSTDIR "$INSTDIR\.."
|
||||
StrCpy $LANGUAGE 0
|
||||
; XXXrstrong - should we quit when the app exe is not present?
|
||||
Call un.SetAccess
|
||||
FunctionEnd
|
||||
|
||||
|
|
|
@ -0,0 +1,496 @@
|
|||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is the Mozilla Installer code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Mozilla Foundation
|
||||
# Portions created by the Initial Developer are Copyright (C) 2006
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Robert Strong <robert.bugzilla@gmail.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
# Also requires:
|
||||
# ShellLink plugin 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 use 7-Zip to create a SFX archive of it
|
||||
SetDatablockOptimize on
|
||||
SetCompress off
|
||||
CRCCheck on
|
||||
|
||||
!addplugindir ./
|
||||
|
||||
Var TmpVal
|
||||
|
||||
; Other included files may depend upon these includes!
|
||||
; The following includes are provided by NSIS.
|
||||
!include FileFunc.nsh
|
||||
!include LogicLib.nsh
|
||||
!include TextFunc.nsh
|
||||
!include WinMessages.nsh
|
||||
!include WordFunc.nsh
|
||||
!include MUI.nsh
|
||||
|
||||
!insertmacro GetParameters
|
||||
!insertmacro un.LineFind
|
||||
!insertmacro un.TrimNewLines
|
||||
|
||||
; The following includes are custom.
|
||||
!include branding.nsi
|
||||
!include defines.nsi
|
||||
!include common.nsh
|
||||
!include locales.nsi
|
||||
!include version.nsh
|
||||
|
||||
!insertmacro un.RegCleanMain
|
||||
!insertmacro un.RegCleanUninstall
|
||||
!insertmacro un.CloseApp
|
||||
!insertmacro un.GetSecondInstallPath
|
||||
|
||||
Name "${BrandFullName}"
|
||||
OutFile "uninst.exe"
|
||||
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${AppVersion})" "InstallLocation"
|
||||
InstallDir "$PROGRAMFILES\${BrandFullName}"
|
||||
ShowUnInstDetails nevershow
|
||||
|
||||
################################################################################
|
||||
# Modern User Interface - MUI
|
||||
|
||||
!define MUI_ABORTWARNING
|
||||
!define MUI_ICON setup.ico
|
||||
!define MUI_UNICON setup.ico
|
||||
!define MUI_WELCOMEPAGE_TITLE_3LINES
|
||||
!define MUI_HEADERIMAGE
|
||||
!define MUI_HEADERIMAGE_RIGHT
|
||||
!define MUI_UNWELCOMEFINISHPAGE_BITMAP wizWatermark.bmp
|
||||
|
||||
; Use a right to left header image when the language is right to left
|
||||
!ifdef ${AB_CD}_rtl
|
||||
!define MUI_HEADERIMAGE_BITMAP_RTL wizHeaderRTL.bmp
|
||||
!else
|
||||
!define MUI_HEADERIMAGE_BITMAP wizHeader.bmp
|
||||
!endif
|
||||
|
||||
/**
|
||||
* Uninstall Pages
|
||||
*/
|
||||
; Welcome Page
|
||||
!insertmacro MUI_UNPAGE_WELCOME
|
||||
|
||||
; Uninstall Confirm Page
|
||||
!insertmacro MUI_UNPAGE_CONFIRM
|
||||
|
||||
; Remove Files Page
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.preInstFiles
|
||||
!insertmacro MUI_UNPAGE_INSTFILES
|
||||
|
||||
; Finish Page
|
||||
!define MUI_PAGE_CUSTOMFUNCTION_PRE un.preFinish
|
||||
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
|
||||
!define MUI_FINISHPAGE_SHOWREADME ""
|
||||
|
||||
; Setup the survey controls, functions, etc. except when the application has
|
||||
; defined NO_UNINSTALL_SURVEY
|
||||
!ifndef NO_UNINSTALL_SURVEY
|
||||
!define MUI_FINISHPAGE_SHOWREADME_TEXT $(SURVEY_TEXT)
|
||||
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION un.Survey
|
||||
!endif
|
||||
|
||||
!insertmacro MUI_UNPAGE_FINISH
|
||||
|
||||
################################################################################
|
||||
# Install Sections
|
||||
; Empty section required for the installer to compile as an uninstaller
|
||||
Section ""
|
||||
SectionEnd
|
||||
|
||||
################################################################################
|
||||
# Uninstall Sections
|
||||
|
||||
Section "Uninstall"
|
||||
SetDetailsPrint textonly
|
||||
DetailPrint $(STATUS_UNINSTALL_MAIN)
|
||||
SetDetailsPrint none
|
||||
; Remove registry entries for non-existent apps and for apps that point to our
|
||||
; install location in the Software\Mozilla key.
|
||||
SetShellVarContext current ; Sets SHCTX to HKCU
|
||||
${un.RegCleanMain} "Software\Mozilla"
|
||||
SetShellVarContext all ; Sets SHCTX to HKLM
|
||||
${un.RegCleanMain} "Software\Mozilla"
|
||||
|
||||
; Remove uninstall entries that point to our install location
|
||||
${un.RegCleanUninstall}
|
||||
|
||||
SetShellVarContext all ; Set SHCTX to HKLM
|
||||
${un.GetSecondInstallPath} "Software\Mozilla" $R9
|
||||
${If} $R9 == "false"
|
||||
SetShellVarContext current ; Set SHCTX to HKCU
|
||||
${un.GetSecondInstallPath} "Software\Mozilla" $R9
|
||||
${EndIf}
|
||||
|
||||
StrCpy $0 "Software\Clients\StartMenuInternet\${FileMainEXE}\shell\open\command"
|
||||
ReadRegStr $1 HKLM "$0" ""
|
||||
Push $1
|
||||
${GetPathFromRegStr}
|
||||
Pop $R0
|
||||
Push $R0
|
||||
${GetParentDir}
|
||||
Pop $R1
|
||||
|
||||
; Only remove the StartMenuInternet key if it refers to this install location.
|
||||
; The StartMenuInternet registry key is independent of the default browser
|
||||
; settings. The XPInstall base un-installer always removes this key if it is
|
||||
; uninstalling the default browser and it will always replace the keys when
|
||||
; installing even if there is another install of Firefox that is set as the
|
||||
; default browser. Now the key is always updated on install but it is only
|
||||
; removed if it refers to this install location.
|
||||
${If} $INSTDIR == $R1
|
||||
; XXXrstrong - if there is another installation of the same app ideally we
|
||||
; would just modify these values. The GetSecondInstallPath macro could be
|
||||
; made to provide enough information to do this.
|
||||
DeleteRegKey HKLM "Software\Clients\StartMenuInternet\${FileMainEXE}"
|
||||
${EndIf}
|
||||
|
||||
StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}"
|
||||
${If} $R9 == "false"
|
||||
DeleteRegKey HKLM "$0"
|
||||
DeleteRegKey HKCU "$0"
|
||||
StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\$R9"
|
||||
DeleteRegKey HKLM "$0"
|
||||
DeleteRegKey HKCU "$0"
|
||||
StrCpy $0 "MIME\Database\Content Type\application/x-xpinstall;app=firefox"
|
||||
DeleteRegKey HKCR "$0"
|
||||
${Else}
|
||||
ReadRegStr $1 HKLM "$0" ""
|
||||
Push $1
|
||||
${GetPathFromRegStr}
|
||||
Pop $R0
|
||||
Push $R0
|
||||
${GetParentDir}
|
||||
Pop $R1
|
||||
${If} $INSTDIR == $R1
|
||||
WriteRegStr HKLM "$0" "" "$R9"
|
||||
Push $R9
|
||||
${GetParentDir}
|
||||
Pop $R1
|
||||
WriteRegStr HKLM "$0" "Path" "$R1"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
; Remove files. If we don't have a log file skip
|
||||
${If} ${FileExists} "$INSTDIR\uninstall\uninstall.log"
|
||||
; Copy the uninstall log file to a temporary file
|
||||
GetTempFileName $TmpVal
|
||||
CopyFiles "$INSTDIR\uninstall\uninstall.log" "$TmpVal"
|
||||
|
||||
; Unregister DLL's
|
||||
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.UnRegDLLsCallback"
|
||||
|
||||
; Delete files
|
||||
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.RemoveFilesCallback"
|
||||
|
||||
; Remove directories we always control
|
||||
RmDir /r "$INSTDIR\uninstall"
|
||||
RmDir /r "$INSTDIR\updates"
|
||||
RmDir /r "$INSTDIR\defaults\shortcuts"
|
||||
|
||||
; Remove empty directories
|
||||
${un.LineFind} "$TmpVal" "/NUL" "1:-1" "un.RemoveDirsCallback"
|
||||
|
||||
; Delete the temporary uninstall log file
|
||||
${DeleteFile} "$TmpVal"
|
||||
|
||||
; Remove the installation directory if it is empty
|
||||
${RemoveDir} "$INSTDIR"
|
||||
${EndIf}
|
||||
|
||||
; Refresh desktop icons otherwise the start menu internet item won't be
|
||||
; removed and other ugly things will happen like recreation of the registry
|
||||
; key by the OS under some conditions.
|
||||
System::Call "shell32::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)"
|
||||
SectionEnd
|
||||
|
||||
################################################################################
|
||||
# Helper Functions
|
||||
|
||||
Function un.RemoveFilesCallback
|
||||
${un.TrimNewLines} "$R9" "$R9"
|
||||
StrCpy $R1 "$R9" 5
|
||||
${If} $R1 == "File:"
|
||||
StrCpy $R9 "$R9" "" 6
|
||||
StrCpy $R0 "$R9" 1
|
||||
; If the path is relative prepend the install directory
|
||||
${If} $R0 == "\"
|
||||
StrCpy $R0 "$INSTDIR$R9"
|
||||
${Else}
|
||||
StrCpy $R0 "$R9"
|
||||
${EndIf}
|
||||
${If} ${FileExists} "$R0"
|
||||
${DeleteFile} "$R0"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
ClearErrors
|
||||
Push 0
|
||||
FunctionEnd
|
||||
|
||||
; Using locate will leave file handles open to some of the directories which
|
||||
; will prevent the deletion of these directories. This parses the uninstall.log
|
||||
; and uses the file entries to find / remove empty directories.
|
||||
Function un.RemoveDirsCallback
|
||||
${un.TrimNewLines} "$R9" "$R9"
|
||||
StrCpy $R1 "$R9" 5
|
||||
${If} $R1 == "File:"
|
||||
StrCpy $R9 "$R9" "" 6
|
||||
StrCpy $R1 "$R9" 1
|
||||
${If} $R1 == "\"
|
||||
StrCpy $R2 "$INSTDIR"
|
||||
StrCpy $R1 "$INSTDIR$R9"
|
||||
${Else}
|
||||
StrCpy $R2 ""
|
||||
StrCpy $R1 "$R9"
|
||||
${EndIf}
|
||||
loop:
|
||||
Push $R1
|
||||
${GetParentDir}
|
||||
Pop $R0
|
||||
GetFullPathName $R1 "$R0"
|
||||
; We only try to remove empty directories but the Desktop, StartMenu, and
|
||||
; QuickLaunch directories can be empty so guard against removing them.
|
||||
${If} "$R2" != "$INSTDIR"
|
||||
SetShellVarContext all
|
||||
${If} $R1 == "$DESKTOP"
|
||||
${OrIf} $R1 == "$STARTMENU"
|
||||
GoTo end
|
||||
${EndIf}
|
||||
SetShellVarContext current
|
||||
${If} $R1 == "$QUICKLAUNCH"
|
||||
${OrIf} $R1 == "$DESKTOP"
|
||||
${OrIf} $R1 == "$STARTMENU"
|
||||
GoTo end
|
||||
${EndIf}
|
||||
${ElseIf} "$R1" == "$INSTDIR"
|
||||
GoTo end
|
||||
${EndIf}
|
||||
${If} ${FileExists} "$R1"
|
||||
RmDir "$R1"
|
||||
${EndIf}
|
||||
${If} ${Errors}
|
||||
${OrIf} "$R2" != "$INSTDIR"
|
||||
GoTo end
|
||||
${EndIf}
|
||||
GoTo loop
|
||||
${EndIf}
|
||||
|
||||
end:
|
||||
ClearErrors
|
||||
Push 0
|
||||
FunctionEnd
|
||||
|
||||
Function un.UnRegDLLsCallback
|
||||
${un.TrimNewLines} "$R9" "$R9"
|
||||
StrCpy $R1 "$R9" 7
|
||||
${If} $R1 == "DLLReg:"
|
||||
StrCpy $R9 "$R9" "" 8
|
||||
StrCpy $R1 "$R9" 1
|
||||
${If} $R1 == "\"
|
||||
StrCpy $R1 "$INSTDIR$R9"
|
||||
${Else}
|
||||
StrCpy $R1 "$R9"
|
||||
${EndIf}
|
||||
UnRegDLL $R1
|
||||
${EndIf}
|
||||
ClearErrors
|
||||
Push 0
|
||||
FunctionEnd
|
||||
|
||||
; Setup the survey controls, functions, etc. except when the application has
|
||||
; defined NO_UNINSTALL_SURVEY
|
||||
!ifndef NO_UNINSTALL_SURVEY
|
||||
Function un.Survey
|
||||
Exec "$\"$TmpVal$\" $\"${SurveyURL}$\""
|
||||
FunctionEnd
|
||||
!endif
|
||||
|
||||
################################################################################
|
||||
# Language
|
||||
|
||||
!insertmacro MOZ_MUI_LANGUAGE 'baseLocale'
|
||||
!verbose push
|
||||
!verbose 3
|
||||
!include "overrideLocale.nsh"
|
||||
!include "customLocale.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 " "
|
||||
|
||||
################################################################################
|
||||
# Page pre and leave functions
|
||||
|
||||
; Checks if the app being uninstalled is running.
|
||||
Function un.preInstFiles
|
||||
; Try to delete the app executable and if we can't delete it try to close the
|
||||
; app. This allows running an instance that is located in another directory.
|
||||
ClearErrors
|
||||
${If} ${FileExists} "$INSTDIR\${FileMainEXE}"
|
||||
${DeleteFile} "$INSTDIR\${FileMainEXE}"
|
||||
${EndIf}
|
||||
${If} ${Errors}
|
||||
ClearErrors
|
||||
${un.CloseApp} "true" $(WARN_APP_RUNNING_UNINSTALL)
|
||||
; Delete the app exe to prevent launching the app while we are uninstalling.
|
||||
${DeleteFile} "$INSTDIR\${FileMainEXE}"
|
||||
ClearErrors
|
||||
${EndIf}
|
||||
FunctionEnd
|
||||
|
||||
; When we add an optional action to the finish page the cancel button is
|
||||
; enabled. This disables it and leaves the finish button as the only choice.
|
||||
Function un.preFinish
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0"
|
||||
|
||||
; Setup the survey controls, functions, etc. except when the application has
|
||||
; defined NO_UNINSTALL_SURVEY
|
||||
!ifdef NO_UNINSTALL_SURVEY
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3"
|
||||
!else
|
||||
StrCpy $TmpVal "SOFTWARE\Microsoft\IE Setup\Setup"
|
||||
ClearErrors
|
||||
ReadRegStr $0 HKLM $TmpVal "Path"
|
||||
${If} ${Errors}
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3"
|
||||
${Else}
|
||||
ExpandEnvStrings $0 "$0" ; this value will usually contain %programfiles%
|
||||
${If} $0 != "\"
|
||||
StrCpy $0 "$0\"
|
||||
${EndIf}
|
||||
StrCpy $0 "$0\iexplore.exe"
|
||||
ClearErrors
|
||||
GetFullPathName $TmpVal $0
|
||||
${If} ${Errors}
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
!endif
|
||||
FunctionEnd
|
||||
|
||||
################################################################################
|
||||
# Initialization Functions
|
||||
|
||||
Function .onInit
|
||||
GetFullPathName $INSTDIR "$EXEDIR\.."
|
||||
${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}"
|
||||
Abort
|
||||
${EndUnless}
|
||||
${GetParameters} $R0
|
||||
|
||||
StrCpy $R1 "Software\Clients\StartMenuInternet\${FileMainEXE}\InstallInfo"
|
||||
SetShellVarContext all ; Set $DESKTOP to All Users
|
||||
|
||||
; Hide icons - initiated from Set Program Access and Defaults
|
||||
${If} $R0 == '/ua "${AppVersion} (${AB_CD})" /hs browser'
|
||||
WriteRegDWORD HKLM $R1 "IconsVisible" 0
|
||||
${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
|
||||
SetShellVarContext current ; Set $DESKTOP to the current user's desktop
|
||||
${EndUnless}
|
||||
|
||||
${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
|
||||
ShellLink::GetShortCutArgs "$DESKTOP\${BrandFullName}.lnk"
|
||||
Pop $0
|
||||
${If} $0 == ""
|
||||
ShellLink::GetShortCutTarget "$DESKTOP\${BrandFullName}.lnk"
|
||||
Pop $0
|
||||
${If} $0 == "$INSTDIR\${FileMainEXE}"
|
||||
Delete "$DESKTOP\${BrandFullName}.lnk"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
|
||||
${If} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk"
|
||||
ShellLink::GetShortCutArgs "$QUICKLAUNCH\${BrandFullName}.lnk"
|
||||
Pop $0
|
||||
${If} $0 == ""
|
||||
ShellLink::GetShortCutTarget "$QUICKLAUNCH\${BrandFullName}.lnk"
|
||||
Pop $0
|
||||
${If} $0 == "$INSTDIR\${FileMainEXE}"
|
||||
Delete "$QUICKLAUNCH\${BrandFullName}.lnk"
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
${EndIf}
|
||||
Abort
|
||||
${EndIf}
|
||||
|
||||
; Show icons - initiated from Set Program Access and Defaults
|
||||
${If} $R0 == '/ua "${AppVersion} (${AB_CD})" /ss browser'
|
||||
WriteRegDWORD HKLM $R1 "IconsVisible" 1
|
||||
${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
|
||||
CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\${FileMainEXE}" 0
|
||||
ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR"
|
||||
${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
|
||||
SetShellVarContext current ; Set $DESKTOP to the current user's desktop
|
||||
${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
|
||||
CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\${FileMainEXE}" 0
|
||||
ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR"
|
||||
${EndUnless}
|
||||
${EndUnless}
|
||||
${EndUnless}
|
||||
${Unless} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk"
|
||||
CreateShortCut "$QUICKLAUNCH\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\${FileMainEXE}" 0
|
||||
ShellLink::SetShortCutWorkingDirectory "$QUICKLAUNCH\${BrandFullName}.lnk" "$INSTDIR"
|
||||
${EndUnless}
|
||||
Abort
|
||||
${EndIf}
|
||||
|
||||
; If we made it this far then this installer is being used as an uninstaller.
|
||||
WriteUninstaller "$EXEDIR\uninstaller.exe"
|
||||
|
||||
${If} $R0 == "/S"
|
||||
StrCpy $TmpVal "$\"$EXEDIR\uninstaller.exe$\" /S"
|
||||
${Else}
|
||||
StrCpy $TmpVal "$\"$EXEDIR\uninstaller.exe$\""
|
||||
${EndIf}
|
||||
|
||||
; When the uninstaller is launched it copies itself to the temp directory so
|
||||
; it won't be in use so it can delete itself.
|
||||
ExecWait $TmpVal
|
||||
${DeleteFile} "$EXEDIR\uninstaller.exe"
|
||||
SetErrorLevel 0
|
||||
Quit
|
||||
FunctionEnd
|
||||
|
||||
Function un.onInit
|
||||
GetFullPathName $INSTDIR "$INSTDIR\.."
|
||||
${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}"
|
||||
Abort
|
||||
${EndUnless}
|
||||
StrCpy $LANGUAGE 0
|
||||
FunctionEnd
|
|
@ -24,6 +24,7 @@ bin\defaults\profile\prefs.js
|
|||
bin\defaults\profile\search.rdf
|
||||
bin\defaults\profile\mimeTypes.rdf
|
||||
bin\defaults\profile\chrome\*
|
||||
bin\uninstall\uninst.exe
|
||||
bin\updater.ini
|
||||
bin\dictionaries\*
|
||||
|
||||
|
@ -329,11 +330,6 @@ bin\chrome\pippki.manifest
|
|||
;
|
||||
bin\updater.exe
|
||||
|
||||
; [Uninstaller]
|
||||
;
|
||||
bin\uninstall\uninstall.exe
|
||||
bin\uninstall\uninstall.ini
|
||||
|
||||
; [Additional Developer Tools]
|
||||
[adt]
|
||||
bin\extensions\inspector@mozilla.org\install.rdf
|
||||
|
|
|
@ -192,12 +192,15 @@ endif
|
|||
mv $(DIST)/xpi-stage/locale-$(AB_CD) l10n-stage/localized
|
||||
$(MAKE) -C ../installer/windows CONFIG_DIR=l10ngen l10ngen/setup.exe l10ngen/7zSD.sfx
|
||||
cp ../installer/windows/l10ngen/setup.exe l10n-stage
|
||||
$(NSINSTALL) -D l10n-stage/localized/uninstall
|
||||
cp ../installer/windows/l10ngen/uninst.exe l10n-stage/localized/uninstall
|
||||
rm -f app.7z
|
||||
cd l10n-stage && \
|
||||
$(CYGWIN_WRAPPER) 7z a -r -t7z ../app.7z -mx -m0=BCJ2 -m1=LZMA:d24 -m2=LZMA:d19 -m3=LZMA:d19 -mb0:1 -mb0s1:2 -mb0s2:3
|
||||
cat ../installer/windows/l10ngen/7zSD.sfx \
|
||||
$(topsrcdir)/browser/installer/windows/app.tag \
|
||||
app.7z > $(WIN32_INSTALLER_OUT)
|
||||
chmod 0755 $(WIN32_INSTALLER_OUT)
|
||||
|
||||
repackage-win32-installer-%: WIN32_INSTALLER_IN=$(_ABS_DIST)/install/sea/$(PKG_BASENAME).installer.exe
|
||||
repackage-win32-installer-%: $(WIN32_INSTALLER_IN)
|
||||
|
@ -226,6 +229,11 @@ repackage-zip: $(ZIP_IN)
|
|||
$(STAGEDIST)/chrome/en-US
|
||||
$(RM) -rf $(DIST)/xpi-stage/locale-$(AB_CD)
|
||||
$(MAKE) libs-$(AB_CD)
|
||||
ifeq (WINNT,$(OS_ARCH))
|
||||
$(RM) -r $(STAGEDIST)/uninstall
|
||||
$(NSINSTALL) -D $(STAGEDIST)/uninstall
|
||||
cp ../installer/windows/l10ngen/uninst.exe $(STAGEDIST)/uninstall
|
||||
endif
|
||||
$(RM) -r $(DIST)/xpi-stage/locale-$(AB_CD)/chrome/$(AB_CD)
|
||||
cd $(DIST)/xpi-stage/locale-$(AB_CD) && \
|
||||
tar $(TAR_CREATE_FLAGS) - * | ( cd $(STAGEDIST) && tar -xf - )
|
||||
|
|
15
configure.in
15
configure.in
|
@ -5726,6 +5726,21 @@ MOZ_ARG_DISABLE_BOOL(installer,
|
|||
[ --disable-installer Disable building of installer],
|
||||
MOZ_INSTALLER=,
|
||||
MOZ_INSTALLER=1 )
|
||||
if test -n "$MOZ_INSTALLER" -a -n "$MOZ_XUL_APP" -a "$OS_ARCH" = "WINNT"; then
|
||||
# Disable installer for Windows builds that use the new toolkit if NSIS
|
||||
# isn't in the path.
|
||||
AC_PATH_PROGS(MAKENSIS, makensis)
|
||||
if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
|
||||
AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
|
||||
fi
|
||||
# The Windows build for NSIS requires the iconv command line utility to
|
||||
# convert the charset of the locale files.
|
||||
AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
|
||||
if test -z "$HOST_ICONV"; then
|
||||
AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
|
||||
fi
|
||||
fi
|
||||
|
||||
# Automatically disable installer if xpinstall isn't built
|
||||
if test -z "$MOZ_XPINSTALL"; then
|
||||
MOZ_INSTALLER=
|
||||
|
|
|
@ -44,15 +44,4 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
DIRS = downloads extensions update xpinstall plugins
|
||||
|
||||
# XXX SUITE doesn't want to build the toolkit installer yet
|
||||
ifndef MOZ_SUITE
|
||||
# The installer is built during the packaging phase, but the uninstaller needs
|
||||
# to be built earlier.
|
||||
ifdef MOZ_INSTALLER
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
DIRS += installer/windows/wizard/uninstall
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -55,8 +55,12 @@ TOOLKIT_NSIS_FILES = \
|
|||
|
||||
$(CONFIG_DIR)/setup.exe::
|
||||
$(INSTALL) $(addprefix $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/,$(TOOLKIT_NSIS_FILES)) $(CONFIG_DIR)
|
||||
$(INSTALL) $(topsrcdir)/toolkit/mozapps/installer/windows/wizard/setuprsc/setup.ico $(CONFIG_DIR)
|
||||
$(INSTALL) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/setup.ico $(CONFIG_DIR)
|
||||
cd $(CONFIG_DIR) && makensis.exe installer.nsi
|
||||
# Support for building the uninstaller when repackaging locales
|
||||
ifeq ($(CONFIG_DIR),l10ngen)
|
||||
cd $(CONFIG_DIR) && makensis.exe uninstaller.nsi
|
||||
endif
|
||||
|
||||
$(CONFIG_DIR)/7zSD.sfx:
|
||||
$(CYGWIN_WRAPPER) upx --best -o $(CONFIG_DIR)/7zSD.sfx $(SFX_MODULE)
|
||||
|
@ -68,3 +72,12 @@ installer::
|
|||
$(NSINSTALL) -D $(DIST)/install/sea
|
||||
cat $(CONFIG_DIR)/7zSD.sfx $(CONFIG_DIR)/app.tag $(CONFIG_DIR)/app.7z > $(DIST)/install/sea/$(PKG_BASENAME).installer.exe
|
||||
chmod 0755 $(DIST)/install/sea/$(PKG_BASENAME).installer.exe
|
||||
|
||||
# For building the uninstaller during the application build so it can be
|
||||
# included for mar file generation.
|
||||
uninstaller::
|
||||
$(INSTALL) $(addprefix $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/,$(TOOLKIT_NSIS_FILES)) $(CONFIG_DIR)
|
||||
$(INSTALL) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/setup.ico $(CONFIG_DIR)
|
||||
cd $(CONFIG_DIR) && makensis.exe uninstaller.nsi
|
||||
$(NSINSTALL) -D $(DIST)/bin/uninstall
|
||||
cp $(CONFIG_DIR)/uninst.exe $(DIST)/bin/uninstall
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 9.9 KiB |
|
@ -55,6 +55,8 @@ const PR_RDONLY = 0x01;
|
|||
const PR_WRONLY = 0x02;
|
||||
const PR_APPEND = 0x10;
|
||||
|
||||
const PERMS_FILE = 0644;
|
||||
|
||||
const nsIWindowsRegKey = Components.interfaces.nsIWindowsRegKey;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -140,10 +142,7 @@ function getLocale() {
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const PREFIX_INSTALLING = "installing: ";
|
||||
const PREFIX_CREATE_FOLDER = "create folder: ";
|
||||
const PREFIX_CREATE_REGISTRY_KEY = "create registry key: ";
|
||||
const PREFIX_STORE_REGISTRY_VALUE_STRING = "store registry value string: ";
|
||||
const PREFIX_FILE = "File: ";
|
||||
|
||||
function InstallLogWriter() {
|
||||
}
|
||||
|
@ -154,34 +153,24 @@ InstallLogWriter.prototype = {
|
|||
* Write a single line to the output stream.
|
||||
*/
|
||||
_writeLine: function(s) {
|
||||
s = s + "\n";
|
||||
s = s + "\r\n";
|
||||
this._outputStream.write(s, s.length);
|
||||
},
|
||||
|
||||
/**
|
||||
* This function creates an empty install wizard log file and returns
|
||||
* a reference to the resulting nsIFile.
|
||||
* This function creates an empty uninstall update log file if it doesn't
|
||||
* exist and returns a reference to the resulting nsIFile.
|
||||
*/
|
||||
_getInstallLogFile: function() {
|
||||
function makeLeafName(index) {
|
||||
return "install_wizard" + index + ".log"
|
||||
}
|
||||
|
||||
_getUninstallLogFile: function() {
|
||||
var file = getFile(KEY_APPDIR);
|
||||
file.append("uninstall");
|
||||
if (!file.exists())
|
||||
return null;
|
||||
|
||||
file.append("x");
|
||||
var n = 0;
|
||||
do {
|
||||
file.leafName = makeLeafName(++n);
|
||||
} while (file.exists());
|
||||
file.append("uninstall.log");
|
||||
if (!file.exists())
|
||||
file.create(Components.interfaces.nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
|
||||
|
||||
if (n == 1)
|
||||
return null; // What, no install wizard log file?
|
||||
|
||||
file.leafName = makeLeafName(n - 1);
|
||||
return file;
|
||||
},
|
||||
|
||||
|
@ -211,34 +200,90 @@ InstallLogWriter.prototype = {
|
|||
* newly added for this update.
|
||||
*/
|
||||
_readUpdateLog: function(logFile, entries) {
|
||||
var appDir = getFile(KEY_APPDIR);
|
||||
var stream;
|
||||
try {
|
||||
stream = openFileInputStream(logFile).
|
||||
QueryInterface(Components.interfaces.nsILineInputStream);
|
||||
|
||||
var dirs = {};
|
||||
var line = {};
|
||||
while (stream.readLine(line)) {
|
||||
var data = line.value.split(" ");
|
||||
if (data[0] == "EXECUTE" && data[1] == "ADD") {
|
||||
var file = getFileRelativeTo(appDir, data[2]);
|
||||
|
||||
// remember all parent directories
|
||||
var parent = file.parent;
|
||||
while (!parent.equals(appDir)) {
|
||||
dirs[parent.path] = true;
|
||||
parent = parent.parent;
|
||||
}
|
||||
|
||||
// remember the file
|
||||
entries.files.push(file.path);
|
||||
// The uninstaller requires the path separator to be "\" and
|
||||
// relative paths to start with a "\".
|
||||
var relPath = "\\" + data[2].replace(/\//g, "\\");
|
||||
entries[relPath] = null;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (stream)
|
||||
stream.close();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Read install_wizard log files to extract information about files that were
|
||||
* previously added by the xpinstall installer and software update.
|
||||
*/
|
||||
_readXPInstallLog: function(logFile, entries) {
|
||||
var stream;
|
||||
try {
|
||||
stream = openFileInputStream(logFile).
|
||||
QueryInterface(Components.interfaces.nsILineInputStream);
|
||||
|
||||
function fixPath(path, offset) {
|
||||
return path.substr(offset).replace(appDirPath, "");
|
||||
}
|
||||
|
||||
var appDir = getFile(KEY_APPDIR);
|
||||
var appDirPath = appDir.path;
|
||||
var line = {};
|
||||
while (stream.readLine(line)) {
|
||||
var entry = line.value;
|
||||
// This works with both the entries from xpinstall (e.g. Installing: )
|
||||
// and from update (e.g. installing: )
|
||||
var searchStr = "nstalling: ";
|
||||
var index = entry.indexOf(searchStr);
|
||||
if (index != -1) {
|
||||
entries[fixPath(entry, index + searchStr.length)] = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
searchStr = "Replacing: ";
|
||||
index = entry.indexOf(searchStr);
|
||||
if (index != -1) {
|
||||
entries[fixPath(entry, index + searchStr.length)] = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
searchStr = "Windows Shortcut: ";
|
||||
index = entry.indexOf(searchStr);
|
||||
if (index != -1) {
|
||||
entries[fixPath(entry + ".lnk", index + searchStr.length)] = null;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (stream)
|
||||
stream.close();
|
||||
}
|
||||
},
|
||||
|
||||
_readUninstallLog: function(logFile, entries) {
|
||||
var stream;
|
||||
try {
|
||||
stream = openFileInputStream(logFile).
|
||||
QueryInterface(Components.interfaces.nsILineInputStream);
|
||||
|
||||
var line = {};
|
||||
var searchStr = "File: ";
|
||||
while (stream.readLine(line)) {
|
||||
var index = line.value.indexOf(searchStr);
|
||||
if (index != -1) {
|
||||
var str = line.value.substr(index + searchStr.length);
|
||||
entries.push(str);
|
||||
}
|
||||
}
|
||||
for (var d in dirs)
|
||||
entries.dirs.push(d);
|
||||
// Sort the directories so that subdirectories are deleted first.
|
||||
entries.dirs.sort();
|
||||
} finally {
|
||||
if (stream)
|
||||
stream.close();
|
||||
|
@ -247,47 +292,59 @@ InstallLogWriter.prototype = {
|
|||
|
||||
/**
|
||||
* This function initializes the log writer and is responsible for
|
||||
* translating 'update.log' to the install wizard format.
|
||||
* translating 'update.log' and the 'install_wizard' logs to the NSIS format.
|
||||
*/
|
||||
begin: function() {
|
||||
var installLog = this._getInstallLogFile();
|
||||
var updateLog = this._getUpdateLogFile();
|
||||
if (!installLog || !updateLog)
|
||||
if (!updateLog)
|
||||
return;
|
||||
|
||||
var entries = { dirs: [], files: [] };
|
||||
this._readUpdateLog(updateLog, entries);
|
||||
var newEntries = { };
|
||||
this._readUpdateLog(updateLog, newEntries);
|
||||
|
||||
try {
|
||||
const nsIDirectoryEnumerator = Components.interfaces.nsIDirectoryEnumerator;
|
||||
const nsILocalFile = Components.interfaces.nsILocalFile;
|
||||
var prefixWizLog = "install_wizard";
|
||||
var uninstallDir = getFile(KEY_APPDIR);
|
||||
uninstallDir.append("uninstall");
|
||||
var entries = uninstallDir.directoryEntries.QueryInterface(nsIDirectoryEnumerator);
|
||||
while (true) {
|
||||
var wizLog = entries.nextFile;
|
||||
if (!wizLog)
|
||||
break;
|
||||
if (wizLog instanceof nsILocalFile && !wizLog.isDirectory() &&
|
||||
wizLog.leafName.indexOf(prefixWizLog) == 0) {
|
||||
this._readXPInstallLog(wizLog, newEntries);
|
||||
wizLog.remove(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {}
|
||||
if (entries)
|
||||
entries.close();
|
||||
|
||||
var uninstallLog = this._getUninstallLogFile();
|
||||
var oldEntries = [];
|
||||
this._readUninstallLog(uninstallLog, oldEntries);
|
||||
|
||||
// Prevent writing duplicate entries in the log file
|
||||
for (var relPath in newEntries) {
|
||||
if (oldEntries.indexOf(relPath) != -1)
|
||||
delete newEntries[relPath];
|
||||
}
|
||||
|
||||
if (newEntries.length == 0)
|
||||
return;
|
||||
|
||||
this._outputStream =
|
||||
openFileOutputStream(installLog, PR_WRONLY | PR_APPEND);
|
||||
this._writeLine("\nUPDATE [" + new Date().toUTCString() + "]");
|
||||
openFileOutputStream(uninstallLog, PR_WRONLY | PR_APPEND);
|
||||
|
||||
var i;
|
||||
// The log file is processed in reverse order, so list directories before
|
||||
// files to ensure that the directories will be deleted.
|
||||
for (i = 0; i < entries.dirs.length; ++i)
|
||||
this._writeLine(PREFIX_CREATE_FOLDER + entries.dirs[i]);
|
||||
for (i = 0; i < entries.files.length; ++i)
|
||||
this._writeLine(PREFIX_INSTALLING + entries.files[i]);
|
||||
},
|
||||
|
||||
/**
|
||||
* This function records the creation of a registry key.
|
||||
*/
|
||||
registryKeyCreated: function(keyPath) {
|
||||
if (!this._outputStream)
|
||||
return;
|
||||
this._writeLine(PREFIX_CREATE_REGISTRY_KEY + keyPath + " []");
|
||||
},
|
||||
|
||||
/**
|
||||
* This function records the creation of a registry key value.
|
||||
*/
|
||||
registryKeyValueSet: function(keyPath, valueName) {
|
||||
if (!this._outputStream)
|
||||
return;
|
||||
this._writeLine(
|
||||
PREFIX_STORE_REGISTRY_VALUE_STRING + keyPath + " [" + valueName + "]");
|
||||
// The NSIS uninstaller deletes all directories where the installer has
|
||||
// added a file if the directory is empty after the files have been removed
|
||||
// so there is no need to log directories.
|
||||
for (var relPath in newEntries)
|
||||
this._writeLine(PREFIX_FILE + relPath);
|
||||
},
|
||||
|
||||
end: function() {
|
||||
|
@ -350,8 +407,6 @@ RegKey.prototype = {
|
|||
createChild: function(path, mode) {
|
||||
var child = this._key.createChild(path, mode);
|
||||
var key = new RegKey(child, this._root, this._path + "\\" + path);
|
||||
if (installLogWriter)
|
||||
installLogWriter.registryKeyCreated(key.toString());
|
||||
return key;
|
||||
},
|
||||
|
||||
|
@ -361,14 +416,10 @@ RegKey.prototype = {
|
|||
|
||||
writeStringValue: function(name, value) {
|
||||
this._key.writeStringValue(name, value);
|
||||
if (installLogWriter)
|
||||
installLogWriter.registryKeyValueSet(this.toString(), name);
|
||||
},
|
||||
|
||||
writeIntValue: function(name, value) {
|
||||
this._key.writeIntValue(name, value);
|
||||
if (installLogWriter)
|
||||
installLogWriter.registryKeyValueSet(this.toString(), name);
|
||||
},
|
||||
|
||||
hasValue: function(name) {
|
||||
|
@ -594,19 +645,36 @@ function updateRegistry(rootKey) {
|
|||
try {
|
||||
key.open(rootKey, "SOFTWARE\\" + vendorShortName, key.ACCESS_READ);
|
||||
oldInstall = locateOldInstall(key, ourInstallDir);
|
||||
} finally {
|
||||
key.close();
|
||||
}
|
||||
} catch (e) {}
|
||||
key.close();
|
||||
|
||||
if (!oldInstall) {
|
||||
LOG("no existing registry keys found");
|
||||
return;
|
||||
}
|
||||
|
||||
const uninstallRoot =
|
||||
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
|
||||
// Maybe nothing needs to be changed...
|
||||
if (oldInstall.fullName == brandFullName &&
|
||||
oldInstall.version == app.version) {
|
||||
LOG("registry is up-to-date");
|
||||
var uninst = getFile(KEY_APPDIR);
|
||||
uninst.append("uninstall");
|
||||
uninst.append("uninst.exe");
|
||||
var uninstString = uninst.path;
|
||||
nameWithVersion = oldInstall.fullName + " (" + oldInstall.version + ")";
|
||||
try {
|
||||
key.open(rootKey, uninstallRoot, key.ACCESS_READ);
|
||||
var regUninstString = key.readStringValue("UninstallString");
|
||||
if (regUninstString != uninstString) {
|
||||
LOG("\n\nupdating UninstallString registry value\n\n");
|
||||
createRegistryKeys(key, { name: nameWithVersion,
|
||||
values: ["UninstallString", uninstString] });
|
||||
} else {
|
||||
LOG("registry is up-to-date");
|
||||
}
|
||||
} catch (e) {}
|
||||
key.close();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -614,9 +682,8 @@ function updateRegistry(rootKey) {
|
|||
try {
|
||||
key.open(rootKey, "SOFTWARE\\" + vendorShortName, key.ACCESS_READ);
|
||||
deleteOldRegKeys(key, oldInstall);
|
||||
} finally {
|
||||
key.close();
|
||||
}
|
||||
} catch (e) {}
|
||||
key.close();
|
||||
|
||||
// Create the new keys:
|
||||
|
||||
|
@ -689,25 +756,19 @@ function updateRegistry(rootKey) {
|
|||
try {
|
||||
key.open(rootKey, "SOFTWARE", key.ACCESS_READ);
|
||||
createRegistryKeys(key, Key_brand);
|
||||
} finally {
|
||||
key.close();
|
||||
}
|
||||
} catch (e) {}
|
||||
key.close();
|
||||
|
||||
if (rootKey != RegKey.prototype.ROOT_KEY_LOCAL_MACHINE)
|
||||
return;
|
||||
|
||||
// Now, do the same thing for the Add/Remove Programs control panel:
|
||||
|
||||
const uninstallRoot =
|
||||
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall";
|
||||
|
||||
try {
|
||||
key.open(rootKey, uninstallRoot, key.ACCESS_READ);
|
||||
var oldName = oldInstall.fullName + " (" + oldInstall.version + ")";
|
||||
deleteRegistryKey(key, oldName, false);
|
||||
} finally {
|
||||
key.close();
|
||||
}
|
||||
} catch (e) {}
|
||||
key.close();
|
||||
|
||||
var uninstallBundle = sbs.createBundle(URI_UNINSTALL_PROPERTIES);
|
||||
|
||||
|
@ -715,10 +776,8 @@ function updateRegistry(rootKey) {
|
|||
|
||||
var uninstaller = getFile(KEY_APPDIR);
|
||||
uninstaller.append("uninstall");
|
||||
uninstaller.append("uninstall.exe");
|
||||
|
||||
var uninstallString =
|
||||
uninstaller.path + " /ua \"" + versionWithLocale + "\"";
|
||||
uninstaller.append("uninst.exe");
|
||||
var uninstallString = uninstaller.path;
|
||||
|
||||
Key_uninstall = {
|
||||
name: nameWithVersion,
|
||||
|
@ -744,11 +803,10 @@ function updateRegistry(rootKey) {
|
|||
child = key.openChild(nameWithVersion, key.ACCESS_WRITE);
|
||||
child.writeIntValue("NoModify", 1);
|
||||
child.writeIntValue("NoRepair", 1);
|
||||
} finally {
|
||||
if (child)
|
||||
child.close();
|
||||
key.close();
|
||||
}
|
||||
} catch (e) {}
|
||||
if (child)
|
||||
child.close();
|
||||
key.close();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
Загрузка…
Ссылка в новой задаче