Bug 1798743: add option to disable private browsing shortcut creation in the installer r=bytesized

This exists primarily to ensure that Enterprise installs can disable it (who also may disable private browsing by policy).

Differential Revision: https://phabricator.services.mozilla.com/D161207
This commit is contained in:
Ben Hearsum 2022-11-04 12:46:10 +00:00
parent ab03e2c723
commit ee3af9b1ba
4 changed files with 23 additions and 4 deletions

View File

@ -43,6 +43,9 @@ For options that accept ``true`` or ``false``, ``=true`` can be left off to get
For backwards compatibility, this option can also be spelled ``/StartMenuShortcuts`` (plural), however only one shortcut is ever created in the Start menu per installation.
``/PrivateBrowsingShortcut={true,false}``
Set to ``false`` to disable creating a private browsing shortcut in the start menu. ``true`` by default.
``/MaintenanceService={true,false}``
Set to ``false`` to disable installing the Mozilla Maintenance Service. This will effectively prevent users from installing Firefox updates if they do not have write permissions to the installation directory. ``true`` by default.

View File

@ -44,6 +44,7 @@
<Property Id="TASKBAR_SHORTCUT" Value="true" />
<Property Id="DESKTOP_SHORTCUT" Value="true" />
<Property Id="START_MENU_SHORTCUT" Value="true" />
<Property Id="PRIVATE_BROWSING_SHORTCUT" Value="true" />
<Property Id="INSTALL_MAINTENANCE_SERVICE" Value="true" />
<Property Id="REMOVE_DISTRIBUTION_DIR" Value="true" />
<Property Id="PREVENT_REBOOT_REQUIRED" Value="false" />
@ -61,13 +62,13 @@
too long, but they actually work just fine, the warning is spurious. -->
<CustomAction Id="RunInstallNoDir" Return="check" Execute="deferred"
HideTarget="no" Impersonate="no" BinaryKey="WrappedExe"
ExeCommand="/S /TaskbarShortcut=[TASKBAR_SHORTCUT] /DesktopShortcut=[DESKTOP_SHORTCUT] /StartMenuShortcut=[START_MENU_SHORTCUT] /MaintenanceService=[INSTALL_MAINTENANCE_SERVICE] /RemoveDistributionDir=[REMOVE_DISTRIBUTION_DIR] /PreventRebootRequired=[PREVENT_REBOOT_REQUIRED] /OptionalExtensions=[OPTIONAL_EXTENSIONS] /RegisterDefaultAgent=[REGISTER_DEFAULT_AGENT] /LaunchedFromMSI" />
ExeCommand="/S /TaskbarShortcut=[TASKBAR_SHORTCUT] /DesktopShortcut=[DESKTOP_SHORTCUT] /StartMenuShortcut=[START_MENU_SHORTCUT] /PrivateBrowsingShortcut=[PRIVATE_BROWSING_SHORTCUT] /MaintenanceService=[INSTALL_MAINTENANCE_SERVICE] /RemoveDistributionDir=[REMOVE_DISTRIBUTION_DIR] /PreventRebootRequired=[PREVENT_REBOOT_REQUIRED] /OptionalExtensions=[OPTIONAL_EXTENSIONS] /RegisterDefaultAgent=[REGISTER_DEFAULT_AGENT] /LaunchedFromMSI" />
<CustomAction Id="RunInstallDirPath" Return="check" Execute="deferred"
HideTarget="no" Impersonate="no" BinaryKey="WrappedExe"
ExeCommand="/S /InstallDirectoryPath=[INSTALL_DIRECTORY_PATH] /TaskbarShortcut=[TASKBAR_SHORTCUT] /DesktopShortcut=[DESKTOP_SHORTCUT] /StartMenuShortcut=[START_MENU_SHORTCUT] /MaintenanceService=[INSTALL_MAINTENANCE_SERVICE] /RemoveDistributionDir=[REMOVE_DISTRIBUTION_DIR] /PreventRebootRequired=[PREVENT_REBOOT_REQUIRED] /OptionalExtensions=[OPTIONAL_EXTENSIONS] /RegisterDefaultAgent=[REGISTER_DEFAULT_AGENT] /LaunchedFromMSI" />
ExeCommand="/S /InstallDirectoryPath=[INSTALL_DIRECTORY_PATH] /TaskbarShortcut=[TASKBAR_SHORTCUT] /DesktopShortcut=[DESKTOP_SHORTCUT] /StartMenuShortcut=[START_MENU_SHORTCUT] /PrivateBrowsingShortcut=[PRIVATE_BROWSING_SHORTCUT] /MaintenanceService=[INSTALL_MAINTENANCE_SERVICE] /RemoveDistributionDir=[REMOVE_DISTRIBUTION_DIR] /PreventRebootRequired=[PREVENT_REBOOT_REQUIRED] /OptionalExtensions=[OPTIONAL_EXTENSIONS] /RegisterDefaultAgent=[REGISTER_DEFAULT_AGENT] /LaunchedFromMSI" />
<CustomAction Id="RunInstallDirName" Return="check" Execute="deferred"
HideTarget="no" Impersonate="no" BinaryKey="WrappedExe"
ExeCommand="/S /InstallDirectoryName=[INSTALL_DIRECTORY_NAME] /TaskbarShortcut=[TASKBAR_SHORTCUT] /DesktopShortcut=[DESKTOP_SHORTCUT] /StartMenuShortcut=[START_MENU_SHORTCUT] /MaintenanceService=[INSTALL_MAINTENANCE_SERVICE] /RemoveDistributionDir=[REMOVE_DISTRIBUTION_DIR] /PreventRebootRequired=[PREVENT_REBOOT_REQUIRED] /OptionalExtensions=[OPTIONAL_EXTENSIONS] /RegisterDefaultAgent=[REGISTER_DEFAULT_AGENT] /LaunchedFromMSI" />
ExeCommand="/S /InstallDirectoryName=[INSTALL_DIRECTORY_NAME] /TaskbarShortcut=[TASKBAR_SHORTCUT] /DesktopShortcut=[DESKTOP_SHORTCUT] /StartMenuShortcut=[START_MENU_SHORTCUT] /PrivateBrowsingShortcut=[PRIVATE_BROWSING_SHORTCUT] /MaintenanceService=[INSTALL_MAINTENANCE_SERVICE] /RemoveDistributionDir=[REMOVE_DISTRIBUTION_DIR] /PreventRebootRequired=[PREVENT_REBOOT_REQUIRED] /OptionalExtensions=[OPTIONAL_EXTENSIONS] /RegisterDefaultAgent=[REGISTER_DEFAULT_AGENT] /LaunchedFromMSI" />
<CustomAction Id="RunExtractOnly" Return="check" Execute="deferred"
HideTarget="no" Impersonate="no" BinaryKey="WrappedExe"
ExeCommand="/ExtractDir=[EXTRACT_DIR]" />

View File

@ -41,6 +41,7 @@ Var AddStartMenuSC
Var AddTaskbarSC
Var AddQuickLaunchSC
Var AddDesktopSC
Var AddPrivateBrowsingSC
Var InstallMaintenanceService
Var InstallOptionalExtensions
Var ExtensionRecommender
@ -395,6 +396,10 @@ Section "-Application" APP_IDX
StrCpy $AddStartMenuSC "1"
${EndIf}
${If} $AddPrivateBrowsingSC == ""
StrCpy $AddPrivateBrowsingSC "1"
${EndIf}
; Default for creating Quick Launch shortcut (1 = create, 0 = don't create)
${If} $AddQuickLaunchSC == ""
; Don't install the quick launch shortcut on Windows 7
@ -619,7 +624,9 @@ Section "-Application" APP_IDX
; native "Pin to Taskbar" functionality can find an appropriate shortcut.
; See https://bugzilla.mozilla.org/show_bug.cgi?id=1762994 for additional
; background.
${AddPrivateBrowsingShortcut}
${If} $AddPrivateBrowsingSC == 1
${AddPrivateBrowsingShortcut}
${EndIf}
; Update lastwritetime of the Start Menu shortcut to clear the tile cache.
; Do this for both shell contexts in case the user has shortcuts in multiple

View File

@ -5622,6 +5622,13 @@
StrCpy $AddStartMenuSC "1"
${EndIf}
ReadINIStr $R8 $R7 "Install" "PrivateBrowsingShortcut"
${If} $R8 == "false"
StrCpy $AddPrivateBrowsingSC "0"
${ElseIfNot} ${Errors}
StrCpy $AddPrivateBrowsingSC "1"
${EndIf}
ReadINIStr $R8 $R7 "Install" "TaskbarShortcut"
${If} $R8 == "false"
StrCpy $AddTaskbarSC "0"
@ -5686,6 +5693,7 @@
; We still accept the plural version for backwards compatibility,
; but the singular version takes priority.
${InstallGetOption} $R8 "StartMenuShortcut" $AddStartMenuSC
${InstallGetOption} $R8 "PrivateBrowsingShortcut" $AddPrivateBrowsingSC
${InstallGetOption} $R8 "TaskbarShortcut" $AddTaskbarSC
${InstallGetOption} $R8 "MaintenanceService" $InstallMaintenanceService
${InstallGetOption} $R8 "RegisterDefaultAgent" $RegisterDefaultAgent