File 0001-Only-mount-var-lib-selinux-if-it-exists-jsc-PED-1249.patch of Package transactional-update

From 777cb0269e419982f1cff14e0a145da92ca7cc84 Mon Sep 17 00:00:00 2001
From: Cathy Hu <cahu@suse.de>
Date: Wed, 24 Sep 2025 11:23:24 +0200
Subject: [PATCH] Only mount /var/lib/selinux if it exists (jsc#PED-12492)

Otherwise t-u will fail in every transaction if /var/lib/selinux
does not exist. (which we want to make SELinux ready for image-based
systems)
---
 lib/Transaction.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/Transaction.cpp b/lib/Transaction.cpp
index ad30d46..f72821a 100644
--- a/lib/Transaction.cpp
+++ b/lib/Transaction.cpp
@@ -135,8 +135,10 @@ void Transaction::impl::snapMount() {
             // up in the root file system, but will always be shadowed by the real /var mount. Due to that they
             // also won't be relabelled at any time. During updates this may cause problems if packages try to
             // access those leftover directories with wrong permissions, so they have to be relabelled manually...
-            BindMount selinuxVar("/var/lib/selinux", 0, true);
-            selinuxVar.mount(bindDir);
+            if (fs::is_directory("/var/lib/selinux")) {
+                BindMount selinuxVar("/var/lib/selinux", 0, true);
+                selinuxVar.mount(bindDir);
+	    }
             BindMount selinuxEtc("/etc/selinux", 0, true);
             selinuxEtc.mount(bindDir);
 
-- 
2.51.0

openSUSE Build Service is sponsored by