зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1515451 Part 3 - Install, uninstall update agent r=mhowell
This was originally planned in bugs 1458282 and 1458283, but it fits naturally in this patch series. Differential Revision: https://phabricator.services.mozilla.com/D37141 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b7a227398f
Коммит
589a6df363
|
@ -403,6 +403,11 @@ bin/libfreebl_64int_3.so
|
|||
@BINPATH@/maintenanceservice_installer.exe
|
||||
#endif
|
||||
|
||||
; [Background Update Agent]
|
||||
#ifdef MOZ_UPDATE_AGENT
|
||||
@BINPATH@/updateagent@BIN_SUFFIX@
|
||||
#endif
|
||||
|
||||
; [Crash Reporter]
|
||||
;
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
|
|
|
@ -118,6 +118,11 @@
|
|||
!define MOZ_MAINTENANCE_SERVICE
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_UPDATE_AGENT
|
||||
!define MOZ_UPDATE_AGENT
|
||||
!define UpdateAgentFullName "Mozilla Update Agent"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_BITS_DOWNLOAD
|
||||
!define MOZ_BITS_DOWNLOAD
|
||||
#endif
|
||||
|
|
|
@ -487,6 +487,17 @@ Section "-Application" APP_IDX
|
|||
${EndIf}
|
||||
!endif
|
||||
|
||||
!ifdef MOZ_UPDATE_AGENT
|
||||
${PushRegisterUpdateAgentTaskCommand} "register"
|
||||
Pop $0
|
||||
${If} "$0" != ""
|
||||
${LogMsg} "Registering update agent task: $0"
|
||||
nsExec::Exec $0
|
||||
Pop $0
|
||||
${LogMsg} "nsExec::Exec returned $0"
|
||||
${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}"
|
||||
|
|
|
@ -159,6 +159,25 @@
|
|||
${EndIf}
|
||||
!endif
|
||||
|
||||
!ifdef MOZ_UPDATE_AGENT
|
||||
; This macro runs the update agent with the update-task-local-service
|
||||
; command, if it detects the needed admin privileges. Otherwise it
|
||||
; runs with update-task.
|
||||
; Both commands attempt to remove the scheduled task, then register
|
||||
; a new one. If the task was registered by an elevated user, it won't
|
||||
; be removable when not elevated, so the unelevated attempt will fail
|
||||
; harmlessly.
|
||||
; Therefore it is safe to run this in both elevated and nonelevated
|
||||
; PostUpdate: The highest privileged run will win out, so the task can
|
||||
; run as Local Service if it was ever possible to register it that way.
|
||||
${PushRegisterUpdateAgentTaskCommand} "update"
|
||||
Pop $0
|
||||
${If} "$0" != ""
|
||||
nsExec::Exec $0
|
||||
Pop $0
|
||||
${EndIf}
|
||||
!endif
|
||||
|
||||
!ifdef MOZ_LAUNCHER_PROCESS
|
||||
${ResetLauncherProcessDefaults}
|
||||
!endif
|
||||
|
@ -1384,6 +1403,7 @@
|
|||
Push "minidump-analyzer.exe"
|
||||
Push "pingsender.exe"
|
||||
Push "updater.exe"
|
||||
Push "updateagent.exe"
|
||||
Push "${FileMainEXE}"
|
||||
!macroend
|
||||
!define PushFilesToCheck "!insertmacro PushFilesToCheck"
|
||||
|
@ -1648,3 +1668,44 @@ FunctionEnd
|
|||
!macroend
|
||||
!define ResetLauncherProcessDefaults "!insertmacro ResetLauncherProcessDefaults"
|
||||
!endif
|
||||
|
||||
!ifdef MOZ_UPDATE_AGENT
|
||||
; Push, onto the stack, the command line used to register (or update) the
|
||||
; update agent scheduled task.
|
||||
;
|
||||
; InitHashAppModelId must have already been called to set $AppUserModelID,
|
||||
; if that is empty then an empty string will be pushed instead.
|
||||
;
|
||||
; COMMAND_BASE must be "register" or "update". Both will remove any
|
||||
; pre-existing task and register a new one, but "update" will first attempt
|
||||
; to copy some settings.
|
||||
!macro PushRegisterUpdateAgentTaskCommand COMMAND_BASE
|
||||
Push $0
|
||||
Push $1
|
||||
|
||||
Call IsUserAdmin
|
||||
Pop $0
|
||||
; Register the update agent to run as Local Service if the user is an admin...
|
||||
${If} $0 == "true"
|
||||
; ...and if we have HKLM write access
|
||||
${AndIf} $TmpVal == "HKLM"
|
||||
StrCpy $1 "${COMMAND_BASE}-task-local-service"
|
||||
${Else}
|
||||
; Otherwise attempt to register the task for the current user.
|
||||
; If we had previously registered the task while elevated, then we shouldn't
|
||||
; be able to replace it now with another task of the same name, so this
|
||||
; will fail harmlessly.
|
||||
StrCpy $1 "${COMMAND_BASE}-task"
|
||||
${EndIf}
|
||||
|
||||
${If} "$AppUserModelID" != ""
|
||||
StrCpy $0 '"$INSTDIR\updateagent.exe" $1 "${UpdateAgentFullName} $AppUserModelID" "$AppUserModelID" "$INSTDIR"'
|
||||
${Else}
|
||||
StrCpy $0 ''
|
||||
${EndIf}
|
||||
|
||||
Pop $1
|
||||
Exch $0
|
||||
!macroend
|
||||
!define PushRegisterUpdateAgentTaskCommand "!insertmacro PushRegisterUpdateAgentTaskCommand"
|
||||
!endif
|
||||
|
|
|
@ -453,6 +453,11 @@ Section "Uninstall"
|
|||
DeleteRegValue HKCU ${MOZ_LAUNCHER_SUBKEY} "$INSTDIR\${FileMainEXE}|Telemetry"
|
||||
!endif
|
||||
|
||||
!ifdef MOZ_UPDATE_AGENT
|
||||
; Unregister the update agent
|
||||
nsExec::Exec '"$INSTDIR\updateagent.exe" unregister-task "${UpdateAgentFullName} $AppUserModelID"'
|
||||
!endif
|
||||
|
||||
${un.RemovePrecompleteEntries} "false"
|
||||
|
||||
${If} ${FileExists} "$INSTDIR\defaults\pref\channel-prefs.js"
|
||||
|
|
Загрузка…
Ссылка в новой задаче