From 8d46a4b1d8801c0e34eae511f79376328cdf4a21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Thu, 30 May 2024 10:12:11 +0000 Subject: [PATCH] system/kernel: Find kernel in ostree case --- kiwi/system/kernel.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/kiwi/system/kernel.py b/kiwi/system/kernel.py index 27f904c251e..ec7b66d2cd7 100644 --- a/kiwi/system/kernel.py +++ b/kiwi/system/kernel.py @@ -90,6 +90,27 @@ def get_kernel( filename=kernel_file, version=version ) + + boot_ostree_dir = os.sep.join([self.root_dir, 'boot/ostree']) + kernel_ostree_pattern = '.*/boot/ostree/.*/vmlinuz-(.*)' + if os.path.isdir(boot_ostree_dir): + for deployment in sorted(os.listdir(boot_ostree_dir)): + deployment_dir = os.sep.join([self.root_dir, 'boot/ostree', deployment]) + if os.path.isdir(deployment_dir): + files = sorted(os.listdir(deployment_dir)) + for f in files: + kernel_file = os.sep.join([self.root_dir, 'boot/ostree', deployment, f]) + version_match = re.match(kernel_ostree_pattern, kernel_file) + if version_match: + version = version_match.group(1) + return kernel_type( + name=os.path.basename( + os.path.realpath(kernel_file) + ), + filename=kernel_file, + version=version + ) + if raise_on_not_found: raise KiwiKernelLookupError( 'No kernel found in {0}, searched for {1}'.format(