[neon/backports-focal/fwupd-signed/Neon/unstable] /: add source from hirsuite https://launchpad.net/ubuntu/+source/fwupd-signed/1.38
Jonathan Riddell
null at kde.org
Tue May 25 14:00:48 BST 2021
Git commit 1c90675e6674937908de5efe88b011894b2a67e8 by Jonathan Riddell.
Committed on 25/05/2021 at 13:00.
Pushed by jriddell into branch 'Neon/unstable'.
add source from hirsuite https://launchpad.net/ubuntu/+source/fwupd-signed/1.38
A +36 -0 Makefile
A +34 -0 download-fwupd
https://invent.kde.org/neon/backports-focal/fwupd-signed/commit/1c90675e6674937908de5efe88b011894b2a67e8
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..74e87b3
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,36 @@
+include /usr/share/dpkg/default.mk
+
+EFI_NAME := UNKNOWN-EFI-NAME
+
+ifeq ($(DEB_HOST_ARCH),amd64)
+EFI_NAME := x64
+endif
+
+ifeq ($(DEB_HOST_ARCH),i386)
+EFI_NAME := ia32
+endif
+
+ifeq ($(DEB_HOST_ARCH),arm64)
+EFI_NAME := aa64
+endif
+
+ifeq ($(DEB_HOST_ARCH),armhf)
+EFI_NAME := arm
+endif
+
+SIGNED := \
+ fwupd$(EFI_NAME).efi.signed \
+ $(NULL)
+
+all: $(SIGNED)
+
+$(SIGNED):
+ ./download-fwupd
+
+install: $(SIGNED)
+ install -d $(DESTDIR)/usr/libexec/fwupd/efi
+ install -m0644 $(SIGNED) version \
+ $(DESTDIR)/usr/libexec/fwupd/efi/
+
+clean:
+ rm -f $(SIGNED) version
diff --git a/download-fwupd b/download-fwupd
new file mode 100755
index 0000000..2d21f4c
--- /dev/null
+++ b/download-fwupd
@@ -0,0 +1,34 @@
+#! /usr/bin/python3
+
+import re
+import shutil
+from urllib.parse import urlparse, urlunparse
+from urllib.request import urlopen
+
+import apt
+import apt_pkg
+
+ARCH_TO_EFI_NAME = {
+ 'amd64': 'x64',
+ 'i386': 'ia32',
+ 'arm64': 'aa64',
+ 'armhf': 'arm',
+}
+arch = apt_pkg.config['Apt::Architecture']
+efi_name = ARCH_TO_EFI_NAME[arch]
+cache = apt.Cache()
+fwupd_efi = cache["fwupd"].candidate
+pool_parsed = urlparse(fwupd_efi.uri)
+dists_dir = "/dists/%s/main/uefi/fwupd-%s/current/" % (
+ fwupd_efi.origins[0].archive, fwupd_efi.architecture)
+
+for base in (
+ "fwupd%s.efi.signed" %efi_name,
+ "version",
+ ):
+ dists_parsed = list(pool_parsed)
+ dists_parsed[2] = re.sub(r"/pool/.*", dists_dir + base, dists_parsed[2])
+ dists_uri = urlunparse(dists_parsed)
+ print("Downloading %s ..." % dists_uri)
+ with urlopen(dists_uri) as dists, open(base, "wb") as out:
+ shutil.copyfileobj(dists, out)
More information about the Neon-commits
mailing list