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
This commit is contained in:
nl6720 2023-01-22 12:02:35 +02:00
parent ab3d78860e
commit 8d7ad3c629
No known key found for this signature in database
GPG Key ID: 5CE88535E188D369

View File

@ -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.