From 87a0edf0fc08e246294e91c7259d99828009b955 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 18 Aug 2022 16:50:29 -0400 Subject: [PATCH] Use rpm-ostree usroverlay for Firefox config on rpm-ostree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Editing the files under /ostree/deploy doesn't work on Rawhide any more because it's been made read-only. Thanks to Timothée Ravier for pointing out this way of doing it, which is better anyway and avoids awful quotation issues in the code. Signed-off-by: Adam Williamson --- lib/utils.pm | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/utils.pm b/lib/utils.pm index 2d12a618..e7a1e64f 100644 --- a/lib/utils.pm +++ b/lib/utils.pm @@ -411,10 +411,9 @@ sub check_release { } sub disable_firefox_studies { - # on canned (ostree) installs we need to get the prefix - my $prefix = ''; if (get_var("CANNED")) { - $prefix = script_output 'ls -d /ostree/deploy/fedora*/deploy/*.?'; + # enable rpm-ostree /usr overlay so we can write to /usr + assert_script_run "rpm-ostree usroverlay"; } # create a config file that disables Firefox's dumb 'shield # studies' so they don't break tests: @@ -425,21 +424,21 @@ sub disable_firefox_studies { # and *also* tries to disable "first run pages", though this # doesn't seem to be working yet: # https://bugzilla.mozilla.org/show_bug.cgi?id=1703903 - assert_script_run "mkdir -p $prefix" . '$(rpm --eval %_libdir)/firefox/distribution'; - assert_script_run 'printf \'{"policies": {"DisableFirefoxStudies": true, "OfferToSaveLogins": false, "OverrideFirstRunPage": "", "OverridePostUpdatePage": ""}}\' > ' . $prefix . '$(rpm --eval %_libdir)/firefox/distribution/policies.json'; + assert_script_run 'mkdir -p $(rpm --eval %_libdir)/firefox/distribution'; + assert_script_run 'printf \'{"policies": {"DisableFirefoxStudies": true, "OfferToSaveLogins": false, "OverrideFirstRunPage": "", "OverridePostUpdatePage": ""}}\' > $(rpm --eval %_libdir)/firefox/distribution/policies.json'; # Now create a preferences override file that disables the # quicksuggest and total cookie protection onboarding screens # see https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig # for why this wacky pair of files with required values is needed # and https://bugzilla.mozilla.org/show_bug.cgi?id=1703903 again # for the actual values - assert_script_run "mkdir -p $prefix" . '$(rpm --eval %_libdir)/firefox/browser/defaults/preferences'; - assert_script_run 'printf "// required comment\npref(\'general.config.filename\', \'openqa-overrides.cfg\');\npref(\'general.config.obscure_value\', 0);\n" > ' . $prefix . '$(rpm --eval %_libdir)/firefox/browser/defaults/preferences/openqa-overrides.js'; - assert_script_run 'printf "// required comment\npref(\'browser.urlbar.quicksuggest.shouldShowOnboardingDialog\', false);\npref(\'privacy.restrict3rdpartystorage.rollout.enabledByDefault\', false);\n" > ' . $prefix . '$(rpm --eval %_libdir)/firefox/openqa-overrides.cfg'; + assert_script_run 'mkdir -p $(rpm --eval %_libdir)/firefox/browser/defaults/preferences'; + assert_script_run 'printf "// required comment\npref(\'general.config.filename\', \'openqa-overrides.cfg\');\npref(\'general.config.obscure_value\', 0);\n" > $(rpm --eval %_libdir)/firefox/browser/defaults/preferences/openqa-overrides.js'; + assert_script_run 'printf "// required comment\npref(\'browser.urlbar.quicksuggest.shouldShowOnboardingDialog\', false);\npref(\'privacy.restrict3rdpartystorage.rollout.enabledByDefault\', false);\n" > $(rpm --eval %_libdir)/firefox/openqa-overrides.cfg'; # for debugging - upload_logs "$prefix/usr/lib64/firefox/browser/defaults/preferences/openqa-overrides.js", failok => 1; - upload_logs "$prefix/usr/lib64/firefox/openqa-overrides.cfg", failok => 1; - upload_logs "$prefix/usr/lib64/firefox/distribution/policies.json", failok => 1; + upload_logs "/usr/lib64/firefox/browser/defaults/preferences/openqa-overrides.js", failok => 1; + upload_logs "/usr/lib64/firefox/openqa-overrides.cfg", failok => 1; + upload_logs "/usr/lib64/firefox/distribution/policies.json", failok => 1; } sub repos_mirrorlist {