Bug 367539 (Thunderbird patch) - When upgrading an existing install use the uninstall.log to uninstall the previous version before install. r=philringnalda
authorRobert Strong <robert.bugzilla@gmail.com>
Tue, 22 Jun 2010 19:11:28 -0700
changeset 5881 73d458b52ccb60b103264717682d59176070a5f6
parent 5880 2671e8da40f328a5d0cca137f2ddb831965c1cee
child 5882 a13135d70f1ba0be18937c9ffb65deb1fbd79be5
child 5885 5501be63c45f9ca7b71ca7e83c62329bd93fd8c9
push id4554
push userrstrong@mozilla.com
push dateWed, 23 Jun 2010 02:11:34 +0000
treeherdercomm-central@73d458b52ccb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersphilringnalda
bugs367539
Bug 367539 (Thunderbird patch) - When upgrading an existing install use the uninstall.log to uninstall the previous version before install. r=philringnalda
mail/installer/windows/Makefile.in
mail/installer/windows/nsis/installer.nsi
--- a/mail/installer/windows/Makefile.in
+++ b/mail/installer/windows/Makefile.in
@@ -126,20 +126,16 @@ uninstaller::
 	done
 	$(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR)
 	for i in $(BRANDING_FILES_CONV); do \
 	  iconv -f UTF-8 -t UTF-16LE $(DIST)/branding/$$i | \
 	    cat $(MOZILLA_SRCDIR)/toolkit/mozapps/installer/windows/nsis/utf16-le-bom.bin - > \
 	    $(CONFIG_DIR)/$$i; \
 	done
 	$(INSTALL) $(addprefix $(DIST)/branding/,$(BRANDING_FILES)) $(CONFIG_DIR)
-ifeq ($(CONFIG_DIR),instgen)
-	$(PERL) $(MOZILLA_SRCDIR)/toolkit/mozapps/installer/windows/nsis/make-installremoves.pl \
-	  ../removed-files > $(CONFIG_DIR)/removed-files.log
-endif
 	$(PYTHON) $(MOZILLA_SRCDIR)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) \
 	  $(srcdir)/nsis/defines.nsi.in | iconv -f UTF-8 -t UTF-16LE | \
 	  cat $(MOZILLA_SRCDIR)/toolkit/mozapps/installer/windows/nsis/utf16-le-bom.bin - > \
 	  $(CONFIG_DIR)/defines.nsi
 	$(PERL) $(MOZILLA_SRCDIR)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.pl \
 	  $(MOZILLA_SRCDIR) $(call EXPAND_LOCALE_SRCDIR,mail/locales)/installer $(AB_CD) \
 	  $(CONFIG_DIR)
 
--- a/mail/installer/windows/nsis/installer.nsi
+++ b/mail/installer/windows/nsis/installer.nsi
@@ -60,20 +60,16 @@ Var AddStartMenuSC
 Var AddQuickLaunchSC
 Var AddDesktopSC
 Var PageName
 
 ; On Vista and above attempt to elevate Standard Users in addition to users that
 ; are a member of the Administrators group.
 !define NONADMIN_ELEVATE
 
-; Don't use the PreDirectoryCommon macro's code for finding a pre-existing
-; installation directory.
-!define NO_INSTDIR_PREDIRCOMMON
-
 ; Disabled until a survey url is provided
 !define AbortSurveyURL "http://live.mozillamessaging.com/survey/cancel/?page="
 
 ; Other included files may depend upon these includes!
 ; The following includes are provided by NSIS.
 !include FileFunc.nsh
 !include LogicLib.nsh
 !include MUI.nsh
@@ -98,25 +94,23 @@ VIAddVersionKey "OriginalFilename" "setu
 
 ; Must be inserted before other macros that use logging
 !insertmacro _LoggingCommon
 
 ; Most commonly used macros for managing shortcuts
 !insertmacro _LoggingShortcutsCommon
 
 !insertmacro AddHandlerValues
-!insertmacro CanWriteToInstallDir
 !insertmacro ChangeMUIHeaderImage
 !insertmacro CheckForFilesInUse
 !insertmacro CleanUpdatesDir
 !insertmacro CopyFilesFromDir
 !insertmacro FindSMProgramsDir
 !insertmacro GetPathFromString
 !insertmacro GetParent
-!insertmacro GetSingleInstallPath
 !insertmacro IsHandlerForInstallDir
 !insertmacro ManualCloseAppPrompt
 !insertmacro RegCleanMain
 !insertmacro RegCleanUninstall
 !insertmacro SetBrandNameVars
 !insertmacro UnloadUAC
 !insertmacro WriteRegStr2
 !insertmacro WriteRegDWORD2
@@ -124,16 +118,17 @@ VIAddVersionKey "OriginalFilename" "setu
 !include shared.nsh
 
 ; Helper macros for ui callbacks. Insert these after shared.nsh
 !insertmacro CheckCustomCommon
 !insertmacro InstallEndCleanupCommon
 !insertmacro InstallOnInitCommon
 !insertmacro InstallStartCleanupCommon
 !insertmacro LeaveDirectoryCommon
+!insertmacro LeaveOptionsCommon
 !insertmacro OnEndCommon
 !insertmacro PreDirectoryCommon
 
 Name "${BrandFullName}"
 OutFile "setup.exe"
 InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${AppVersion})" "InstallLocation"
 InstallDir "$PROGRAMFILES\${BrandFullName}\"
 ShowInstDetails nevershow
@@ -477,18 +472,16 @@ Section "-InstallEndCleanup"
         Call SetAsDefaultMailAppUserHKCU
       ${Else}
         GetFunctionAddress $0 SetAsDefaultMailAppUserHKCU
         UAC::ExecCodeSegment $0
       ${EndIf}
     ${EndIf}
   ${EndUnless}
 
-  ${LogHeader} "Updating Uninstall Log With Previous Uninstall Log"
-
   ; Refresh desktop icons
   System::Call "shell32::SHChangeNotify(i, i, i, i) v (0x08000000, 0, 0, 0)"
 
   ${InstallEndCleanupCommon}
 
   ${If} ${RebootFlag}
     ; If we have to reboot give SHChangeNotify time to finish refreshing
     ; the icons so the OS doesn't display the icons from helper.exe
@@ -713,60 +706,33 @@ Function leaveOptions
   ${EndIf}
   ${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 2" "State"
   StrCmp $R0 "1" +1 +2
   StrCpy $InstallType ${INSTALLTYPE_BASIC}
   ${MUI_INSTALLOPTIONS_READ} $R0 "options.ini" "Field 3" "State"
   StrCmp $R0 "1" +1 +2
   StrCpy $InstallType ${INSTALLTYPE_CUSTOM}
 
-!ifndef NO_INSTDIR_FROM_REG
-  SetShellVarContext all      ; Set SHCTX to HKLM
-  ${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
-
-  StrCmp "$R9" "false" +1 fix_install_dir
-
-  SetShellVarContext current  ; Set SHCTX to HKCU
-  ${GetSingleInstallPath} "Software\Mozilla\${BrandFullNameInternal}" $R9
-
-  fix_install_dir:
-  StrCmp "$R9" "false" +2 +1
-  StrCpy $INSTDIR "$R9"
-!endif
+  ${LeaveOptionsCommon}
 
-  ; If the user doesn't have write access to the installation directory set
-  ; the installation directory to a subdirectory of the All Users application
-  ; directory and if the user can't write to that location set the installation
-  ; directory to a subdirectory of the users local application directory
-  ; (e.g. non-roaming).
-  ${CanWriteToInstallDir} $R8
-  ${If} "$R8" == "false"
-    SetShellVarContext all      ; Set SHCTX to All Users
-    StrCpy $INSTDIR "$APPDATA\${BrandFullName}\"
-    ${If} ${FileExists} "$INSTDIR"
-      ; Always display the long path if the path already exists.
-      ${GetLongPath} "$INSTDIR" $INSTDIR
-    ${EndIf}
-    ${CanWriteToInstallDir} $R8
-    ${If} "$R8" == "false"
-      StrCpy $INSTDIR "$LOCALAPPDATA\${BrandFullName}\"
-    ${EndIf}
+  ${If} $InstallType == ${INSTALLTYPE_BASIC}
+    Call CheckExistingInstall
   ${EndIf}
 FunctionEnd
 
 Function preDirectory
   StrCpy $PageName "Directory"
   ${PreDirectoryCommon}
 FunctionEnd
 
 Function leaveDirectory
-  ${LeaveDirectoryCommon} "$(WARN_DISK_SPACE)" "$(WARN_WRITE_ACCESS)"
-  ${If} $InstallType != ${INSTALLTYPE_CUSTOM}
+  ${If} $InstallType == ${INSTALLTYPE_BASIC}
     Call CheckExistingInstall
   ${EndIf}
+  ${LeaveDirectoryCommon} "$(WARN_DISK_SPACE)" "$(WARN_WRITE_ACCESS)"
 FunctionEnd
 
 Function preShortcuts
   StrCpy $PageName "Shortcuts"
   ${CheckCustomCommon}
   !insertmacro MUI_HEADER_TEXT "$(SHORTCUTS_PAGE_TITLE)" "$(SHORTCUTS_PAGE_SUBTITLE)"
   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "shortcuts.ini"
 FunctionEnd
@@ -774,16 +740,23 @@ 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"
+
+  ; If Start Menu shortcuts won't be created call CheckExistingInstall here
+  ; since leaveStartMenu will not be called.
+  ${If} $AddStartMenuSC != 1
+  ${AndIf} $InstallType == ${INSTALLTYPE_CUSTOM}
+    Call CheckExistingInstall
+  ${EndIf}
 FunctionEnd
 
 Function preStartMenu
   StrCpy $PageName "StartMenu"
   ; With the Unicode installer the path to the application's Start Menu
   ; directory relative to the Start Menu's Programs directory is written to the
   ; shortcuts log ini file and is used to set the default Start Menu directory.
   ${GetSMProgramsDirRelPath} $0