Skip to content

Commit

Permalink
system/kernel: Find kernel in ostree case
Browse files Browse the repository at this point in the history
  • Loading branch information
travier authored and schaefi committed Nov 14, 2024
1 parent e14f0e8 commit d044c51
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions kiwi/system/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

# project
from kiwi.command import Command
from kiwi.defaults import Defaults

from kiwi.exceptions import KiwiKernelLookupError

Expand Down Expand Up @@ -90,6 +91,28 @@ def get_kernel(
filename=kernel_file,
version=version
)

if Defaults.is_ostree(self.root_dir):
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(
Expand Down

0 comments on commit d044c51

Please sign in to comment.