Skip to content

Commit

Permalink
grml2usb: abort if required logo.16 file is missing
Browse files Browse the repository at this point in the history
Instead of crashing with a type coercion error in popen (because
the logo file is None, then).
  • Loading branch information
zeha committed Oct 13, 2019
1 parent 4d85901 commit d3008fb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions grml2usb
Expand Up @@ -315,7 +315,7 @@ def get_defaults_file(iso_mount, flavour, name):
return ('', '')


def search_file(filename, search_path='/bin' + os.pathsep + '/usr/bin', lst_return=False):
def search_file(filename, search_path='/bin' + os.pathsep + '/usr/bin', lst_return=False, required=False):
"""Given a search path, find file
@filename: name of file to search for
Expand Down Expand Up @@ -344,6 +344,10 @@ def search_file(filename, search_path='/bin' + os.pathsep + '/usr/bin', lst_retu
retval.append(os.path.abspath(os.path.join(current_dir, filename)))
if not lst_return:
break

if required and not retval:
raise CriticalException("Required file %s not found in %s" % (filename, search_path))

if lst_return:
return retval
elif retval:
Expand Down Expand Up @@ -1108,7 +1112,7 @@ def copy_bootloader_files(iso_mount, target, grml_flavour):
grub_target = target + '/boot/grub/'
execute(mkdir, grub_target)

logo = search_file('logo.16', iso_mount)
logo = search_file('logo.16', iso_mount, required=True)
exec_rsync(logo, syslinux_target + 'logo.16')

bootx64_efi = search_file('bootx64.efi', iso_mount)
Expand Down

0 comments on commit d3008fb

Please sign in to comment.