diff --git a/_multibuild b/_multibuild
deleted file mode 100644
index 0f6de97..0000000
--- a/_multibuild
+++ /dev/null
@@ -1,4 +0,0 @@
-
- openSUSE
- SLE
-
diff --git a/fwupd-jscSLE-11766-close-efidir-leap-gap.patch b/fwupd-jscSLE-11766-close-efidir-leap-gap.patch
new file mode 100644
index 0000000..8315076
--- /dev/null
+++ b/fwupd-jscSLE-11766-close-efidir-leap-gap.patch
@@ -0,0 +1,18 @@
+diff --git a/plugins/uefi/fu-uefi-common.c b/plugins/uefi/fu-uefi-common.c
+index 6cd55672..6a710cdb 100644
+--- a/plugins/uefi/fu-uefi-common.c
++++ b/plugins/uefi/fu-uefi-common.c
+@@ -227,9 +227,13 @@ fu_uefi_get_esp_path_for_os (const gchar *base)
+ g_autofree gchar *esp_path = NULL;
+ g_autoptr(GError) error_local = NULL;
+ g_autoptr(GHashTable) os_release = fwupd_get_os_release (&error_local);
++ g_auto(GStrv) split = NULL;
+ /* try to lookup /etc/os-release ID key */
+ if (os_release != NULL) {
+ os_release_id = g_hash_table_lookup (os_release, "ID");
++ /* Overide os_release_id for SLE and openSUSE */
++ split = g_strsplit (g_hash_table_lookup (os_release, "NAME"), " ", 2);
++ os_release_id = g_ascii_strdown (split[0], -1);
+ } else {
+ g_debug ("failed to get ID: %s", error_local->message);
+ }
diff --git a/fwupd.changes b/fwupd.changes
index 5e18c14..3f8dcc5 100644
--- a/fwupd.changes
+++ b/fwupd.changes
@@ -1,3 +1,12 @@
+-------------------------------------------------------------------
+Wed Sep 2 10:18:55 UTC 2020 - QK ZHU
+
+- Add fwupd-jscSLE-11766-close-efidir-leap-gap.patch: Set SLE and
+ openSUSE esp os dir at runtime (jsc#SLE-11766)
+- Drop _multibuild and build option -Defi_os_dir="%{efidir}": with
+ the above patch fwupd can detect esp os dir dynamically
+- Update the efidir related %post and %postun scripts in spec file
+
-------------------------------------------------------------------
Thu Jul 30 14:52:34 UTC 2020 - dimstar@opensuse.org
diff --git a/fwupd.spec b/fwupd.spec
index 83c4c3f..e3ad3b5 100644
--- a/fwupd.spec
+++ b/fwupd.spec
@@ -17,34 +17,11 @@
# needssslcertforbuild
-%define flavor @BUILD_FLAVOR@%{nil}
-
-%if "%{flavor}" == ""
-ExclusiveArch: %{nil}
-%else
-%define branding_name %{flavor}
-%if "%{flavor}" == "SLE"
-%define build_SLE 1
-%else
-%define build_openSUSE 1
-%endif
-%endif
-
-%if (0%{?build_SLE} && 0%{?is_opensuse}) || (0%{?build_openSUSE} && ! 0%{?is_opensuse})
-# Don't build SLE branding on openSUSE and vice-versa
-ExclusiveArch: %{nil}
-%endif
-
%ifarch %{ix86} x86_64 aarch64
%bcond_without efi_fw_update
%else
%bcond_with efi_fw_update
%endif
-%if 0%{?build_openSUSE}
-%global efidir opensuse
-%else
-%global efidir sles
-%endif
Name: fwupd
Version: 1.4.5
@@ -59,6 +36,8 @@ Source: %{name}-%{version}.tar.xz
# PATCH-FIX-OPENSUSE fwupd-bsc1130056-shim-path.patch bsc#1130056
Patch1: fwupd-bsc1130056-change-shim-path.patch
+# PATCH-FIX-OPENSUSE fwupd-jscSLE-11766-close-efidir-leap-gap.patch jsc#SLE-11766 qkzhu@suse.com -- Set SLE and openSUSE esp os dir at runtime
+Patch2: fwupd-jscSLE-11766-close-efidir-leap-gap.patch
BuildRequires: dejavu-fonts
BuildRequires: fish
@@ -205,8 +184,6 @@ done
-Dplugin_nvme=false \
-Dplugin_redfish=false \
-Dplugin_uefi=false \
-%else
- -Defi_os_dir="%{efidir}" \
%endif
%ifnarch %{ix86} x86_64
-Dplugin_dell=false \
@@ -254,23 +231,19 @@ ln -s %{_libexecdir}/fwupd/efi/$FWUPD_EFI %{buildroot}/%{_libexecdir}/fwupd/efi/
%post
%udev_rules_update
%service_add_post %{name}.service fwupd-offline-update.service
-%if %{with efi_fw_update}
-if [ -d "/boot/efi/EFI/%{efidir}" ]; then
- # Create the directory for firwmare update capsules
- mkdir -p /boot/efi/EFI/%{efidir}/fw
- # Install the UEFI firmware update program
- cp %{_libexecdir}/fwupd/efi/fwupd*.efi /boot/efi/EFI/%{efidir}
-fi
-%endif
%postun
%service_del_postun %{name}.service fwupd-offline-update.service
%if %{with efi_fw_update}
-if [ "$1" = 0 ] && [ -d "/boot/efi/EFI/%{efidir}" ] ; then
- # Remove all capsule files
- rm -rf /boot/efi/EFI/%{efidir}/fw
- # Remove the UEFI firmware update program
- rm -f /boot/efi/EFI/%{efidir}/fwupd*.efi
+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
%endif