Optionally disable Polkit check with an environment variable

When running in a confined snap, it is not possible to check whether a
policies have been installed.
This commit is contained in:
Valentin David 2023-01-30 12:08:04 +01:00 committed by Mario Limonciello
parent ff8b3d26a4
commit 25dfb547c3
2 changed files with 9 additions and 3 deletions

View File

@ -20,6 +20,7 @@ with a non-standard filesystem layout.
* `FWUPD_DOWNLOAD_VERBOSE` can be used to show wget or curl output
* `FWUPD_PROFILE` can be used to set the profile traceback threshold value in ms
* `FWUPD_FUZZER_RUNNING` if the firmware format is being fuzzed
* `FWUPD_POLKIT_NOCHECK` if we should not check for polkit policies to be installed
* standard glibc variables like `LANG` are also honored for CLI tools that are translated
* libcurl respects the session proxy, e.g. `http_proxy`, `all_proxy`, `sftp_proxy` and `no_proxy`

View File

@ -3706,9 +3706,14 @@ static gboolean
fu_util_check_polkit_actions(GError **error)
{
#ifdef HAVE_POLKIT
g_autofree gchar *directory = fu_path_from_kind(FU_PATH_KIND_POLKIT_ACTIONS);
g_autofree gchar *filename =
g_build_filename(directory, "org.freedesktop.fwupd.policy", NULL);
g_autofree gchar *directory = NULL;
g_autofree gchar *filename = NULL;
if (g_getenv("FWUPD_POLKIT_NOCHECK") != NULL)
return TRUE;
directory = fu_path_from_kind(FU_PATH_KIND_POLKIT_ACTIONS);
filename = g_build_filename(directory, "org.freedesktop.fwupd.policy", NULL);
if (!g_file_test(filename, G_FILE_TEST_IS_REGULAR)) {
g_set_error_literal(
error,