From 9492cbc899618ef23b16a95528d8f309bd2be83f Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 19 Feb 2024 10:25:51 +0000 Subject: [PATCH] Fix migration from old fwupd versions --- .fwupd.metadata | 1 + ...grate-from-v2-to-database-schema-v10.patch | 47 +++++++++++++++++++ fwupd.spec | 8 +++- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .fwupd.metadata create mode 100644 0001-Correctly-migrate-from-v2-to-database-schema-v10.patch diff --git a/.fwupd.metadata b/.fwupd.metadata new file mode 100644 index 0000000..f2835dd --- /dev/null +++ b/.fwupd.metadata @@ -0,0 +1 @@ +a8c8f0cc046ecff12e425484bc5ec1eb7fe49e90 fwupd-1.9.13.tar.xz diff --git a/0001-Correctly-migrate-from-v2-to-database-schema-v10.patch b/0001-Correctly-migrate-from-v2-to-database-schema-v10.patch new file mode 100644 index 0000000..d5b6957 --- /dev/null +++ b/0001-Correctly-migrate-from-v2-to-database-schema-v10.patch @@ -0,0 +1,47 @@ +From 6fc21ec8364babc2edc57d6a39ee44c1e72cc6b2 Mon Sep 17 00:00:00 2001 +From: Richard Hughes +Date: Sun, 18 Feb 2024 10:23:03 +0000 +Subject: [PATCH] Correctly migrate from v2 to database schema v10 + +Artificially bump the schema version to v11 to ensure the migration is done. + +diff --git a/src/fu-history.c b/src/fu-history.c +index 21a4fd3e8..3be03c3a7 100644 +--- a/src/fu-history.c ++++ b/src/fu-history.c +@@ -21,7 +21,20 @@ + #include "fu-history.h" + #include "fu-security-attr-common.h" + +-#define FU_HISTORY_CURRENT_SCHEMA_VERSION 10 ++/* ++ * v1 legacy schema ++ * v2 initial schema ++ * v3 add checksum_device to history ++ * v4 add protocol to history ++ * v5 create table approved_firmware ++ * v6 create table blocked_firmware ++ * v7 create table hsi_history ++ * v8 add release_id to history ++ * v9 add appstream_id to history ++ * v10 add version_format to history ++ * v11 no changes, bumped due to bungled migration to v10 ++ */ ++#define FU_HISTORY_CURRENT_SCHEMA_VERSION 11 + + static void + fu_history_finalize(GObject *object); +@@ -466,11 +479,12 @@ fu_history_create_or_migrate(FuHistory *self, guint schema_ver, GError **error) + case 8: + if (!fu_history_migrate_database_v8(self, error)) + return FALSE; +- break; + /* fall through */ + case 9: ++ case 10: + if (!fu_history_migrate_database_v9(self, error)) + return FALSE; ++ /* no longer fall through */ + break; + default: + /* this is probably okay, but return an error if we ever delete diff --git a/fwupd.spec b/fwupd.spec index ab91786..2e6f7a4 100644 --- a/fwupd.spec +++ b/fwupd.spec @@ -49,13 +49,14 @@ Summary: Firmware update daemon Name: fwupd Version: 1.9.13 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPLv2+ URL: https://github.com/fwupd/fwupd Source0: http://people.freedesktop.org/~hughsient/releases/%{name}-%{version}.tar.xz Source2: http://people.freedesktop.org/~hughsient/releases/fwupd-efi-1.4.tar.xz Patch101: 0001-generate_binary-Add-NX-COMPAT-flag-manually-when-gen.patch +Patch102: 0001-Correctly-migrate-from-v2-to-database-schema-v10.patch Source10: http://people.redhat.com/rhughes/dbx/DBXUpdate-20100307-x64.cab Source11: http://people.redhat.com/rhughes/dbx/DBXUpdate-20140413-x64.cab @@ -195,6 +196,7 @@ can be flashed using flashrom. It is probably not required on servers. %prep %setup -q +%patch102 -p1 mkdir -p subprojects/fwupd-efi tar xfvs %{SOURCE2} -C subprojects/fwupd-efi --strip-components=1 @@ -451,6 +453,10 @@ done %endif %changelog +* Mon Feb 19 2024 Richard Hughes 1.9.13-2 +- Fix upgrade from fwupd < v1.9.5 +- Resolves: #RHEL-15328 + * Thu Feb 15 2024 Richard Hughes 1.9.13-1 - Update to latest stable upstream version. - Resolves: #RHEL-15328