]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
fix detecting vmlinuz file which was unreliably detected due to improper use of lstri... 168/head
authorFlorent Thiéry <florent.thiery@ubicast.eu>
Wed, 11 Oct 2017 08:28:55 +0000 (10:28 +0200)
committerFlorent Thiéry <florent.thiery@ubicast.eu>
Thu, 12 Oct 2017 09:01:04 +0000 (11:01 +0200)
mkosi

diff --git a/mkosi b/mkosi
index b79e3dca1ceb69514332a7a50d2bd3ea3296506c..ce01ceeec45b703a945979380aac844c09795979 100755 (executable)
--- a/mkosi
+++ b/mkosi
@@ -1373,8 +1373,13 @@ def find_kernel_file(workspace_root, pattern):
     # Look for the vmlinuz file in the workspace
     workspace_pattern = os.path.join(workspace_root, pattern.lstrip('/'))
     kernel_files = sorted(glob.glob(workspace_pattern))
-    # the path kernel-install expects is within the workspace reference as it is run from within the container
-    kernel_file = '/' + (kernel_files[0].lstrip(workspace_root))
+    kernel_file = kernel_files[0]
+    # The path the kernel-install script expects is within the workspace reference as it is run from within the container
+    if kernel_file.startswith(workspace_root):
+        kernel_file = kernel_file[len(workspace_root):]
+    else:
+        sys.stderr.write('Error, kernel file %s cannot be used as it is not in the workspace\n' % kernel_file)
+        return
     if len(kernel_files) > 1:
         print('Warning, more than one kernel file found, will use %s' % kernel_file)
     return kernel_file