Sync from SUSE:ALP:Source:Standard:1.0 fwupd-efi revision 536aac02a0a0d3fae094c98ac2243d04

This commit is contained in:
Adrian Schröter 2023-11-28 14:29:31 +01:00
commit db7fce48df
9 changed files with 579 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

294
ARM-fixes.patch Normal file
View File

@ -0,0 +1,294 @@
From ee8860bb75b6df50332858a199a20ac08795b5a7 Mon Sep 17 00:00:00 2001
From: Callum Farmer <gmbr3@opensuse.org>
Date: Wed, 14 Dec 2022 18:06:50 +0000
Subject: [PATCH 1/5] Use cflags in generate_sbat.py
This fixes a wchar length difference in fwup-sbat.o seen on ARM32
---
efi/generate_sbat.py | 3 ++-
efi/meson.build | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/efi/generate_sbat.py b/efi/generate_sbat.py
index c04918a..f445e13 100755
--- a/efi/generate_sbat.py
+++ b/efi/generate_sbat.py
@@ -18,8 +18,9 @@ def _generate_sbat(args):
FWUPD_SUMMARY = "Firmware update daemon"
FWUPD_URL = "https://github.com/fwupd/fwupd-efi"
+ cflags = args.cflags.split(" ")
subprocess.run(
- [args.cc, "-x", "c", "-c", "-o", args.outfile, "/dev/null"], check=True
+ [args.cc, "-x", "c", "-c", "-o", args.outfile, "/dev/null"] + cflags, check=True
)
# not specified
@@ -82,6 +82,7 @@ def _generate_sbat(args):
parser.add_argument(
"--cc", default="gcc", help="Compiler to use for generating sbat object"
)
+ parser.add_argument("--cflags", help="C compiler flags to be used by CC")
parser.add_argument(
"--objcopy", default="objcopy", help="Binary file to use for objcopy"
)
diff --git a/efi/meson.build b/efi/meson.build
index 8a5804c..0e29244 100644
--- a/efi/meson.build
+++ b/efi/meson.build
@@ -184,6 +184,7 @@ o_file5 = custom_target('fwup-sbat.o',
generate_sbat,
'@OUTPUT@',
'--cc', efi_cc,
+ '--cflags', ' '.join(compile_args),
'--objcopy', objcopy,
'--project-name', meson.project_name(),
'--project-version', meson.project_version(),
From 136c7e5774a50be56282ef8e3ecc489e140c6e8b Mon Sep 17 00:00:00 2001
From: Callum Farmer <gmbr3@opensuse.org>
Date: Sun, 1 Jan 2023 20:44:22 +0000
Subject: [PATCH 2/5] Passthrough whether manual symbol mode is being used on
ARM
---
efi/generate_binary.py | 11 ++++++++---
efi/meson.build | 3 +++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/efi/generate_binary.py b/efi/generate_binary.py
index 2979b7a..b1336a0 100755
--- a/efi/generate_binary.py
+++ b/efi/generate_binary.py
@@ -36,9 +36,9 @@ def _run_objcopy(args):
args.outfile,
]
- # aarch64 and arm32 don't have an EFI capable objcopy
- # Use 'binary' instead, and add required symbols manually
- if args.arch in ["aarch64", "arm"]:
+ # older objcopy for Aarch64 and ARM32 are not EFI capable.
+ # Use "binary" instead, and add required symbols manually.
+ if args.objcopy_manualsymbols:
argv.extend(["-O", "binary"])
elif args.os == "freebsd":
# `--target` option is missing and --input-target doesn't recognize
@@ -75,6 +75,11 @@ def _run_genpeimg(args):
parser.add_argument("--genpeimg", help="Binary file to use for genpeimg")
parser.add_argument("--arch", default="x86_64", help="EFI architecture")
parser.add_argument("--os", help="OS type")
+ parser.add_argument(
+ "--objcopy-manualsymbols",
+ type=int,
+ help="whether adding symbols direct to binary",
+ )
parser.add_argument("infile", help="Input file")
parser.add_argument("outfile", help="Output file")
_args = parser.parse_args()
diff --git a/efi/meson.build b/efi/meson.build
index 0e29244..72bea6d 100644
--- a/efi/meson.build
+++ b/efi/meson.build
@@ -145,9 +145,11 @@ efi_ldflags = ['-T',
'-L', efi_crtdir,
'-L', efi_libdir,
join_paths(efi_crtdir, arch_crt)]
+objcopy_manualsymbols = '0'
if objcopy_version.version_compare ('< 2.38') and (host_cpu == 'aarch64' or host_cpu == 'arm')
# older objcopy for Aarch64 and ARM32 are not EFI capable.
# Use 'binary' instead, and add required symbols manually.
+ objcopy_manualsymbols = '1'
efi_ldflags += ['--defsym=EFI_SUBSYSTEM=0xa']
efi_format = ['-O', 'binary']
else
@@ -222,6 +224,7 @@ app = custom_target(efi_name,
'--arch', gnu_efi_arch,
'--os', host_machine.system(),
'--objcopy', objcopy,
+ '--objcopy-manualsymbols', objcopy_manualsymbols,
'--genpeimg', genpeimg.found() ? genpeimg : ''
],
install : true,
From 44f12870f1253d47e64d551b6ebd1d5826e7d5f3 Mon Sep 17 00:00:00 2001
From: Callum Farmer <gmbr3@opensuse.org>
Date: Mon, 2 Jan 2023 14:10:00 +0000
Subject: [PATCH 3/5] Use manual symbols mode on ARM32 again
Most of the code for this is in binutils but
efi-app-arm target still doesn't exist
Partial revert of 8aff27ddefa9abbc0f5e221d7eaab5ef36a9c662
---
efi/meson.build | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/efi/meson.build b/efi/meson.build
index 72bea6d..b434179 100644
--- a/efi/meson.build
+++ b/efi/meson.build
@@ -76,7 +76,7 @@ if get_option('efi_sbat_distro_id') != ''
endif
# is the system crt0 for arm and aarch64 new enough to know about SBAT?
-if objcopy_version.version_compare ('< 2.38') and (host_cpu == 'aarch64' or host_cpu == 'arm')
+if host_cpu == 'arm' or (objcopy_version.version_compare ('< 2.38') and host_cpu == 'aarch64')
if get_option('efi_sbat_distro_id') != ''
arch_crt_source = 'crt0-efi-@0@.S'.format(gnu_efi_path_arch)
cmd = run_command('grep', '-q', 'sbat', join_paths(efi_crtdir, arch_crt))
@@ -146,7 +146,7 @@ efi_ldflags = ['-T',
'-L', efi_libdir,
join_paths(efi_crtdir, arch_crt)]
objcopy_manualsymbols = '0'
-if objcopy_version.version_compare ('< 2.38') and (host_cpu == 'aarch64' or host_cpu == 'arm')
+if host_cpu == 'arm' or (objcopy_version.version_compare ('< 2.38') and host_cpu == 'aarch64')
# older objcopy for Aarch64 and ARM32 are not EFI capable.
# Use 'binary' instead, and add required symbols manually.
objcopy_manualsymbols = '1'
From 6f2d3602f73e1bd71bb734902191a74a3c2ff132 Mon Sep 17 00:00:00 2001
From: Callum Farmer <gmbr3@opensuse.org>
Date: Fri, 6 Jan 2023 15:29:34 +0000
Subject: [PATCH 4/5] Rework objcopy-manualsymbols argument to generate-binary
Use store_true action instead of an integer value
---
efi/generate_binary.py | 2 +-
efi/generate_sbat.py | 6 +++++-
efi/meson.build | 21 +++++++++++++++------
3 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/efi/generate_binary.py b/efi/generate_binary.py
index b1336a0..042b7d3 100755
--- a/efi/generate_binary.py
+++ b/efi/generate_binary.py
@@ -77,7 +77,7 @@ def _run_genpeimg(args):
parser.add_argument("--os", help="OS type")
parser.add_argument(
"--objcopy-manualsymbols",
- type=int,
+ action="store_true",
help="whether adding symbols direct to binary",
)
parser.add_argument("infile", help="Input file")
diff --git a/efi/meson.build b/efi/meson.build
index b434179..0311f8a 100644
--- a/efi/meson.build
+++ b/efi/meson.build
@@ -34,6 +34,16 @@ if host_cpu == 'x86_64' and host_machine.system() == 'freebsd'
lds_os = '_fbsd'
endif
+# older objcopy for Aarch64 and ARM32 are not EFI capable.
+# Use 'binary' instead, and add required symbols manually.
+if host_cpu == 'arm' or (objcopy_version.version_compare ('< 2.38') and host_cpu == 'aarch64')
+ objcopy_manualsymbols = true
+ generate_binary_extra = ['--objcopy-manualsymbols']
+else
+ objcopy_manualsymbols = false
+ generate_binary_extra = []
+endif
+
arch_lds = 'efi.lds'
arch_crt = 'crt0.o'
if efi_ldsdir == ''
@@ -76,7 +86,7 @@ if get_option('efi_sbat_distro_id') != ''
endif
# is the system crt0 for arm and aarch64 new enough to know about SBAT?
-if host_cpu == 'arm' or (objcopy_version.version_compare ('< 2.38') and host_cpu == 'aarch64')
+if objcopy_manualsymbols
if get_option('efi_sbat_distro_id') != ''
arch_crt_source = 'crt0-efi-@0@.S'.format(gnu_efi_path_arch)
cmd = run_command('grep', '-q', 'sbat', join_paths(efi_crtdir, arch_crt))
@@ -145,11 +155,10 @@ efi_ldflags = ['-T',
'-L', efi_crtdir,
'-L', efi_libdir,
join_paths(efi_crtdir, arch_crt)]
-objcopy_manualsymbols = '0'
-if host_cpu == 'arm' or (objcopy_version.version_compare ('< 2.38') and host_cpu == 'aarch64')
+
+if objcopy_manualsymbols
# older objcopy for Aarch64 and ARM32 are not EFI capable.
# Use 'binary' instead, and add required symbols manually.
- objcopy_manualsymbols = '1'
efi_ldflags += ['--defsym=EFI_SUBSYSTEM=0xa']
efi_format = ['-O', 'binary']
else
@@ -224,9 +233,9 @@ app = custom_target(efi_name,
'--arch', gnu_efi_arch,
'--os', host_machine.system(),
'--objcopy', objcopy,
- '--objcopy-manualsymbols', objcopy_manualsymbols,
'--genpeimg', genpeimg.found() ? genpeimg : ''
- ],
+ ]
+ + generate_binary_extra,
install : true,
install_dir : efi_app_location)
From 9d6409827576a94ce780bf2bb450831821cd3765 Mon Sep 17 00:00:00 2001
From: Callum Farmer <gmbr3@opensuse.org>
Date: Mon, 23 Jan 2023 15:35:41 +0000
Subject: [PATCH 5/5] Add additional checks for incompatible CRT0
Add check for incompatible gnu-efi crt0 containing the header section
which gets added by objcopy and if used results in duplicate header
and subsequently a broken binary
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
---
efi/meson.build | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/efi/meson.build b/efi/meson.build
index 0311f8a..60e7aa6 100644
--- a/efi/meson.build
+++ b/efi/meson.build
@@ -34,16 +34,6 @@ if host_cpu == 'x86_64' and host_machine.system() == 'freebsd'
lds_os = '_fbsd'
endif
-# older objcopy for Aarch64 and ARM32 are not EFI capable.
-# Use 'binary' instead, and add required symbols manually.
-if host_cpu == 'arm' or (objcopy_version.version_compare ('< 2.38') and host_cpu == 'aarch64')
- objcopy_manualsymbols = true
- generate_binary_extra = ['--objcopy-manualsymbols']
-else
- objcopy_manualsymbols = false
- generate_binary_extra = []
-endif
-
arch_lds = 'efi.lds'
arch_crt = 'crt0.o'
if efi_ldsdir == ''
@@ -73,10 +63,27 @@ else
error('Cannot find @0@'.format(arch_lds))
endif
endif
+efi_crtdir = efi_ldsdir
+
+# If using objcopy, crt0 must not include the PE/COFF header
+if run_command('grep', '-q', 'coff_header', join_paths(efi_crtdir, arch_crt), check: false).returncode() == 0
+ coff_header_in_crt0 = true
+else
+ coff_header_in_crt0 = false
+endif
+
+# older objcopy for Aarch64 and ARM32 are not EFI capable.
+# Use 'binary' instead, and add required symbols manually.
+if host_cpu == 'arm' or (host_cpu == 'aarch64' and (objcopy_version.version_compare ('< 2.38') or coff_header_in_crt0))
+ objcopy_manualsymbols = true
+ generate_binary_extra = ['--objcopy-manualsymbols']
+else
+ objcopy_manualsymbols = false
+ generate_binary_extra = []
+endif
# is the system linker script new enough to know about SBAT?
# i.e. gnu-efi with https://github.com/vathpela/gnu-efi/pull/14 has been installed
-efi_crtdir = efi_ldsdir
if get_option('efi_sbat_distro_id') != ''
cmd = run_command('grep', '-q', 'sbat', join_paths(efi_ldsdir, arch_lds))
if cmd.returncode() != 0

14
_service Normal file
View File

@ -0,0 +1,14 @@
<services>
<service name="tar_scm" mode="manual">
<param name="url">https://github.com/fwupd/fwupd-efi.git</param>
<param name="scm">git</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="changesgenerate">enable</param>
<param name="revision">1.3</param>
</service>
<service name="recompress" mode="manual">
<param name="file">*.tar</param>
<param name="compression">xz</param>
</service>
<service name="set_version" mode="manual"/>
</services>

4
_servicedata Normal file
View File

@ -0,0 +1,4 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/fwupd/fwupd-efi.git</param>
<param name="changesrevision">36ce593f58e391cca43fd388824496ff98d83480</param></service></servicedata>

View File

@ -0,0 +1,40 @@
From 8aff27ddefa9abbc0f5e221d7eaab5ef36a9c662 Mon Sep 17 00:00:00 2001
From: Mario Limonciello <mario.limonciello@amd.com>
Date: Wed, 5 Oct 2022 09:57:41 -0500
Subject: [PATCH] Use objcopy to build arm/aarch64 binaries if binutils 2.38 or
newer Fixes: #24
---
efi/meson.build | 6 +++---
meson.build | 1 +
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/efi/meson.build b/efi/meson.build
index 936ba3c..e2446f3 100644
--- a/efi/meson.build
+++ b/efi/meson.build
@@ -150,9 +150,9 @@ efi_ldflags = ['-T',
'-L', efi_crtdir,
'-L', efi_libdir,
join_paths(efi_crtdir, arch_crt)]
-if host_cpu == 'aarch64' or host_cpu == 'arm'
- # Aarch64 and ARM32 don't have an EFI capable objcopy. Use 'binary'
- # instead, and add required symbols manually.
+if objcopy_version.version_compare ('< 2.38') and (host_cpu == 'aarch64' or host_cpu == 'arm')
+ # older objcopy for Aarch64 and ARM32 are not EFI capable.
+ # Use 'binary' instead, and add required symbols manually.
efi_ldflags += ['--defsym=EFI_SUBSYSTEM=0xa']
efi_format = ['-O', 'binary']
else
diff --git a/meson.build b/meson.build
index e6968a1..8b0f5e9 100644
--- a/meson.build
+++ b/meson.build
@@ -10,6 +10,7 @@ conf.set_quoted('PACKAGE_VERSION', meson.project_version())
cc = meson.get_compiler('c')
objcopy = find_program('objcopy')
+objcopy_version = run_command(objcopy, '--version').stdout().split('\n')[0].split(' ')[-1]
prefix = get_option('prefix')
libdir = join_paths(prefix, get_option('libdir'))

View File

@ -0,0 +1,23 @@
From 3d4b2b8f60a17dae311dc92d97b3ae120fe71e67 Mon Sep 17 00:00:00 2001
From: Callum Farmer <gmbr3@opensuse.org>
Date: Tue, 13 Dec 2022 21:16:30 +0000
Subject: [PATCH] Don't check ARM crt0 with binutils 2.38
If we have binutils 2.38, then the system crt0 doesn't need to contain the .sbat section as this will be handled by objcopy
---
efi/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/efi/meson.build b/efi/meson.build
index e2446f3..145c8a1 100644
--- a/efi/meson.build
+++ b/efi/meson.build
@@ -81,7 +81,7 @@ if get_option('efi_sbat_distro_id') != ''
endif
# is the system crt0 for arm and aarch64 new enough to know about SBAT?
-if host_cpu == 'aarch64' or host_cpu == 'arm'
+if objcopy_version.version_compare ('< 2.38') and (host_cpu == 'aarch64' or host_cpu == 'arm')
if get_option('efi_sbat_distro_id') != ''
arch_crt_source = 'crt0-efi-@0@.S'.format(gnu_efi_path_arch)
cmd = run_command('grep', '-q', 'sbat', join_paths(efi_crtdir, arch_crt))

BIN
fwupd-efi-1.3.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

75
fwupd-efi.changes Normal file
View File

@ -0,0 +1,75 @@
-------------------------------------------------------------------
Fri Feb 24 23:50:42 UTC 2023 - Callum Farmer <gmbr3@opensuse.org>
- Disable ix86 and arm32: shim doesn't build on these platforms
-------------------------------------------------------------------
Mon Jan 23 16:23:28 UTC 2023 - Callum Farmer <gmbr3@opensuse.org>
- Update ARM-fixes.patch to current git copy to add checks for
an incompatible crt0
-------------------------------------------------------------------
Mon Jan 2 14:37:32 UTC 2023 - Callum Farmer <gmbr3@opensuse.org>
- Add ARM-fixes.patch: multiple fixes for ARM EFI after binutils
2.38
- Remove arm32-short-wchar.patch: included in ARM-fixes.patch
-------------------------------------------------------------------
Wed Dec 14 18:44:26 UTC 2022 - Callum Farmer <gmbr3@opensuse.org>
- Add arm32-short-wchar.patch: fix an issue where fwup_sbat.o
had a different wchar length
-------------------------------------------------------------------
Tue Dec 13 18:03:57 UTC 2022 - gmbr3@opensuse.org
- Update to version 1.3:
* Release fwupd-efi 1.3
* Fix a regression when applying updates on an HP M60
* Show the version when starting fwupd-efi
* trivial: Update precommit versions to fix CI
* meson: fix ARM system crt0 name
* trivial: post release version bump
- Add binutils-2.38-arm-objcopy.patch: use objcopy with ARM on
binutils 2.38+
- Add binutils-2.38-arm-system-crt0.patch: system crt0 doesn't need
to contain the SBAT section if we have binutils 2.38+
- Enable ARM and ix86 support
-------------------------------------------------------------------
Thu Apr 14 14:09:02 UTC 2022 - Callum Farmer <gmbr3@opensuse.org>
- Use sbat macros (bsc#1193282)
-------------------------------------------------------------------
Fri Mar 11 14:44:21 UTC 2022 - Frederic Crozat <fcrozat@suse.com>
- Update to version 1.2:
* Release fwupd-efi 1.2
* meson: use stadard objcopy binary
* meson: use find_program() to find the helper scripts we run
* meson: using local copy ldscript when local copy crt0 be used for SBAT
* sbat: clarify project URL
* trivial: Ignore some markdown issues
* Wait 5 seconds to reboot on errors
* Port pre-commit clang-format, codespell, markdownlint from fwupd
* trivial: fixup python errors by codacity/precommit
* trivial: fixup markdown format
* trivial: spelling errors
* Sleep longer when no updates to process
* README: fix typo and URL
* trivial: post release version bump
- Remove 0001-meson-using-local-copy-ldscript-when-local-copy-crt0.patch
(merged upstream)
-------------------------------------------------------------------
Fri Nov 5 18:47:04 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
- Re-add fwupdx64.efi.signed symlink (boo#1192206)
-------------------------------------------------------------------
Thu Oct 7 05:39:32 UTC 2021 - Joey Lee <jlee@suse.com>
- Initial package. fwupd-efi 1.1.

103
fwupd-efi.spec Normal file
View File

@ -0,0 +1,103 @@
#
# spec file for package fwupd-efi
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# needssslcertforbuild
%if %{undefined sbat_distro}
%if 0%{?is_opensuse}
%define sbat_distro opensuse
%define sbat_distro_summary The openSUSE Project
%else
%define sbat_distro sle
%define sbat_distro_summary SUSE Linux Enterprise
%endif
%define sbat_distro_url mailto:security@suse.de
%endif
Name: fwupd-efi
Version: 1.3
Release: 0
Summary: Firmware update EFI binaries
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: System/Management
URL: https://github.com/fwupd/fwupd-efi
# Do not use upstream tarball, we are using source service!
Source0: %{name}-%{version}.tar.xz
Patch0: binutils-2.38-arm-objcopy.patch
Patch1: binutils-2.38-arm-system-crt0.patch
Patch2: ARM-fixes.patch
BuildRequires: gnu-efi
BuildRequires: meson >= 0.47.0
BuildRequires: pesign-obs-integration
BuildRequires: pkgconfig
BuildRequires: pkgconfig(efiboot)
BuildRequires: pkgconfig(efivar) >= 33
Requires: shim >= 11
ExclusiveArch: x86_64 aarch64
%description
A UEFI binary for the fwupd project for installing updates using the UpdateCapsule
runtime service.
It was originally imported from the combined fwupd project, and is now
maintained separately to allow fwupd userspace releases and fwupd-efi UEFI
executable releases to follow a different cadence.
%prep
%autosetup -p1
%build
# Dell support requires direct SMBIOS access,
# Synaptics requires Dell support, i.e. x86 only
%meson \
-Defi_sbat_distro_id="%{sbat_distro}" \
-Defi_sbat_distro_summary="%{sbat_distro_summary}" \
-Defi_sbat_distro_pkgname="%{name}" \
-Defi_sbat_distro_version="%{version}" \
-Defi_sbat_distro_url="%{sbat_distro_url}" \
%meson_build
%install
export BRP_PESIGN_FILES='%{_libexecdir}/fwupd/efi/fwupd*.efi'
%meson_install
# link fwupd*.efi.signed to fwupd*.efi (bsc#1129466)
FWUPD_EFI=`basename %{buildroot}/%{_libexecdir}/fwupd/efi/fwupd*.efi`
ln -s %{_libexecdir}/fwupd/efi/$FWUPD_EFI %{buildroot}/%{_libexecdir}/fwupd/efi/$FWUPD_EFI.signed
# do not need pc file yet
rm $RPM_BUILD_ROOT%{_libdir}/pkgconfig/fwupd-efi.pc
%postun
if [ -e /etc/os-release ]; then
. /etc/os-release
efi_distributor="$(echo "${NAME} ${VERSION}" | tr 'A-Z' 'a-z' | cut -d' ' -f1)"
fi
if [ "$1" = 0 ] && [ -d "/boot/efi/EFI/$efi_distributor" ]; then
# Remove all capsule files
rm -rf /boot/efi/EFI/"$efi_distributor"/fw
# Remove the UEFI firmware update program
rm -f /boot/efi/EFI/"$efi_distributor"/fwupd*.efi
fi
%files
%license COPYING
%doc README.md
%{_libexecdir}/fwupd
%changelog