mkarchiso: move /boot/grub/YYYY-mm-dd-HH-MM-SS-00.uuid to /boot/YYYY-mm-dd-HH-MM-SS-00.uuid

Once mkinitcpio-archiso implements searching for the file in early
userspace, this file's use will not be limited to just GRUB.

Related to https://gitlab.archlinux.org/archlinux/archiso/-/issues/217
This commit is contained in:
nl6720 2024-03-24 18:22:46 +02:00
parent 7dd615ea83
commit 84843f5c27
No known key found for this signature in database
GPG key ID: 6B5387E670A955AD
2 changed files with 14 additions and 14 deletions

View file

@ -13,6 +13,10 @@ Added
Changed Changed
------- -------
- Move ``/boot/grub/YYYY-mm-dd-HH-MM-SS-00.uuid`` to ``/boot/YYYY-mm-dd-HH-MM-SS-00.uuid`` and always create the file.
Once mkinitcpio-archiso implements searching for the file in early userspace, this file's use will not be limited to
just GRUB.
Deprecated Deprecated
---------- ----------

View file

@ -34,6 +34,7 @@ pacman_conf=""
packages="" packages=""
bootstrap_packages="" bootstrap_packages=""
pacstrap_dir="" pacstrap_dir=""
search_filename=""
declare -i rm_work_dir=0 declare -i rm_work_dir=0
buildmodes=() buildmodes=()
bootmodes=() bootmodes=()
@ -439,6 +440,7 @@ _make_boot_on_iso9660() {
fi fi
fi fi
done done
_msg_info "Done!" _msg_info "Done!"
} }
@ -562,16 +564,10 @@ _make_common_bootmode_grub_copy_to_isofs() {
# Prepare GRUB configuration files # Prepare GRUB configuration files
_make_common_bootmode_grub_cfg() { _make_common_bootmode_grub_cfg() {
local _cfg search_filename local _cfg
install -d -- "${work_dir}/grub" install -d -- "${work_dir}/grub"
# Create a /boot/grub/YYYY-mm-dd-HH-MM-SS-00.uuid file on ISO 9660. GRUB will search for it to find the ISO
# volume. This is similar to what grub-mkrescue does, except it places the file in /.disk/, but we opt to use a
# directory that does not start with a dot to avoid it being accidentally missed when copying the ISO's contents.
: >"${work_dir}/grub/${iso_uuid}.uuid"
search_filename="/boot/grub/${iso_uuid}.uuid"
# Fill GRUB configuration files # Fill GRUB configuration files
for _cfg in "${profile}/grub/"*'.cfg'; do for _cfg in "${profile}/grub/"*'.cfg'; do
sed "s|%ARCHISO_LABEL%|${iso_label}|g; sed "s|%ARCHISO_LABEL%|${iso_label}|g;
@ -639,15 +635,8 @@ EOF
# Create GRUB specific configuration files when GRUB is not used as a boot loader # Create GRUB specific configuration files when GRUB is not used as a boot loader
_make_common_grubenv_and_loopbackcfg() { _make_common_grubenv_and_loopbackcfg() {
local search_filename
install -d -m 0755 -- "${isofs_dir}/boot/grub" install -d -m 0755 -- "${isofs_dir}/boot/grub"
# Create a /boot/grub/YYYY-mm-dd-HH-MM-SS-00.uuid file on ISO 9660. GRUB will search for it to find the ISO
# volume. This is similar to what grub-mkrescue does, except it places the file in /.disk/, but we opt to use a
# directory that does not start with a dot to avoid it being accidentally missed when copying the ISO's contents.
search_filename="/boot/grub/${iso_uuid}.uuid"
: >"${isofs_dir}/${search_filename}"
# Write grubenv # Write grubenv
printf '%.1024s' \ printf '%.1024s' \
"$(printf '# GRUB Environment Block\nNAME=%s\nVERSION=%s\nARCHISO_LABEL=%s\nINSTALL_DIR=%s\nARCH=%s\nARCHISO_SEARCH_FILENAME=%s\n%s' \ "$(printf '# GRUB Environment Block\nNAME=%s\nVERSION=%s\nARCHISO_LABEL=%s\nINSTALL_DIR=%s\nARCH=%s\nARCHISO_SEARCH_FILENAME=%s\n%s' \
@ -1850,6 +1839,13 @@ _make_version() {
printf '%.1024s' "$(printf '# GRUB Environment Block\nNAME=%s\nVERSION=%s\n%s' \ printf '%.1024s' "$(printf '# GRUB Environment Block\nNAME=%s\nVERSION=%s\n%s' \
"${iso_name}" "${iso_version}" "$(printf '%0.1s' "#"{1..1024})")" \ "${iso_name}" "${iso_version}" "$(printf '%0.1s' "#"{1..1024})")" \
>"${isofs_dir}/${install_dir}/grubenv" >"${isofs_dir}/${install_dir}/grubenv"
# Create a /boot/YYYY-mm-dd-HH-MM-SS-00.uuid file on ISO 9660. GRUB will search for it to find the ISO
# volume. This is similar to what grub-mkrescue does, except it places the file in /.disk/, but we opt to use a
# directory that does not start with a dot to avoid it being accidentally missed when copying the ISO's contents.
search_filename="/boot/${iso_uuid}.uuid"
install -d -m 755 -- "${isofs_dir}/boot"
: >"${isofs_dir}${search_filename}"
fi fi
# Append IMAGE_ID & IMAGE_VERSION to os-release # Append IMAGE_ID & IMAGE_VERSION to os-release