Bug 1558320 - Stop checking the architecture of any existing installation that we find to replace. r=agashlin

Differential Revision: https://phabricator.services.mozilla.com/D34571

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matt Howell 2019-07-02 17:22:46 +00:00
parent f17e16215c
commit 6bc224f62c
2 changed files with 16 additions and 94 deletions

View File

@ -362,46 +362,12 @@ Function .onInit
${If} "$R9" == "false"
SetShellVarContext current ; Set SHCTX to HKCU
${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
${If} ${IsNativeAMD64}
${OrIf} ${IsNativeARM64}
; In HKCU there is no WOW64 redirection, which means we may have gotten
; the path to a 32-bit install even though we're 64-bit.
; In that case, just use the default path instead of offering an upgrade.
; But only do that override if the existing install is in Program Files,
; because that's the only place we can be sure is specific
; to either 32 or 64 bit applications.
; The WordFind syntax below searches for the first occurence of the
; "delimiter" (the Program Files path) in the install path and returns
; anything that appears before that. If nothing appears before that,
; then the install is under Program Files.
${WordFind} $R9 $PROGRAMFILES32 "+1{" $0
${If} $0 == ""
StrCpy $R9 "false"
${EndIf}
${EndIf}
${EndIf}
StrCpy $PreviousInstallDir ""
${If} "$R9" != "false"
; Don't override the default install path with an existing installation
; of a different architecture.
StrCpy $0 $R9
Call GetExistingInstallArch
${If} $0 == ${ARCH_X86}
${AndIf} $ArchToInstall == ${ARCH_X86}
StrCpy $PreviousInstallDir "$R9"
StrCpy $INSTDIR "$PreviousInstallDir"
${ElseIf} $0 == ${ARCH_AMD64}
${AndIf} $ArchToInstall == ${ARCH_AMD64}
StrCpy $PreviousInstallDir "$R9"
StrCpy $INSTDIR "$PreviousInstallDir"
${ElseIf} $0 == ${ARCH_AARCH64}
${AndIf} $ArchToInstall == ${ARCH_AARCH64}
StrCpy $PreviousInstallDir "$R9"
StrCpy $INSTDIR "$PreviousInstallDir"
${EndIf}
StrCpy $PreviousInstallDir "$R9"
StrCpy $INSTDIR "$PreviousInstallDir"
${EndIf}
; Used to determine if the default installation directory was used.
@ -2128,42 +2094,6 @@ Function GetLatestReleasedVersion
Pop $0
FunctionEnd
Function GetExistingInstallArch
StrCpy $0 "unknown"
ClearErrors
FileOpen $R1 "$0\install.log" r
${If} ${Errors}
Return
${EndIf}
${Do}
ClearErrors
FileReadUTF16LE $R1 $R2
${If} ${Errors}
${Break}
${EndIf}
ClearErrors
${WordFind} "$R2" "Target CPU : " "E+1}" $R3
${If} ${Errors}
${Continue}
${EndIf}
${TrimNewLines} "$R3" $R3
${If} $R3 == "x86"
StrCpy $0 ${ARCH_X86}
${ElseIf} $R3 == "x64"
StrCpy $0 ${ARCH_AMD64}
${ElseIf} $R3 == "AArch64"
StrCpy $0 ${ARCH_AARCH64}
${EndIf}
${Break}
${Loop}
FileClose $R1
FunctionEnd
; Determine which architecture build we should download and install.
; AArch64 is always selected if it's the native architecture of the machine.
; Otherwise, we check a few things to determine if AMD64 is appropriate:

View File

@ -5838,37 +5838,29 @@ end:
Function LeaveOptionsCommon
Push $R9
StrCpy $R9 "false"
!ifndef NO_INSTDIR_FROM_REG
SetShellVarContext all ; Set SHCTX to HKLM
${If} ${IsNativeAMD64}
${OrIf} ${IsNativeARM64}
SetRegView 64
${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
SetRegView lastused
${EndIf}
StrCmp "$R9" "false" +1 finish_get_install_dir
SetRegView 32
${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
SetRegView lastused
StrCmp "$R9" "false" +1 finish_get_install_dir
SetShellVarContext current ; Set SHCTX to HKCU
${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
${If} ${RunningX64}
${OrIf} ${IsNativeARM64}
; In HKCU there is no WOW64 redirection, which means we may have gotten
; the path to a 32-bit install even though we're 64-bit, or vice-versa.
; In that case, just use the default path instead of offering an upgrade.
; But only do that override if the existing install is in Program Files,
; because that's the only place we can be sure is specific
; to either 32 or 64 bit applications.
; The WordFind syntax below searches for the first occurence of the
; "delimiter" (the Program Files path) in the install path and returns
; anything that appears before that. If nothing appears before that,
; then the install is under Program Files (32 or 64).
!ifdef HAVE_64BIT_BUILD
${WordFind} $R9 $PROGRAMFILES32 "+1{" $0
!else
${WordFind} $R9 $PROGRAMFILES64 "+1{" $0
!endif
${If} $0 == ""
StrCpy $R9 "false"
${EndIf}
${EndIf}
finish_get_install_dir:
StrCmp "$R9" "false" +2 +1
StrCpy $INSTDIR "$R9"