cmd-buildextend-live: use dfd-relative for grub.cfg rename
This allows the glob to be relative to the live ISO root. Prep for
future patch which relies on this.
@@ -543,11 +543,13 @@ def generate_iso():
# Always replace live/EFI/{vendor} to actual live/EFI/{vendor_id}
# https://github.com/openshift/os/issues/954
- grubfilepath = ensure_glob(os.path.join(tmpdir, 'live/EFI/*/grub.cfg'))
+ dfd = os.open(tmpisoroot, os.O_RDONLY)
+ grubfilepath = ensure_glob('EFI/*/grub.cfg', dir_fd=dfd)
if len(grubfilepath) != 1:
raise Exception(f'Found != 1 grub.cfg files: {grubfilepath}')
srcpath = os.path.dirname(grubfilepath[0])
- os.renames(srcpath, os.path.join(os.path.dirname(srcpath), vendor_id))
+ os.rename(srcpath, f"EFI/{vendor_id}", src_dir_fd=dfd, dst_dir_fd=dfd)
+ os.close(dfd)
# Delete fallback and its CSV file. Its purpose is to create
# EFI boot variables, which we don't want when booting from
