Remove conditional MOZ_MAINTENANCE_SERVICE code

Tag #145
This commit is contained in:
wolfbeast
2019-02-20 10:54:51 +01:00
parent 833be88a6d
commit fc0a0f13ad
30 changed files with 1 additions and 1420 deletions
-3
View File
@@ -10,7 +10,4 @@ ifdef MAKENSISU
# uninstaller is included with the application for mar file generation.
libs::
$(MAKE) -C installer/windows uninstaller
ifdef MOZ_MAINTENANCE_SERVICE
$(MAKE) -C installer/windows maintenanceservice_installer
endif
endif
@@ -153,11 +153,6 @@ pref("app.update.url", "https://aus5.mozilla.org/update/6/%PRODUCT%/%VERSION%/%B
// Show the Update Checking/Ready UI when the user was idle for x seconds
pref("app.update.idletime", 60);
// Whether or not to attempt using the service for updates.
#ifdef MOZ_MAINTENANCE_SERVICE
pref("app.update.service.enabled", true);
#endif
// Symmetric (can be overridden by individual extensions) update preferences.
// e.g.
// extensions.{GUID}.update.enabled
@@ -670,25 +670,6 @@ var gAdvancedPane = {
// or the binary platform or OS version is not known.
// A locked pref is sufficient to disable the radiogroup.
radiogroup.disabled = !canCheck || enabledPref.locked || autoPref.locked;
if (AppConstants.MOZ_MAINTENANCE_SERVICE) {
// Check to see if the maintenance service is installed.
// If it is don't show the preference at all.
var installed;
try {
var wrk = Components.classes["@mozilla.org/windows-registry-key;1"]
.createInstance(Components.interfaces.nsIWindowsRegKey);
wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
"SOFTWARE\\Mozilla\\MaintenanceService",
wrk.ACCESS_READ | wrk.WOW64_64);
installed = wrk.readIntValue("Installed");
wrk.close();
} catch (e) {
}
if (installed != 1) {
document.getElementById("useService").hidden = true;
}
}
}
},
@@ -79,12 +79,6 @@
<preference id="app.update.disable_button.showUpdateHistory"
name="app.update.disable_button.showUpdateHistory"
type="bool"/>
#ifdef MOZ_MAINTENANCE_SERVICE
<preference id="app.update.service.enabled"
name="app.update.service.enabled"
type="bool"/>
#endif
#endif
<preference id="browser.search.update"
@@ -331,13 +325,6 @@
accesskey="&updateHistory.accesskey;"
preference="app.update.disable_button.showUpdateHistory"/>
</hbox>
#ifdef MOZ_MAINTENANCE_SERVICE
<checkbox id="useService"
label="&useService.label;"
accesskey="&useService.accesskey;"
preference="app.update.service.enabled"/>
#endif
</groupbox>
#endif
<groupbox id="updateOthers" align="start">
-4
View File
@@ -15,10 +15,6 @@ if test "$OS_ARCH" = "WINNT" -o \
MOZ_BUNDLED_FONTS=1
fi
if test "$OS_ARCH" = "WINNT"; then
MOZ_MAINTENANCE_SERVICE=
fi
# For Basilisk we want to use 52.9.YYYY.MM.DD as MOZ_APP_VERSION in release
# builds so add-on developers have something to target while maintaining
# Firefox compatiblity.
@@ -726,13 +726,6 @@ bin/libfreebl_32int64_3.so
#endif
#endif
; [MaintenanceService]
;
#ifdef MOZ_MAINTENANCE_SERVICE
@BINPATH@/maintenanceservice.exe
@BINPATH@/maintenanceservice_installer.exe
#endif
@RESPATH@/components/dom_audiochannel.xpt
; Shutdown Terminator
@@ -14,12 +14,6 @@ INSTALLER_FILES = \
nsis/shared.nsh \
$(NULL)
ifdef MOZ_MAINTENANCE_SERVICE
INSTALLER_FILES += \
nsis/maintenanceservice_installer.nsi \
$(NULL)
endif
BRANDING_FILES = \
branding.nsi \
appname.bmp \
@@ -51,10 +51,6 @@
!define MinSupportedCPU "SSE2"
#ifdef MOZ_MAINTENANCE_SERVICE
!define MOZ_MAINTENANCE_SERVICE
#endif
# File details shared by both the installer and uninstaller
VIProductVersion "1.0.0.0"
VIAddVersionKey "ProductName" "${BrandShortName}"
@@ -165,11 +165,6 @@ Page custom preOptions leaveOptions
!define MUI_DIRECTORYPAGE_VERIFYONLEAVE
!insertmacro MUI_PAGE_DIRECTORY
; Custom Components Page
!ifdef MOZ_MAINTENANCE_SERVICE
Page custom preComponents leaveComponents
!endif
; Custom Shortcuts Page
Page custom preShortcuts leaveShortcuts
@@ -427,41 +422,6 @@ Section "-Application" APP_IDX
${EndIf}
${EndIf}
!ifdef MOZ_MAINTENANCE_SERVICE
; If the maintenance service page was displayed then a value was already
; explicitly selected for installing the maintenance service and
; and so InstallMaintenanceService will already be 0 or 1.
; If the maintenance service page was not displayed then
; InstallMaintenanceService will be equal to "".
${If} $InstallMaintenanceService == ""
Call IsUserAdmin
Pop $R0
${If} $R0 == "true"
; Only proceed if we have HKLM write access
${AndIf} $TmpVal == "HKLM"
; On Windows < XP SP3 we do not install the maintenance service.
${If} ${IsWinXP}
${AndIf} ${AtMostServicePack} 2
StrCpy $InstallMaintenanceService "0"
${Else}
; The user is an admin, so we should default to installing the service.
StrCpy $InstallMaintenanceService "1"
${EndIf}
${Else}
; The user is not admin, so we can't install the service.
StrCpy $InstallMaintenanceService "0"
${EndIf}
${EndIf}
${If} $InstallMaintenanceService == "1"
; The user wants to install the maintenance service, so execute
; the pre-packaged maintenance service installer.
; This option can only be turned on if the user is an admin so there
; is no need to use ExecShell w/ verb runas to enforce elevated.
nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\""
${EndIf}
!endif
; These need special handling on uninstall since they may be overwritten by
; an install into a different location.
StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}"
@@ -578,13 +538,6 @@ Section "-Application" APP_IDX
${EndIf}
${EndUnless}
${EndIf}
!ifdef MOZ_MAINTENANCE_SERVICE
${If} $TmpVal == "HKLM"
; Add the registry keys for allowed certificates.
${AddMaintCertKeys}
${EndIf}
!endif
SectionEnd
; Cleanup operations to perform at the end of the installation.
@@ -948,59 +901,6 @@ Function leaveShortcuts
${EndIf}
FunctionEnd
!ifdef MOZ_MAINTENANCE_SERVICE
Function preComponents
; If the service already exists, don't show this page
ServicesHelper::IsInstalled "MozillaMaintenance"
Pop $R9
${If} $R9 == 1
; The service already exists so don't show this page.
Abort
${EndIf}
; On Windows < XP SP3 we do not install the maintenance service.
${If} ${IsWinXP}
${AndIf} ${AtMostServicePack} 2
Abort
${EndIf}
; Don't show the custom components page if the
; user is not an admin
Call IsUserAdmin
Pop $R9
${If} $R9 != "true"
Abort
${EndIf}
; Only show the maintenance service page if we have write access to HKLM
ClearErrors
WriteRegStr HKLM "Software\Mozilla" \
"${BrandShortName}InstallerTest" "Write Test"
${If} ${Errors}
ClearErrors
Abort
${Else}
DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
${EndIf}
StrCpy $PageName "Components"
${CheckCustomCommon}
!insertmacro MUI_HEADER_TEXT "$(COMPONENTS_PAGE_TITLE)" "$(COMPONENTS_PAGE_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "components.ini"
FunctionEnd
Function leaveComponents
${MUI_INSTALLOPTIONS_READ} $0 "components.ini" "Settings" "State"
${If} $0 != 0
Abort
${EndIf}
${MUI_INSTALLOPTIONS_READ} $InstallMaintenanceService "components.ini" "Field 2" "State"
${If} $InstallType == ${INSTALLTYPE_CUSTOM}
Call CheckExistingInstall
${EndIf}
FunctionEnd
!endif
Function preSummary
StrCpy $PageName "Summary"
; Setup the summary.ini file for the Custom Summary Page
@@ -1,332 +0,0 @@
# 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/.
; 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
RequestExecutionLevel admin
; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can
; be removed after we require NSIS 3.0a2 or greater.
!ifdef NSIS_PACKEDVERSION
Unicode true
ManifestSupportedOS all
ManifestDPIAware true
!endif
!addplugindir ./
; Variables
Var TempMaintServiceName
Var BrandFullNameDA
Var BrandFullName
; Other included files may depend upon these includes!
; The following includes are provided by NSIS.
!include FileFunc.nsh
!include LogicLib.nsh
!include MUI.nsh
!include WinMessages.nsh
!include WinVer.nsh
!include WordFunc.nsh
!insertmacro GetOptions
!insertmacro GetParameters
!insertmacro GetSize
; The test slaves use this fallback key to run tests.
; And anyone that wants to run tests themselves should already have
; this installed.
!define FallbackKey \
"SOFTWARE\Mozilla\MaintenanceService\3932ecacee736d366d6436db0f55bce4"
!define CompanyName "Mozilla Corporation"
!define BrandFullNameInternal ""
; The following includes are custom.
!include defines.nsi
; We keep defines.nsi defined so that we get other things like
; the version number, but we redefine BrandFullName
!define MaintFullName "Mozilla Maintenance Service"
!undef BrandFullName
!define BrandFullName "${MaintFullName}"
!include common.nsh
!include locales.nsi
VIAddVersionKey "FileDescription" "${MaintFullName} Installer"
VIAddVersionKey "OriginalFilename" "maintenanceservice_installer.exe"
Name "${MaintFullName}"
OutFile "maintenanceservice_installer.exe"
; Get installation folder from registry if available
InstallDirRegKey HKLM "Software\Mozilla\MaintenanceService" ""
SetOverwrite on
; serviceinstall.cpp also uses this key, in case the path is changed, update
; there too.
!define MaintUninstallKey \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService"
; Always install into the 32-bit location even if we have a 64-bit build.
; This is because we use only 1 service for all Basilisk channels.
; Allow either x86 and x64 builds to exist at this location, depending on
; what is the latest build.
InstallDir "$PROGRAMFILES32\${MaintFullName}\"
ShowUnInstDetails nevershow
################################################################################
# Modern User Interface - MUI
!define MUI_ICON setup.ico
!define MUI_UNICON setup.ico
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_UNWELCOMEFINISHPAGE_BITMAP wizWatermark.bmp
;Interface Settings
!define MUI_ABORTWARNING
; Uninstaller Pages
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
################################################################################
# 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 " "
Function .onInit
; Remove the current exe directory from the search order.
; This only effects LoadLibrary calls and not implicitly loaded DLLs.
System::Call 'kernel32::SetDllDirectoryW(w "")'
SetSilent silent
${Unless} ${AtLeastWin7}
Abort
${EndUnless}
FunctionEnd
Function un.onInit
; Remove the current exe directory from the search order.
; This only effects LoadLibrary calls and not implicitly loaded DLLs.
System::Call 'kernel32::SetDllDirectoryW(w "")'
; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be
; removed after we require NSIS 3.0a2 or greater.
!ifndef NSIS_PACKEDVERSION
${If} ${AtLeastWinVista}
System::Call 'user32::SetProcessDPIAware()'
${EndIf}
!endif
StrCpy $BrandFullNameDA "${MaintFullName}"
StrCpy $BrandFullName "${MaintFullName}"
FunctionEnd
Section "MaintenanceService"
AllowSkipFiles off
CreateDirectory $INSTDIR
SetOutPath $INSTDIR
; If the service already exists, then it will be stopped when upgrading it
; via the maintenanceservice_tmp.exe command executed below.
; The maintenanceservice_tmp.exe command will rename the file to
; maintenanceservice.exe if maintenanceservice_tmp.exe is newer.
; If the service does not exist yet, we install it and drop the file on
; disk as maintenanceservice.exe directly.
StrCpy $TempMaintServiceName "maintenanceservice.exe"
IfFileExists "$INSTDIR\maintenanceservice.exe" 0 skipAlreadyExists
StrCpy $TempMaintServiceName "maintenanceservice_tmp.exe"
skipAlreadyExists:
; We always write out a copy and then decide whether to install it or
; not via calling its 'install' cmdline which works by version comparison.
CopyFiles "$EXEDIR\maintenanceservice.exe" "$INSTDIR\$TempMaintServiceName"
; The updater.ini file is only used when performing an install or upgrade,
; and only if that install or upgrade is successful. If an old updater.ini
; happened to be copied into the maintenance service installation directory
; but the service was not newer, the updater.ini file would be unused.
; It is used to fill the description of the service on success.
CopyFiles "$EXEDIR\updater.ini" "$INSTDIR\updater.ini"
; Install the application maintenance service.
; If a service already exists, the command line parameter will stop the
; service and only install itself if it is newer than the already installed
; service. If successful it will remove the old maintenanceservice.exe
; and replace it with maintenanceservice_tmp.exe.
ClearErrors
${GetParameters} $0
${GetOptions} "$0" "/Upgrade" $0
${If} ${Errors}
ExecWait '"$INSTDIR\$TempMaintServiceName" install'
${Else}
; The upgrade cmdline is the same as install except
; It will fail if the service isn't already installed.
ExecWait '"$INSTDIR\$TempMaintServiceName" upgrade'
${EndIf}
WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "${MaintUninstallKey}" "DisplayName" "${MaintFullName}"
WriteRegStr HKLM "${MaintUninstallKey}" "UninstallString" \
'"$INSTDIR\uninstall.exe"'
WriteRegStr HKLM "${MaintUninstallKey}" "DisplayIcon" \
"$INSTDIR\Uninstall.exe,0"
WriteRegStr HKLM "${MaintUninstallKey}" "DisplayVersion" "${AppVersion}"
WriteRegStr HKLM "${MaintUninstallKey}" "Publisher" "Mozilla"
WriteRegStr HKLM "${MaintUninstallKey}" "Comments" "${BrandFullName}"
WriteRegDWORD HKLM "${MaintUninstallKey}" "NoModify" 1
${GetSize} "$INSTDIR" "/S=0K" $R2 $R3 $R4
WriteRegDWORD HKLM "${MaintUninstallKey}" "EstimatedSize" $R2
; Write out that a maintenance service was attempted.
; We do this because on upgrades we will check this value and we only
; want to install once on the first upgrade to maintenance service.
; Also write out that we are currently installed, preferences will check
; this value to determine if we should show the service update pref.
; Since the Maintenance service can be installed either x86 or x64,
; always use the 64-bit registry for checking if an attempt was made.
${If} ${RunningX64}
SetRegView 64
${EndIf}
WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Attempted" 1
WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Installed" 1
DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "FFPrefetchDisabled"
; Included here for debug purposes only.
; These keys are used to bypass the installation dir is a valid installation
; check from the service so that tests can be run.
; WriteRegStr HKLM "${FallbackKey}\0" "name" "Mozilla Corporation"
; WriteRegStr HKLM "${FallbackKey}\0" "issuer" "DigiCert SHA2 Assured ID Code Signing CA"
${If} ${RunningX64}
SetRegView lastused
${EndIf}
SectionEnd
; By renaming before deleting we improve things slightly in case
; there is a file in use error. In this case a new install can happen.
Function un.RenameDelete
Pop $9
; If the .moz-delete file already exists previously, delete it
; If it doesn't exist, the call is ignored.
; We don't need to pass /REBOOTOK here since it was already marked that way
; if it exists.
Delete "$9.moz-delete"
Rename "$9" "$9.moz-delete"
${If} ${Errors}
Delete /REBOOTOK "$9"
${Else}
Delete /REBOOTOK "$9.moz-delete"
${EndIf}
ClearErrors
FunctionEnd
Section "Uninstall"
; Delete the service so that no updates will be attempted
ExecWait '"$INSTDIR\maintenanceservice.exe" uninstall'
Push "$INSTDIR\updater.ini"
Call un.RenameDelete
Push "$INSTDIR\maintenanceservice.exe"
Call un.RenameDelete
Push "$INSTDIR\maintenanceservice_tmp.exe"
Call un.RenameDelete
Push "$INSTDIR\maintenanceservice.old"
Call un.RenameDelete
Push "$INSTDIR\Uninstall.exe"
Call un.RenameDelete
Push "$INSTDIR\update\updater.ini"
Call un.RenameDelete
Push "$INSTDIR\update\updater.exe"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-1.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-2.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-3.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-4.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-5.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-6.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-7.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-8.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-9.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-10.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-install.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-uninstall.log"
Call un.RenameDelete
SetShellVarContext all
Push "$APPDATA\Mozilla\logs\maintenanceservice.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-1.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-2.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-3.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-4.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-5.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-6.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-7.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-8.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-9.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-10.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-install.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-uninstall.log"
Call un.RenameDelete
RMDir /REBOOTOK "$APPDATA\Mozilla\logs"
RMDir /REBOOTOK "$APPDATA\Mozilla"
RMDir /REBOOTOK "$INSTDIR\logs"
RMDir /REBOOTOK "$INSTDIR\update"
RMDir /REBOOTOK "$INSTDIR"
DeleteRegKey HKLM "${MaintUninstallKey}"
${If} ${RunningX64}
SetRegView 64
${EndIf}
DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "Installed"
DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "FFPrefetchDisabled"
DeleteRegKey HKLM "${FallbackKey}\"
${If} ${RunningX64}
SetRegView lastused
${EndIf}
SectionEnd
@@ -124,51 +124,6 @@
${FixDistributionsINI}
RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}"
!ifdef MOZ_MAINTENANCE_SERVICE
Call IsUserAdmin
Pop $R0
${If} $R0 == "true"
; Only proceed if we have HKLM write access
${AndIf} $TmpVal == "HKLM"
; On Windows 2000 we do not install the maintenance service.
${AndIf} ${AtLeastWinXP}
; We check to see if the maintenance service install was already attempted.
; Since the Maintenance service can be installed either x86 or x64,
; always use the 64-bit registry for checking if an attempt was made.
${If} ${RunningX64}
SetRegView 64
${EndIf}
ReadRegDWORD $5 HKLM "Software\Mozilla\MaintenanceService" "Attempted"
ClearErrors
${If} ${RunningX64}
SetRegView lastused
${EndIf}
; Add the registry keys for allowed certificates.
${AddMaintCertKeys}
; If the maintenance service is already installed, do nothing.
; The maintenance service will launch:
; maintenanceservice_installer.exe /Upgrade to upgrade the maintenance
; service if necessary. If the update was done from updater.exe without
; the service (i.e. service is failing), updater.exe will do the update of
; the service. The reasons we do not do it here is because we don't want
; to have to prompt for limited user accounts when the service isn't used
; and we currently call the PostUpdate twice, once for the user and once
; for the SYSTEM account. Also, this would stop the maintenance service
; and we need a return result back to the service when run that way.
${If} $5 == ""
; An install of maintenance service was never attempted.
; We know we are an Admin and that we have write access into HKLM
; based on the above checks, so attempt to just run the EXE.
; In the worst case, in case there is some edge case with the
; IsAdmin check and the permissions check, the maintenance service
; will just fail to be attempted to be installed.
nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\""
${EndIf}
${EndIf}
!endif
!macroend
!define PostUpdate "!insertmacro PostUpdate"
@@ -720,54 +675,6 @@
!macroend
!define UpdateProtocolHandlers "!insertmacro UpdateProtocolHandlers"
!ifdef MOZ_MAINTENANCE_SERVICE
; Adds maintenance service certificate keys for the install dir.
; For the cert to work, it must also be signed by a trusted cert for the user.
!macro AddMaintCertKeys
Push $R0
; Allow main Mozilla cert information for updates
; This call will push the needed key on the stack
ServicesHelper::PathToUniqueRegistryPath "$INSTDIR"
Pop $R0
${If} $R0 != ""
; More than one certificate can be specified in a different subfolder
; for example: $R0\1, but each individual binary can be signed
; with at most one certificate. A fallback certificate can only be used
; if the binary is replaced with a different certificate.
; We always use the 64bit registry for certs.
${If} ${RunningX64}
SetRegView 64
${EndIf}
; PrefetchProcessName was originally used to experiment with deleting
; Windows prefetch as a speed optimization. It is no longer used though.
DeleteRegValue HKLM "$R0" "prefetchProcessName"
; Setting the Attempted value will ensure that a new Maintenance Service
; install will never be attempted again after this from updates. The value
; is used only to see if updates should attempt new service installs.
WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Attempted" 1
; These values associate the allowed certificates for the current
; installation.
WriteRegStr HKLM "$R0\0" "name" "${CERTIFICATE_NAME}"
WriteRegStr HKLM "$R0\0" "issuer" "${CERTIFICATE_ISSUER}"
; These values associate the allowed certificates for the previous
; installation, so that we can update from it cleanly using the
; old updater.exe (which will still have this signature).
WriteRegStr HKLM "$R0\1" "name" "${CERTIFICATE_NAME_PREVIOUS}"
WriteRegStr HKLM "$R0\1" "issuer" "${CERTIFICATE_ISSUER_PREVIOUS}"
${If} ${RunningX64}
SetRegView lastused
${EndIf}
ClearErrors
${EndIf}
; Restore the previously used value back
Pop $R0
!macroend
!define AddMaintCertKeys "!insertmacro AddMaintCertKeys"
!endif
; Removes various registry entries for reasons noted below (does not use SHCTX).
!macro RemoveDeprecatedKeys
StrCpy $0 "SOFTWARE\Classes"
@@ -450,24 +450,6 @@ Section "Uninstall"
; uninstalls of Basilisk-release with reinstalls of Basilisk-release, for example.
WriteRegStr HKCU "Software\Mozilla\Basilisk" "Uninstalled-${UpdateChannel}" "True"
!ifdef MOZ_MAINTENANCE_SERVICE
; Get the path the allowed cert is at and remove it
; Keep this block of code last since it modfies the reg view
ServicesHelper::PathToUniqueRegistryPath "$INSTDIR"
Pop $MaintCertKey
${If} $MaintCertKey != ""
; Always use the 64bit registry for certs on 64bit systems.
${If} ${RunningX64}
SetRegView 64
${EndIf}
DeleteRegKey HKLM "$MaintCertKey"
${If} ${RunningX64}
SetRegView lastused
${EndIf}
${EndIf}
Call un.UninstallServiceIfNotUsed
!endif
${un.IsFirewallSvcRunning}
Pop $0
${If} "$0" == "true"
-1
View File
@@ -99,7 +99,6 @@ if test "$OS_ARCH" = "WINNT" -o \
fi
# Short-circuit a few services to be removed
MOZ_MAINTENANCE_SERVICE=
MOZ_SERVICES_HEALTHREPORT=
MOZ_ADDON_SIGNING=0
MOZ_REQUIRE_SIGNING=0
@@ -14,12 +14,6 @@ INSTALLER_FILES = \
nsis/shared.nsh \
$(NULL)
ifdef MOZ_MAINTENANCE_SERVICE
INSTALLER_FILES += \
nsis/maintenanceservice_installer.nsi \
$(NULL)
endif
BRANDING_FILES = \
branding.nsi \
appname.bmp \
@@ -58,17 +52,6 @@ uninstaller::
--preprocess-locale $(topsrcdir) \
$(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
# For building the maintenanceservice installer
ifdef MOZ_MAINTENANCE_SERVICE
maintenanceservice_installer::
$(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR)
$(call py_action,preprocessor,-Fsubstitution $(DEFINES) $(ACDEFINES) \
$(srcdir)/nsis/defines.nsi.in -o $(CONFIG_DIR)/defines.nsi)
$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
--preprocess-locale $(topsrcdir) \
$(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
endif
$(CONFIG_DIR)/setup.exe::
$(RM) -r $(CONFIG_DIR)
$(MKDIR) $(CONFIG_DIR)
@@ -51,10 +51,6 @@
!define MinSupportedCPU "SSE2"
#ifdef MOZ_MAINTENANCE_SERVICE
!define MOZ_MAINTENANCE_SERVICE
#endif
# File details shared by both the installer and uninstaller
VIProductVersion "1.0.0.0"
VIAddVersionKey "ProductName" "${BrandShortName}"
@@ -165,11 +165,6 @@ Page custom preOptions leaveOptions
!define MUI_DIRECTORYPAGE_VERIFYONLEAVE
!insertmacro MUI_PAGE_DIRECTORY
; Custom Components Page
!ifdef MOZ_MAINTENANCE_SERVICE
Page custom preComponents leaveComponents
!endif
; Custom Shortcuts Page
Page custom preShortcuts leaveShortcuts
@@ -427,41 +422,6 @@ Section "-Application" APP_IDX
${EndIf}
${EndIf}
!ifdef MOZ_MAINTENANCE_SERVICE
; If the maintenance service page was displayed then a value was already
; explicitly selected for installing the maintenance service and
; and so InstallMaintenanceService will already be 0 or 1.
; If the maintenance service page was not displayed then
; InstallMaintenanceService will be equal to "".
${If} $InstallMaintenanceService == ""
Call IsUserAdmin
Pop $R0
${If} $R0 == "true"
; Only proceed if we have HKLM write access
${AndIf} $TmpVal == "HKLM"
; On Windows < XP SP3 we do not install the maintenance service.
${If} ${IsWinXP}
${AndIf} ${AtMostServicePack} 2
StrCpy $InstallMaintenanceService "0"
${Else}
; The user is an admin, so we should default to installing the service.
StrCpy $InstallMaintenanceService "1"
${EndIf}
${Else}
; The user is not admin, so we can't install the service.
StrCpy $InstallMaintenanceService "0"
${EndIf}
${EndIf}
${If} $InstallMaintenanceService == "1"
; The user wants to install the maintenance service, so execute
; the pre-packaged maintenance service installer.
; This option can only be turned on if the user is an admin so there
; is no need to use ExecShell w/ verb runas to enforce elevated.
nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\""
${EndIf}
!endif
; These need special handling on uninstall since they may be overwritten by
; an install into a different location.
StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}"
@@ -578,13 +538,6 @@ Section "-Application" APP_IDX
${EndIf}
${EndUnless}
${EndIf}
!ifdef MOZ_MAINTENANCE_SERVICE
${If} $TmpVal == "HKLM"
; Add the registry keys for allowed certificates.
${AddMaintCertKeys}
${EndIf}
!endif
SectionEnd
; Cleanup operations to perform at the end of the installation.
@@ -948,59 +901,6 @@ Function leaveShortcuts
${EndIf}
FunctionEnd
!ifdef MOZ_MAINTENANCE_SERVICE
Function preComponents
; If the service already exists, don't show this page
ServicesHelper::IsInstalled "MozillaMaintenance"
Pop $R9
${If} $R9 == 1
; The service already exists so don't show this page.
Abort
${EndIf}
; On Windows < XP SP3 we do not install the maintenance service.
${If} ${IsWinXP}
${AndIf} ${AtMostServicePack} 2
Abort
${EndIf}
; Don't show the custom components page if the
; user is not an admin
Call IsUserAdmin
Pop $R9
${If} $R9 != "true"
Abort
${EndIf}
; Only show the maintenance service page if we have write access to HKLM
ClearErrors
WriteRegStr HKLM "Software\Mozilla" \
"${BrandShortName}InstallerTest" "Write Test"
${If} ${Errors}
ClearErrors
Abort
${Else}
DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
${EndIf}
StrCpy $PageName "Components"
${CheckCustomCommon}
!insertmacro MUI_HEADER_TEXT "$(COMPONENTS_PAGE_TITLE)" "$(COMPONENTS_PAGE_SUBTITLE)"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "components.ini"
FunctionEnd
Function leaveComponents
${MUI_INSTALLOPTIONS_READ} $0 "components.ini" "Settings" "State"
${If} $0 != 0
Abort
${EndIf}
${MUI_INSTALLOPTIONS_READ} $InstallMaintenanceService "components.ini" "Field 2" "State"
${If} $InstallType == ${INSTALLTYPE_CUSTOM}
Call CheckExistingInstall
${EndIf}
FunctionEnd
!endif
Function preSummary
StrCpy $PageName "Summary"
; Setup the summary.ini file for the Custom Summary Page
@@ -1,332 +0,0 @@
# 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/.
; 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
RequestExecutionLevel admin
; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can
; be removed after we require NSIS 3.0a2 or greater.
!ifdef NSIS_PACKEDVERSION
Unicode true
ManifestSupportedOS all
ManifestDPIAware true
!endif
!addplugindir ./
; Variables
Var TempMaintServiceName
Var BrandFullNameDA
Var BrandFullName
; Other included files may depend upon these includes!
; The following includes are provided by NSIS.
!include FileFunc.nsh
!include LogicLib.nsh
!include MUI.nsh
!include WinMessages.nsh
!include WinVer.nsh
!include WordFunc.nsh
!insertmacro GetOptions
!insertmacro GetParameters
!insertmacro GetSize
; The test slaves use this fallback key to run tests.
; And anyone that wants to run tests themselves should already have
; this installed.
!define FallbackKey \
"SOFTWARE\Mozilla\MaintenanceService\3932ecacee736d366d6436db0f55bce4"
!define CompanyName "Mozilla Corporation"
!define BrandFullNameInternal ""
; The following includes are custom.
!include defines.nsi
; We keep defines.nsi defined so that we get other things like
; the version number, but we redefine BrandFullName
!define MaintFullName "Mozilla Maintenance Service"
!undef BrandFullName
!define BrandFullName "${MaintFullName}"
!include common.nsh
!include locales.nsi
VIAddVersionKey "FileDescription" "${MaintFullName} Installer"
VIAddVersionKey "OriginalFilename" "maintenanceservice_installer.exe"
Name "${MaintFullName}"
OutFile "maintenanceservice_installer.exe"
; Get installation folder from registry if available
InstallDirRegKey HKLM "Software\Mozilla\MaintenanceService" ""
SetOverwrite on
; serviceinstall.cpp also uses this key, in case the path is changed, update
; there too.
!define MaintUninstallKey \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService"
; Always install into the 32-bit location even if we have a 64-bit build.
; This is because we use only 1 service for all Basilisk channels.
; Allow either x86 and x64 builds to exist at this location, depending on
; what is the latest build.
InstallDir "$PROGRAMFILES32\${MaintFullName}\"
ShowUnInstDetails nevershow
################################################################################
# Modern User Interface - MUI
!define MUI_ICON setup.ico
!define MUI_UNICON setup.ico
!define MUI_WELCOMEPAGE_TITLE_3LINES
!define MUI_UNWELCOMEFINISHPAGE_BITMAP wizWatermark.bmp
;Interface Settings
!define MUI_ABORTWARNING
; Uninstaller Pages
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
################################################################################
# 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 " "
Function .onInit
; Remove the current exe directory from the search order.
; This only effects LoadLibrary calls and not implicitly loaded DLLs.
System::Call 'kernel32::SetDllDirectoryW(w "")'
SetSilent silent
${Unless} ${AtLeastWin7}
Abort
${EndUnless}
FunctionEnd
Function un.onInit
; Remove the current exe directory from the search order.
; This only effects LoadLibrary calls and not implicitly loaded DLLs.
System::Call 'kernel32::SetDllDirectoryW(w "")'
; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be
; removed after we require NSIS 3.0a2 or greater.
!ifndef NSIS_PACKEDVERSION
${If} ${AtLeastWinVista}
System::Call 'user32::SetProcessDPIAware()'
${EndIf}
!endif
StrCpy $BrandFullNameDA "${MaintFullName}"
StrCpy $BrandFullName "${MaintFullName}"
FunctionEnd
Section "MaintenanceService"
AllowSkipFiles off
CreateDirectory $INSTDIR
SetOutPath $INSTDIR
; If the service already exists, then it will be stopped when upgrading it
; via the maintenanceservice_tmp.exe command executed below.
; The maintenanceservice_tmp.exe command will rename the file to
; maintenanceservice.exe if maintenanceservice_tmp.exe is newer.
; If the service does not exist yet, we install it and drop the file on
; disk as maintenanceservice.exe directly.
StrCpy $TempMaintServiceName "maintenanceservice.exe"
IfFileExists "$INSTDIR\maintenanceservice.exe" 0 skipAlreadyExists
StrCpy $TempMaintServiceName "maintenanceservice_tmp.exe"
skipAlreadyExists:
; We always write out a copy and then decide whether to install it or
; not via calling its 'install' cmdline which works by version comparison.
CopyFiles "$EXEDIR\maintenanceservice.exe" "$INSTDIR\$TempMaintServiceName"
; The updater.ini file is only used when performing an install or upgrade,
; and only if that install or upgrade is successful. If an old updater.ini
; happened to be copied into the maintenance service installation directory
; but the service was not newer, the updater.ini file would be unused.
; It is used to fill the description of the service on success.
CopyFiles "$EXEDIR\updater.ini" "$INSTDIR\updater.ini"
; Install the application maintenance service.
; If a service already exists, the command line parameter will stop the
; service and only install itself if it is newer than the already installed
; service. If successful it will remove the old maintenanceservice.exe
; and replace it with maintenanceservice_tmp.exe.
ClearErrors
${GetParameters} $0
${GetOptions} "$0" "/Upgrade" $0
${If} ${Errors}
ExecWait '"$INSTDIR\$TempMaintServiceName" install'
${Else}
; The upgrade cmdline is the same as install except
; It will fail if the service isn't already installed.
ExecWait '"$INSTDIR\$TempMaintServiceName" upgrade'
${EndIf}
WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "${MaintUninstallKey}" "DisplayName" "${MaintFullName}"
WriteRegStr HKLM "${MaintUninstallKey}" "UninstallString" \
'"$INSTDIR\uninstall.exe"'
WriteRegStr HKLM "${MaintUninstallKey}" "DisplayIcon" \
"$INSTDIR\Uninstall.exe,0"
WriteRegStr HKLM "${MaintUninstallKey}" "DisplayVersion" "${AppVersion}"
WriteRegStr HKLM "${MaintUninstallKey}" "Publisher" "Mozilla"
WriteRegStr HKLM "${MaintUninstallKey}" "Comments" "${BrandFullName}"
WriteRegDWORD HKLM "${MaintUninstallKey}" "NoModify" 1
${GetSize} "$INSTDIR" "/S=0K" $R2 $R3 $R4
WriteRegDWORD HKLM "${MaintUninstallKey}" "EstimatedSize" $R2
; Write out that a maintenance service was attempted.
; We do this because on upgrades we will check this value and we only
; want to install once on the first upgrade to maintenance service.
; Also write out that we are currently installed, preferences will check
; this value to determine if we should show the service update pref.
; Since the Maintenance service can be installed either x86 or x64,
; always use the 64-bit registry for checking if an attempt was made.
${If} ${RunningX64}
SetRegView 64
${EndIf}
WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Attempted" 1
WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Installed" 1
DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "FFPrefetchDisabled"
; Included here for debug purposes only.
; These keys are used to bypass the installation dir is a valid installation
; check from the service so that tests can be run.
; WriteRegStr HKLM "${FallbackKey}\0" "name" "Mozilla Corporation"
; WriteRegStr HKLM "${FallbackKey}\0" "issuer" "DigiCert SHA2 Assured ID Code Signing CA"
${If} ${RunningX64}
SetRegView lastused
${EndIf}
SectionEnd
; By renaming before deleting we improve things slightly in case
; there is a file in use error. In this case a new install can happen.
Function un.RenameDelete
Pop $9
; If the .moz-delete file already exists previously, delete it
; If it doesn't exist, the call is ignored.
; We don't need to pass /REBOOTOK here since it was already marked that way
; if it exists.
Delete "$9.moz-delete"
Rename "$9" "$9.moz-delete"
${If} ${Errors}
Delete /REBOOTOK "$9"
${Else}
Delete /REBOOTOK "$9.moz-delete"
${EndIf}
ClearErrors
FunctionEnd
Section "Uninstall"
; Delete the service so that no updates will be attempted
ExecWait '"$INSTDIR\maintenanceservice.exe" uninstall'
Push "$INSTDIR\updater.ini"
Call un.RenameDelete
Push "$INSTDIR\maintenanceservice.exe"
Call un.RenameDelete
Push "$INSTDIR\maintenanceservice_tmp.exe"
Call un.RenameDelete
Push "$INSTDIR\maintenanceservice.old"
Call un.RenameDelete
Push "$INSTDIR\Uninstall.exe"
Call un.RenameDelete
Push "$INSTDIR\update\updater.ini"
Call un.RenameDelete
Push "$INSTDIR\update\updater.exe"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-1.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-2.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-3.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-4.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-5.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-6.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-7.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-8.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-9.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-10.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-install.log"
Call un.RenameDelete
Push "$INSTDIR\logs\maintenanceservice-uninstall.log"
Call un.RenameDelete
SetShellVarContext all
Push "$APPDATA\Mozilla\logs\maintenanceservice.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-1.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-2.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-3.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-4.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-5.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-6.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-7.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-8.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-9.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-10.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-install.log"
Call un.RenameDelete
Push "$APPDATA\Mozilla\logs\maintenanceservice-uninstall.log"
Call un.RenameDelete
RMDir /REBOOTOK "$APPDATA\Mozilla\logs"
RMDir /REBOOTOK "$APPDATA\Mozilla"
RMDir /REBOOTOK "$INSTDIR\logs"
RMDir /REBOOTOK "$INSTDIR\update"
RMDir /REBOOTOK "$INSTDIR"
DeleteRegKey HKLM "${MaintUninstallKey}"
${If} ${RunningX64}
SetRegView 64
${EndIf}
DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "Installed"
DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "FFPrefetchDisabled"
DeleteRegKey HKLM "${FallbackKey}\"
${If} ${RunningX64}
SetRegView lastused
${EndIf}
SectionEnd
@@ -124,51 +124,6 @@
${FixDistributionsINI}
RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}"
!ifdef MOZ_MAINTENANCE_SERVICE
Call IsUserAdmin
Pop $R0
${If} $R0 == "true"
; Only proceed if we have HKLM write access
${AndIf} $TmpVal == "HKLM"
; On Windows 2000 we do not install the maintenance service.
${AndIf} ${AtLeastWinXP}
; We check to see if the maintenance service install was already attempted.
; Since the Maintenance service can be installed either x86 or x64,
; always use the 64-bit registry for checking if an attempt was made.
${If} ${RunningX64}
SetRegView 64
${EndIf}
ReadRegDWORD $5 HKLM "Software\Mozilla\MaintenanceService" "Attempted"
ClearErrors
${If} ${RunningX64}
SetRegView lastused
${EndIf}
; Add the registry keys for allowed certificates.
${AddMaintCertKeys}
; If the maintenance service is already installed, do nothing.
; The maintenance service will launch:
; maintenanceservice_installer.exe /Upgrade to upgrade the maintenance
; service if necessary. If the update was done from updater.exe without
; the service (i.e. service is failing), updater.exe will do the update of
; the service. The reasons we do not do it here is because we don't want
; to have to prompt for limited user accounts when the service isn't used
; and we currently call the PostUpdate twice, once for the user and once
; for the SYSTEM account. Also, this would stop the maintenance service
; and we need a return result back to the service when run that way.
${If} $5 == ""
; An install of maintenance service was never attempted.
; We know we are an Admin and that we have write access into HKLM
; based on the above checks, so attempt to just run the EXE.
; In the worst case, in case there is some edge case with the
; IsAdmin check and the permissions check, the maintenance service
; will just fail to be attempted to be installed.
nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\""
${EndIf}
${EndIf}
!endif
!macroend
!define PostUpdate "!insertmacro PostUpdate"
@@ -718,54 +673,6 @@
!macroend
!define UpdateProtocolHandlers "!insertmacro UpdateProtocolHandlers"
!ifdef MOZ_MAINTENANCE_SERVICE
; Adds maintenance service certificate keys for the install dir.
; For the cert to work, it must also be signed by a trusted cert for the user.
!macro AddMaintCertKeys
Push $R0
; Allow main Mozilla cert information for updates
; This call will push the needed key on the stack
ServicesHelper::PathToUniqueRegistryPath "$INSTDIR"
Pop $R0
${If} $R0 != ""
; More than one certificate can be specified in a different subfolder
; for example: $R0\1, but each individual binary can be signed
; with at most one certificate. A fallback certificate can only be used
; if the binary is replaced with a different certificate.
; We always use the 64bit registry for certs.
${If} ${RunningX64}
SetRegView 64
${EndIf}
; PrefetchProcessName was originally used to experiment with deleting
; Windows prefetch as a speed optimization. It is no longer used though.
DeleteRegValue HKLM "$R0" "prefetchProcessName"
; Setting the Attempted value will ensure that a new Maintenance Service
; install will never be attempted again after this from updates. The value
; is used only to see if updates should attempt new service installs.
WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Attempted" 1
; These values associate the allowed certificates for the current
; installation.
WriteRegStr HKLM "$R0\0" "name" "${CERTIFICATE_NAME}"
WriteRegStr HKLM "$R0\0" "issuer" "${CERTIFICATE_ISSUER}"
; These values associate the allowed certificates for the previous
; installation, so that we can update from it cleanly using the
; old updater.exe (which will still have this signature).
WriteRegStr HKLM "$R0\1" "name" "${CERTIFICATE_NAME_PREVIOUS}"
WriteRegStr HKLM "$R0\1" "issuer" "${CERTIFICATE_ISSUER_PREVIOUS}"
${If} ${RunningX64}
SetRegView lastused
${EndIf}
ClearErrors
${EndIf}
; Restore the previously used value back
Pop $R0
!macroend
!define AddMaintCertKeys "!insertmacro AddMaintCertKeys"
!endif
; Removes various registry entries for reasons noted below (does not use SHCTX).
!macro RemoveDeprecatedKeys
StrCpy $0 "SOFTWARE\Classes"
@@ -450,24 +450,6 @@ Section "Uninstall"
; uninstalls of PaleMoon-release with reinstalls of PaleMoon-release, for example.
WriteRegStr HKCU "Software\Mozilla\PaleMoon" "Uninstalled-${UpdateChannel}" "True"
!ifdef MOZ_MAINTENANCE_SERVICE
; Get the path the allowed cert is at and remove it
; Keep this block of code last since it modfies the reg view
ServicesHelper::PathToUniqueRegistryPath "$INSTDIR"
Pop $MaintCertKey
${If} $MaintCertKey != ""
; Always use the 64bit registry for certs on 64bit systems.
${If} ${RunningX64}
SetRegView 64
${EndIf}
DeleteRegKey HKLM "$MaintCertKey"
${If} ${RunningX64}
SetRegView lastused
${EndIf}
${EndIf}
Call un.UninstallServiceIfNotUsed
!endif
${un.IsFirewallSvcRunning}
Pop $0
${If} "$0" == "true"
-4
View File
@@ -13,10 +13,6 @@ MOZ_CHROME_FILE_FORMAT=omni
MOZ_UPDATER=1
if test "$OS_ARCH" = "WINNT"; then
MOZ_MAINTENANCE_SERVICE=
fi
MOZ_PLACES=1
MOZ_WEBRTC=1
MOZ_WEBGL_CONFORMANT=1
-18
View File
@@ -3564,23 +3564,6 @@ fi
AC_CHECK_PROGS(WGET, wget, "")
AC_SUBST(WGET)
dnl ========================================================
dnl Maintenance Service
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(maintenance-service,
[ --enable-maintenance-service Enable building of maintenanceservice],
MOZ_MAINTENANCE_SERVICE=1,
MOZ_MAINTENANCE_SERVICE= )
if test -n "$MOZ_MAINTENANCE_SERVICE"; then
if test "$OS_ARCH" = "WINNT"; then
AC_DEFINE(MOZ_MAINTENANCE_SERVICE)
else
AC_MSG_ERROR([Can only build with --enable-maintenance-service with a Windows target])
fi
fi
dnl ========================================================
dnl Bundled fonts on desktop platforms
dnl ========================================================
@@ -5070,7 +5053,6 @@ AC_SUBST(MOZ_UNIVERSALCHARDET)
AC_SUBST(ACCESSIBILITY)
AC_SUBST(MOZ_SPELLCHECK)
AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
AC_SUBST(MOZ_MAINTENANCE_SERVICE)
AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
AC_SUBST(MOZ_ENABLE_SIGNMAR)
AC_SUBST(MOZ_UPDATER)
-7
View File
@@ -180,13 +180,6 @@ MOZ_SAFE_BROWSING:
false,
#endif
MOZ_MAINTENANCE_SERVICE:
#ifdef MOZ_MAINTENANCE_SERVICE
true,
#else
false,
#endif
DEBUG:
#ifdef DEBUG
true,
-13
View File
@@ -27,19 +27,6 @@ DIRS += ['mozapps/extensions']
if CONFIG['MOZ_UPDATER'] and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
DIRS += ['mozapps/update']
if CONFIG['MOZ_MAINTENANCE_SERVICE'] or CONFIG['MOZ_UPDATER'] and CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
# Including mozapps/update/common-standalone allows the maintenance service
# to be built so the maintenance service can be used for things other than
# updating applications.
DIRS += [
'mozapps/update/common-standalone',
]
if CONFIG['MOZ_MAINTENANCE_SERVICE']:
DIRS += [
'components/maintenanceservice'
]
DIRS += ['xre']
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'gtk3'):
@@ -75,10 +75,3 @@ uninstaller::
cd $(CONFIG_DIR) && $(MAKENSISU) uninstaller.nsi
$(NSINSTALL) -D $(DIST)/bin/uninstall
cp $(CONFIG_DIR)/helper.exe $(DIST)/bin/uninstall
ifdef MOZ_MAINTENANCE_SERVICE
maintenanceservice_installer::
cd $(CONFIG_DIR) && $(MAKENSISU) maintenanceservice_installer.nsi
$(NSINSTALL) -D $(DIST)/bin/
cp $(CONFIG_DIR)/maintenanceservice_installer.exe $(DIST)/bin
endif
-5
View File
@@ -17,11 +17,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'updatehelper.cpp',
'updatehelper.h',
]
if CONFIG['MOZ_MAINTENANCE_SERVICE']:
EXPORTS += [
'certificatecheck.h',
'registrycertificates.h',
]
Library('updatecommon')
@@ -10,15 +10,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'uachelper.cpp',
'updatehelper.cpp',
]
if CONFIG['MOZ_MAINTENANCE_SERVICE']:
sources += [
'certificatecheck.cpp',
'registrycertificates.cpp',
]
OS_LIBS += [
'crypt32',
'wintrust',
]
sources += [
'readstrings.cpp',
-111
View File
@@ -791,79 +791,6 @@ function shouldUseService() {
// 2) The maintenance service is installed
// 3) The pref for using the service is enabled
// 4) The Windows version is XP Service Pack 3 or above (for SHA-2 support)
// The maintenance service requires SHA-2 support because we sign our binaries
// with a SHA-2 certificate and the certificate is verified before the binary
// is launched.
if (!AppConstants.MOZ_MAINTENANCE_SERVICE || !isServiceInstalled() ||
!getPref("getBoolPref", PREF_APP_UPDATE_SERVICE_ENABLED, false) ||
!AppConstants.isPlatformAndVersionAtLeast("win", "5.1") /* WinXP */) {
return false;
}
// If it's newer than XP, then the service pack doesn't matter.
if (Services.sysinfo.getProperty("version") != "5.1") {
return true;
}
// If the Windows version is XP, we also need to check the service pack.
// We'll return false if only < SP3 is installed, or if we can't tell.
// Check the service pack level by calling GetVersionEx via ctypes.
const BYTE = ctypes.uint8_t;
const WORD = ctypes.uint16_t;
const DWORD = ctypes.uint32_t;
const WCHAR = ctypes.char16_t;
const BOOL = ctypes.int;
// This structure is described at:
// http://msdn.microsoft.com/en-us/library/ms724833%28v=vs.85%29.aspx
const SZCSDVERSIONLENGTH = 128;
const OSVERSIONINFOEXW = new ctypes.StructType('OSVERSIONINFOEXW',
[
{dwOSVersionInfoSize: DWORD},
{dwMajorVersion: DWORD},
{dwMinorVersion: DWORD},
{dwBuildNumber: DWORD},
{dwPlatformId: DWORD},
{szCSDVersion: ctypes.ArrayType(WCHAR, SZCSDVERSIONLENGTH)},
{wServicePackMajor: WORD},
{wServicePackMinor: WORD},
{wSuiteMask: WORD},
{wProductType: BYTE},
{wReserved: BYTE}
]);
let kernel32 = false;
try {
kernel32 = ctypes.open("Kernel32");
} catch (e) {
Cu.reportError("Unable to open kernel32! " + e);
return false;
}
if (kernel32) {
try {
try {
let GetVersionEx = kernel32.declare("GetVersionExW",
ctypes.default_abi,
BOOL,
OSVERSIONINFOEXW.ptr);
let winVer = OSVERSIONINFOEXW();
winVer.dwOSVersionInfoSize = OSVERSIONINFOEXW.size;
if (0 !== GetVersionEx(winVer.address())) {
return winVer.wServicePackMajor >= 3;
}
Cu.reportError("Unknown failure in GetVersionEX (returned 0)");
return false;
} catch (e) {
Cu.reportError("Error getting service pack information. Exception: " + e);
return false;
}
} finally {
kernel32.close();
}
}
// If the service pack check couldn't be done, assume we can't use the service.
return false;
}
@@ -873,22 +800,6 @@ function shouldUseService() {
* @return true if the service is installed.
*/
function isServiceInstalled() {
if (AppConstants.MOZ_MAINTENANCE_SERVICE && AppConstants.platform == "win") {
let installed = 0;
try {
let wrk = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE,
"SOFTWARE\\Mozilla\\MaintenanceService",
wrk.ACCESS_READ | wrk.WOW64_64);
installed = wrk.readIntValue("Installed");
wrk.close();
} catch (e) {
}
installed = installed == 1; // convert to bool
LOG("isServiceInstalled = " + installed);
return installed;
}
return false;
}
@@ -2122,28 +2033,6 @@ UpdateService.prototype = {
this._pingSuffix,
PREF_APP_UPDATE_CANCELATIONS_OSX, 0, 0);
}
if (AppConstants.MOZ_MAINTENANCE_SERVICE) {
// Histogram IDs:
// UPDATE_NOT_PREF_UPDATE_SERVICE_ENABLED_EXTERNAL
// UPDATE_NOT_PREF_UPDATE_SERVICE_ENABLED_NOTIFY
AUSTLMY.pingBoolPref("UPDATE_NOT_PREF_UPDATE_SERVICE_ENABLED_" +
this._pingSuffix,
PREF_APP_UPDATE_SERVICE_ENABLED, true);
// Histogram IDs:
// UPDATE_PREF_SERVICE_ERRORS_EXTERNAL
// UPDATE_PREF_SERVICE_ERRORS_NOTIFY
AUSTLMY.pingIntPref("UPDATE_PREF_SERVICE_ERRORS_" + this._pingSuffix,
PREF_APP_UPDATE_SERVICE_ERRORS, 0, 0);
if (AppConstants.platform == "win") {
// Histogram IDs:
// UPDATE_SERVICE_INSTALLED_EXTERNAL
// UPDATE_SERVICE_INSTALLED_NOTIFY
// UPDATE_SERVICE_MANUALLY_UNINSTALLED_EXTERNAL
// UPDATE_SERVICE_MANUALLY_UNINSTALLED_NOTIFY
AUSTLMY.pingServiceInstallStatus(this._pingSuffix, isServiceInstalled());
}
}
let prefType = Services.prefs.getPrefType(PREF_APP_UPDATE_URL_OVERRIDE);
let overridePrefHasValue = prefType != Ci.nsIPrefBranch.PREF_INVALID;
// Histogram IDs:
@@ -217,16 +217,8 @@ int NS_main(int argc, NS_tchar **argv)
}
if (!NS_tstrcmp(argv[1], NS_T("check-signature"))) {
#if defined(XP_WIN) && defined(MOZ_MAINTENANCE_SERVICE)
if (ERROR_SUCCESS == VerifyCertificateTrustForFile(argv[2])) {
return 0;
} else {
return 1;
}
#else
// Not implemented on non-Windows platforms
// Not implemented
return 1;
#endif
}
if (!NS_tstrcmp(argv[1], NS_T("setup-symlink"))) {
-6
View File
@@ -15,9 +15,6 @@ XPCSHELL_TESTS_MANIFESTS += [
'unit_base_updater/xpcshell.ini'
]
if CONFIG['MOZ_MAINTENANCE_SERVICE']:
XPCSHELL_TESTS_MANIFESTS += ['unit_service_updater/xpcshell.ini']
SimplePrograms([
'TestAUSHelper',
'TestAUSReadStrings',
@@ -47,9 +44,6 @@ for var in ('MOZ_APP_NAME', 'MOZ_APP_BASENAME', 'MOZ_APP_DISPLAYNAME',
DEFINES['NS_NO_XPCOM'] = True
if CONFIG['MOZ_MAINTENANCE_SERVICE']:
DEFINES['MOZ_MAINTENANCE_SERVICE'] = CONFIG['MOZ_MAINTENANCE_SERVICE']
# For debugging purposes only
#DEFINES['DISABLE_UPDATER_AUTHENTICODE_CHECK'] = True
@@ -119,9 +119,6 @@ struct UpdateServerThreadArgs
#endif
#ifdef XP_WIN
#ifdef MOZ_MAINTENANCE_SERVICE
#include "registrycertificates.h"
#endif
BOOL PathAppendSafe(LPWSTR base, LPCWSTR extra);
BOOL PathGetSiblingFilePath(LPWSTR destinationBuffer,
LPCWSTR siblingFilePath,
@@ -2024,13 +2021,6 @@ LaunchWinPostProcess(const WCHAR *installationDir,
return false;
}
#if !defined(TEST_UPDATER) && defined(MOZ_MAINTENANCE_SERVICE)
if (sUsingService &&
!DoesBinaryMatchAllowedCertificates(installationDir, exefullpath)) {
return false;
}
#endif
WCHAR dlogFile[MAX_PATH + 1];
if (!PathGetSiblingFilePath(dlogFile, exefullpath, L"uninstall.update")) {
return false;
@@ -2188,40 +2178,6 @@ WriteStatusFile(int status)
WriteStatusFile(text);
}
#ifdef MOZ_MAINTENANCE_SERVICE
/*
* Read the update.status file and sets isPendingService to true if
* the status is set to pending-service.
*
* @param isPendingService Out parameter for specifying if the status
* is set to pending-service or not.
* @return true if the information was retrieved and it is pending
* or pending-service.
*/
static bool
IsUpdateStatusPendingService()
{
NS_tchar filename[MAXPATHLEN];
NS_tsnprintf(filename, sizeof(filename)/sizeof(filename[0]),
NS_T("%s/update.status"), gPatchDirPath);
AutoFile file(NS_tfopen(filename, NS_T("rb")));
if (file == nullptr)
return false;
char buf[32] = { 0 };
fread(buf, sizeof(buf), 1, file);
const char kPendingService[] = "pending-service";
const char kAppliedService[] = "applied-service";
return (strncmp(buf, kPendingService,
sizeof(kPendingService) - 1) == 0) ||
(strncmp(buf, kAppliedService,
sizeof(kAppliedService) - 1) == 0);
}
#endif
#ifdef XP_WIN
/*
* Read the update.status file and sets isSuccess to true if
@@ -2813,20 +2769,6 @@ int NS_main(int argc, NS_tchar **argv)
bool testOnlyFallbackKeyExists = false;
bool noServiceFallback = false;
// We never want the service to be used unless we build with
// the maintenance service.
#ifdef MOZ_MAINTENANCE_SERVICE
useService = IsUpdateStatusPendingService();
#ifdef TEST_UPDATER
noServiceFallback = EnvHasValue("MOZ_NO_SERVICE_FALLBACK");
putenv(const_cast<char*>("MOZ_NO_SERVICE_FALLBACK="));
// Our tests run with a different apply directory for each test.
// We use this registry key on our test slaves to store the
// allowed name/issuers.
testOnlyFallbackKeyExists = DoesFallbackKeyExist();
#endif
#endif
// Remove everything except close window from the context menu
{
HKEY hkApp = nullptr;
@@ -3030,10 +2972,6 @@ int NS_main(int argc, NS_tchar **argv)
#endif
#ifdef XP_WIN
#ifdef MOZ_MAINTENANCE_SERVICE
sUsingService = EnvHasValue("MOZ_USING_SERVICE");
putenv(const_cast<char*>("MOZ_USING_SERVICE="));
#endif
// lastFallbackError keeps track of the last error for the service not being
// used, in case of an error when fallback is not enabled we write the
// error to the update.status file.