From 8d7ad3c629e1a2d0cb2f2008e62ea979639230e7 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sun, 22 Jan 2023 12:02:35 +0200 Subject: mkarchiso: write a .uuid file to /.disk/ on ISO 9660 to allow GRUB to search for it Create a `/.disk/INSERT_UUID_HERE.uuid` file to implement something called "file system transposition". See https://www.mail-archive.com/grub-devel@gnu.org/msg34346.html for the proposal of it for grub-mkrescue. This will allow GRUB to search for the volume containing the file instead of hardcoding the ISO volume label or another file system or partition attribute in GRUB configuration. By only relying on the directory structure simplifies supporting medium preparation methods with manual partitioning such as https://wiki.archlinux.org/title/USB_flash_installation_medium#In_GNU/Linux_4 --- archiso/mkarchiso | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 7331bb0..f8a3df1 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -569,7 +569,13 @@ _make_common_bootmode_grub_copy_to_isofs() { # Prepare GRUB configuration files _make_common_bootmode_grub_cfg(){ - local _cfg + local _cfg uuid_search_filename + + # Create a .uuid file and place it in /.disk/ on ISO 9660 to provide a way for GRUB to search for the volume + uuid_search_filename="$(uuidgen --sha1 --namespace 93a870ff-8565-4cf3-a67b-f47299271a96 \ + --name "${SOURCE_DATE_EPOCH} disk search UUID")" + install -d -m 0755 -- "${isofs_dir}/.disk" + : > "${isofs_dir}/.disk/${uuid_search_filename}.uuid" install -d -- "${work_dir}/grub" @@ -577,7 +583,8 @@ _make_common_bootmode_grub_cfg(){ for _cfg in "${profile}/grub/"*'.cfg'; do sed "s|%ARCHISO_LABEL%|${iso_label}|g; s|%INSTALL_DIR%|${install_dir}|g; - s|%ARCH%|${arch}|g" \ + s|%ARCH%|${arch}|g; + s|%UUID_SEARCH_FILENAME%|${uuid_search_filename}|g" \ "${_cfg}" > "${work_dir}/grub/${_cfg##*/}" done # Add all GRUB files to the list of files used to calculate the required FAT image size. -- cgit v1.2.3-54-g00ecf