Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archiso/mkarchiso
diff options
context:
space:
mode:
Diffstat (limited to 'archiso/mkarchiso')
-rwxr-xr-xarchiso/mkarchiso43
1 files changed, 41 insertions, 2 deletions
diff --git a/archiso/mkarchiso b/archiso/mkarchiso
index a727a1a..7890615 100755
--- a/archiso/mkarchiso
+++ b/archiso/mkarchiso
@@ -420,6 +420,10 @@ _make_bootmodes() {
for bootmode in "${bootmodes[@]}"; do
_run_once "_make_bootmode_${bootmode}"
done
+
+ if [[ "${bootmodes[*]}" != *grub* ]]; then
+ _run_once _make_common_grubenv_and_loopbackcfg
+ fi
}
# Copy kernel and initramfs to ISO 9660
@@ -638,6 +642,40 @@ EOF
>"${work_dir}/grub/grubenv"
}
+# Create GRUB specific configuration files when GRUB is not used as a boot loader
+_make_common_grubenv_and_loopbackcfg() {
+ local search_filename
+
+ 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
+ printf '%.1024s' \
+ "$(printf '# GRUB Environment Block\nNAME=%s\nVERSION=%s\nARCHISO_LABEL=%s\nINSTALL_DIR=%s\nARCH=%s\nARCHISO_SEARCH_FILENAME=%s\n%s' \
+ "${iso_name}" \
+ "${iso_version}" \
+ "${iso_label}" \
+ "${install_dir}" \
+ "${arch}" \
+ "${search_filename}" \
+ "$(printf '%0.1s' "#"{1..1024})")" \
+ >"${isofs_dir}/boot/grub/grubenv"
+
+ # Copy loopback.cfg to /boot/grub/ on ISO 9660
+ if [[ -e "${profile}/grub/loopback.cfg" ]]; then
+ sed "s|%ARCHISO_LABEL%|${iso_label}|g;
+ s|%ARCHISO_UUID%|${iso_uuid}|g;
+ s|%INSTALL_DIR%|${install_dir}|g;
+ s|%ARCH%|${arch}|g;
+ s|%ARCHISO_SEARCH_FILENAME%|${search_filename}|g" \
+ "${profile}/grub/loopback.cfg" >"${isofs_dir}/boot/grub/loopback.cfg"
+ fi
+}
+
_make_bootmode_uefi-ia32.grub.esp() {
local grubmodules=()
@@ -1800,8 +1838,9 @@ _make_version() {
fi
if [[ "${buildmode}" == "iso" ]]; then
# Write grubenv with version information to ISO 9660
- # TODO: after sufficient time has passed, do not create this file anymore when GRUB boot modes are used.
- # _make_common_bootmode_grub_cfg already creates ${isofs_dir}/boot/grub/grubenv
+ # TODO: after sufficient time has passed, do not create this file anymore.
+ # _make_common_bootmode_grub_cfg and _make_common_grubenv_and_loopbackcfg already create a
+ # ${isofs_dir}/boot/grub/grubenv file
rm -f -- "${isofs_dir}/${install_dir}/grubenv"
printf '%.1024s' "$(printf '# GRUB Environment Block\nNAME=%s\nVERSION=%s\n%s' \
"${iso_name}" "${iso_version}" "$(printf '%0.1s' "#"{1..1024})")" \