mkarchiso: support %ARCHISO_UUID% variable in boot loader configuration
It will be replaced with the ISO's modification date in UTC, i.e. its "UUID". This allows to replace `archisolabel=%ARCHISO_LABEL%` with `archisodevice=UUID=%ARCHISO_UUID%` in boot loader configurations. Related to #202
This commit is contained in:
parent
b468327442
commit
094afd169a
@ -29,6 +29,7 @@ gpg_key=""
|
|||||||
gpg_sender=""
|
gpg_sender=""
|
||||||
iso_name=""
|
iso_name=""
|
||||||
iso_label=""
|
iso_label=""
|
||||||
|
iso_uuid=""
|
||||||
iso_publisher=""
|
iso_publisher=""
|
||||||
iso_application=""
|
iso_application=""
|
||||||
iso_version=""
|
iso_version=""
|
||||||
@ -446,6 +447,7 @@ _make_bootmode_bios.syslinux.mbr() {
|
|||||||
install -d -m 0755 -- "${isofs_dir}/boot/syslinux"
|
install -d -m 0755 -- "${isofs_dir}/boot/syslinux"
|
||||||
for _cfg in "${profile}/syslinux/"*.cfg; do
|
for _cfg in "${profile}/syslinux/"*.cfg; do
|
||||||
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
|
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
|
||||||
|
s|%ARCHISO_UUID%|${iso_uuid}|g;
|
||||||
s|%INSTALL_DIR%|${install_dir}|g;
|
s|%INSTALL_DIR%|${install_dir}|g;
|
||||||
s|%ARCH%|${arch}|g" \
|
s|%ARCH%|${arch}|g" \
|
||||||
"${_cfg}" > "${isofs_dir}/boot/syslinux/${_cfg##*/}"
|
"${_cfg}" > "${isofs_dir}/boot/syslinux/${_cfg##*/}"
|
||||||
@ -558,21 +560,20 @@ _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 archiso_uuid search_filename
|
local _cfg search_filename
|
||||||
|
|
||||||
install -d -- "${work_dir}/grub"
|
install -d -- "${work_dir}/grub"
|
||||||
|
|
||||||
# Precalculate the ISO's modification date in UTC, i.e. its "UUID"
|
|
||||||
TZ=UTC printf -v archiso_uuid '%(%F-%H-%M-%S-00)T' "$SOURCE_DATE_EPOCH"
|
|
||||||
# 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
|
# 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
|
# 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.
|
# directory that does not start with a dot to avoid it being accidentally missed when copying the ISO's contents.
|
||||||
: > "${work_dir}/grub/${archiso_uuid}.uuid"
|
: > "${work_dir}/grub/${iso_uuid}.uuid"
|
||||||
search_filename="/boot/grub/${archiso_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;
|
||||||
|
s|%ARCHISO_UUID%|${iso_uuid}|g;
|
||||||
s|%INSTALL_DIR%|${install_dir}|g;
|
s|%INSTALL_DIR%|${install_dir}|g;
|
||||||
s|%ARCH%|${arch}|g;
|
s|%ARCH%|${arch}|g;
|
||||||
s|%ARCHISO_SEARCH_FILENAME%|${search_filename}|g" \
|
s|%ARCHISO_SEARCH_FILENAME%|${search_filename}|g" \
|
||||||
@ -821,6 +822,7 @@ _make_bootmode_uefi-x64.systemd-boot.esp() {
|
|||||||
mcopy -i "${efibootimg}" "${profile}/efiboot/loader/loader.conf" ::/loader/
|
mcopy -i "${efibootimg}" "${profile}/efiboot/loader/loader.conf" ::/loader/
|
||||||
for _conf in "${profile}/efiboot/loader/entries/"*".conf"; do
|
for _conf in "${profile}/efiboot/loader/entries/"*".conf"; do
|
||||||
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
|
sed "s|%ARCHISO_LABEL%|${iso_label}|g;
|
||||||
|
s|%ARCHISO_UUID%|${iso_uuid}|g;
|
||||||
s|%INSTALL_DIR%|${install_dir}|g;
|
s|%INSTALL_DIR%|${install_dir}|g;
|
||||||
s|%ARCH%|${arch}|g" \
|
s|%ARCH%|${arch}|g" \
|
||||||
"${_conf}" | mcopy -i "${efibootimg}" - "::/loader/entries/${_conf##*/}"
|
"${_conf}" | mcopy -i "${efibootimg}" - "::/loader/entries/${_conf##*/}"
|
||||||
@ -1660,6 +1662,8 @@ _set_overrides() {
|
|||||||
# Set variables that do not have overrides
|
# Set variables that do not have overrides
|
||||||
[[ -n "$airootfs_image_type" ]] || airootfs_image_type="squashfs"
|
[[ -n "$airootfs_image_type" ]] || airootfs_image_type="squashfs"
|
||||||
[[ -n "$iso_name" ]] || iso_name="${app_name}"
|
[[ -n "$iso_name" ]] || iso_name="${app_name}"
|
||||||
|
# Precalculate the ISO's modification date in UTC, i.e. its "UUID"
|
||||||
|
TZ=UTC printf -v iso_uuid '%(%F-%H-%M-%S-00)T' "$SOURCE_DATE_EPOCH"
|
||||||
}
|
}
|
||||||
|
|
||||||
_export_gpg_publickey() {
|
_export_gpg_publickey() {
|
||||||
|
Loading…
Reference in New Issue
Block a user