trivial: Allow EFI application path to come from a different root

This commit is contained in:
Mario Limonciello 2018-07-10 12:11:25 -05:00 committed by Mario Limonciello
parent 10a4824cb0
commit e6e2bf9d97
3 changed files with 17 additions and 1 deletions

View File

@ -87,6 +87,7 @@ fu_uefi_get_built_app_path (GError **error)
const gchar *extension = "";
const gchar *suffix;
g_autofree gchar *source_path = NULL;
g_autofree gchar *prefix = NULL;
if (fu_uefi_secure_boot_enabled ())
extension = ".signed";
if (g_file_test (EFI_APP_LOCATION_BUILD, G_FILE_TEST_EXISTS))
@ -94,8 +95,9 @@ fu_uefi_get_built_app_path (GError **error)
suffix = fu_uefi_bootmgr_get_suffix (error);
if (suffix == NULL)
return NULL;
prefix = fu_common_get_path (FU_PATH_KIND_EFIAPPDIR);
source_path = g_strdup_printf ("%s/fwupd%s.efi%s",
EFI_APP_LOCATION,
prefix,
suffix,
extension);
if (!g_file_test (source_path, G_FILE_TEST_EXISTS)) {

View File

@ -850,6 +850,19 @@ fu_common_get_path (FuPathKind path_kind)
if (tmp != NULL)
return g_build_filename (tmp, DATADIR, PACKAGE_NAME, NULL);
return g_build_filename (DATADIR, PACKAGE_NAME, NULL);
/* /usr/libexec/fwupd/efi */
case FU_PATH_KIND_EFIAPPDIR:
tmp = g_getenv ("FWUPD_EFIAPPDIR");
if (tmp != NULL)
return g_strdup (tmp);
#ifdef EFI_APP_LOCATION
tmp = g_getenv ("SNAP");
if (tmp != NULL)
return g_build_filename (tmp, EFI_APP_LOCATION, NULL);
return g_strdup (EFI_APP_LOCATION);
#else
return NULL;
#endif
/* /etc/fwupd */
case FU_PATH_KIND_SYSCONFDIR_PKG:
basedir = fu_common_get_path (FU_PATH_KIND_SYSCONFDIR);

View File

@ -19,6 +19,7 @@ typedef enum {
typedef enum {
FU_PATH_KIND_CACHEDIR_PKG,
FU_PATH_KIND_DATADIR_PKG,
FU_PATH_KIND_EFIAPPDIR,
FU_PATH_KIND_LOCALSTATEDIR,
FU_PATH_KIND_LOCALSTATEDIR_PKG,
FU_PATH_KIND_PLUGINDIR_PKG,