From f45a34ad06a60230432396cbff5ff28c9223aa2c Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Sat, 3 Aug 2019 09:40:20 -0400 Subject: [PATCH] fwupd: wrap programs needed in PATH --- .../linux/firmware/fwupd/default.nix | 13 +++-- .../linux/firmware/fwupd/fix-paths.patch | 52 ------------------- 2 files changed, 6 insertions(+), 59 deletions(-) diff --git a/pkgs/os-specific/linux/firmware/fwupd/default.nix b/pkgs/os-specific/linux/firmware/fwupd/default.nix index a60417d8e231..e0d70b5d43eb 100644 --- a/pkgs/os-specific/linux/firmware/fwupd/default.nix +++ b/pkgs/os-specific/linux/firmware/fwupd/default.nix @@ -39,12 +39,7 @@ in stdenv.mkDerivation rec { ]; patches = [ - (substituteAll { - src = ./fix-paths.patch; - inherit flashrom efibootmgr bubblewrap; - tpm2_tools = "${tpm2-tools}"; - }) - + ./fix-paths.patch ./add-option-for-installation-sysconfdir.patch # installed tests are installed to different output @@ -77,7 +72,11 @@ in stdenv.mkDerivation rec { # doCheck = true; preFixup = '' - gappsWrapperArgs+=(--prefix XDG_DATA_DIRS : "${shared-mime-info}/share") + gappsWrapperArgs+=( + --prefix XDG_DATA_DIRS : "${shared-mime-info}/share" + # See programs reached with fu_common_find_program_in_path in source + --prefix PATH : "${stdenv.lib.makeBinPath [ flashrom efibootmgr bubblewrap tpm2-tools ]}" + ) ''; mesonFlags = [ diff --git a/pkgs/os-specific/linux/firmware/fwupd/fix-paths.patch b/pkgs/os-specific/linux/firmware/fwupd/fix-paths.patch index 51adef2e7870..9efd7b8d6abd 100644 --- a/pkgs/os-specific/linux/firmware/fwupd/fix-paths.patch +++ b/pkgs/os-specific/linux/firmware/fwupd/fix-paths.patch @@ -17,55 +17,3 @@ index 0cbb6f41..d757a81a 100755 - echo 'Creating stateful directory' - mkdir -p ${DESTDIR}${LOCALSTATEDIR}/lib/fwupd #fi -diff --git a/plugins/flashrom/fu-plugin-flashrom.c b/plugins/flashrom/fu-plugin-flashrom.c -index 598e0c42..a0a2c4a7 100644 ---- a/plugins/flashrom/fu-plugin-flashrom.c -+++ b/plugins/flashrom/fu-plugin-flashrom.c -@@ -52,7 +52,7 @@ fu_plugin_startup (FuPlugin *plugin, GError **error) - g_autoptr(GError) error_local = NULL; - - /* we need flashrom from the host system */ -- data->flashrom_fn = fu_common_find_program_in_path ("flashrom", &error_local); -+ data->flashrom_fn = fu_common_find_program_in_path ("@flashrom@/bin/flashrom", &error_local); - - /* search for devices */ - hwids = fu_plugin_get_hwids (plugin); -diff --git a/plugins/uefi/fu-plugin-uefi.c b/plugins/uefi/fu-plugin-uefi.c -index 9293715c..e2e77c58 100644 ---- a/plugins/uefi/fu-plugin-uefi.c -+++ b/plugins/uefi/fu-plugin-uefi.c -@@ -416,7 +416,7 @@ fu_plugin_update (FuPlugin *plugin, - fu_plugin_add_report_metadata (plugin, "MissingCapsuleHeader", str); - - /* record boot information to system log for future debugging */ -- efibootmgr_path = fu_common_find_program_in_path ("efibootmgr", NULL); -+ efibootmgr_path = fu_common_find_program_in_path ("@efibootmgr@/bin/efibootmgr", NULL); - if (efibootmgr_path != NULL) { - if (!g_spawn_command_line_sync ("efibootmgr -v", - &boot_variables, NULL, NULL, error)) -diff --git a/plugins/uefi/fu-uefi-pcrs.c b/plugins/uefi/fu-uefi-pcrs.c -index 5c7e5239..01acbf7f 100644 ---- a/plugins/uefi/fu-uefi-pcrs.c -+++ b/plugins/uefi/fu-uefi-pcrs.c -@@ -147,7 +147,7 @@ fu_uefi_pcrs_setup (FuUefiPcrs *self, GError **error) - /* old name, then new name */ - argv0 = fu_common_find_program_in_path ("tpm2_listpcrs", NULL); - if (argv0 == NULL) -- argv0 = fu_common_find_program_in_path ("tpm2_pcrlist", error); -+ argv0 = fu_common_find_program_in_path ("@tpm2_tools@/bin/tpm2_pcrlist", error); - if (argv0 == NULL) - return FALSE; - if (!fu_uefi_pcrs_setup_tpm20 (self, argv0, error)) -diff --git a/src/fu-common.c b/src/fu-common.c -index bd6faeef..45ba2a60 100644 ---- a/src/fu-common.c -+++ b/src/fu-common.c -@@ -436,7 +436,7 @@ fu_common_firmware_builder (GBytes *bytes, - g_return_val_if_fail (error == NULL || *error == NULL, NULL); - - /* find bwrap in the path */ -- bwrap_fn = fu_common_find_program_in_path ("bwrap", error); -+ bwrap_fn = fu_common_find_program_in_path ("@bubblewrap@/bin/bwrap", error); - if (bwrap_fn == NULL) - return NULL; -