Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Commit

Permalink
Raise error if module copying fails
Browse files Browse the repository at this point in the history
  • Loading branch information
keszybz committed Oct 12, 2023
1 parent 838184d commit c4c0d7f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions mkosi.finalize
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def kernel_core_skip_file(path):
return any(fnmatch.fnmatch(path, pat)
for pat in patterns)

def copy_in_modules_from_rpmls(root, kver, rpms):
def copy_in_modules_from_rpmls(root, rpms):
try:
out = subprocess.check_output(['rpm', '-ql', *rpms], text=True)
except (FileNotFoundError, subprocess.CalledProcessError) as e:
Expand Down Expand Up @@ -83,7 +83,7 @@ def copy_in_modules_from_fs(root, kver):
print(f'Copied files from {source}')
return True

def copy_in_modules_from_cpio(root, kver, rpms):
def copy_in_modules_from_cpio(root, rpms):
file_filter = ['--nonmatching',
'./lib/modules/*/bls.conf', # a grub abomination with $grub_variables
'./lib/modules/*/vmlinuz']
Expand Down Expand Up @@ -121,9 +121,10 @@ def copy_in_modules_kver(root, kver):
if have_split:
rpms += [f'kernel-modules-core-{kver}']

copy_in_modules_from_rpmls(root, kver, rpms) or \
copy_in_modules_from_fs(root, kver) or \
copy_in_modules_from_cpio(root, kver, rpms)
if not (copy_in_modules_from_rpmls(root, rpms) or
copy_in_modules_from_fs(root, kver) or
copy_in_modules_from_cpio(root, rpms)):
raise Exception(f'Failed to copy modules for kernel {kver}')

subprocess.run(['depmod', '-a', '-w', '-b', root, kver], check=True)

Expand Down

0 comments on commit c4c0d7f

Please sign in to comment.