- memtestimg = search_file('memtest', iso_mount)
- if memtestimg is None:
- logging.warn("Warning: memtest not found (that's fine if you don't need it)")
- else:
- exec_rsync(memtestimg, addons + 'memtest')
+ handle_addon_copy('memtest', addons, iso_mount)
+
+ # gpxe.lkrn
+ handle_addon_copy('gpxe.lkrn', addons, iso_mount)
+
+
+def glob_and_copy(filepattern, dst):
+ """Glob on specified filepattern and copy the result to dst
+
+ @filepattern: globbing pattern
+ @dst: target directory
+ """
+ for name in glob.glob(filepattern):
+ copy_if_exist(name, dst)
+
+def search_and_copy(filename, search_path, dst):
+ """Search for the specified filename at searchpath and copy it to dst
+
+ @filename: filename to look for
+ @search_path: base search file
+ @dst: destionation to copy the file to
+ """
+ file_location = search_file(filename, search_path)
+ copy_if_exist(file_location, dst)
+
+def copy_if_exist(filename, dst):
+ """Copy filename to dst if filename is set.