Fix migration from old fwupd versions

This commit is contained in:
Richard Hughes 2024-02-19 10:25:51 +00:00 committed by root
parent 9fdcc09416
commit 9492cbc899
3 changed files with 55 additions and 1 deletions

1
.fwupd.metadata Normal file
View File

@ -0,0 +1 @@
a8c8f0cc046ecff12e425484bc5ec1eb7fe49e90 fwupd-1.9.13.tar.xz

View File

@ -0,0 +1,47 @@
From 6fc21ec8364babc2edc57d6a39ee44c1e72cc6b2 Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
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

View File

@ -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 <richard@hughsie.com> 1.9.13-2
- Fix upgrade from fwupd < v1.9.5
- Resolves: #RHEL-15328
* Thu Feb 15 2024 Richard Hughes <richard@hughsie.com> 1.9.13-1
- Update to latest stable upstream version.
- Resolves: #RHEL-15328