From 92c24d89d19357e78375c222ae2ddf7c3bdfea4e Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 31 Jul 2024 18:01:12 +0200 Subject: [PATCH] Tweaks to support amd64 and i386 --- files_to_inject/isolinux/menu.cfg | 16 ++++++++-------- iso/injection.py | 17 ++++++++++------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/files_to_inject/isolinux/menu.cfg b/files_to_inject/isolinux/menu.cfg index 996ec49..9f92e3e 100644 --- a/files_to_inject/isolinux/menu.cfg +++ b/files_to_inject/isolinux/menu.cfg @@ -20,18 +20,18 @@ menu tabmsg default installgui label install menu label ^Text install - kernel /install.amd/vmlinuz - append preseed/file=/cdrom/preseeds/default.preseed vga=788 initrd=/install.amd/initrd.gz -- quiet + kernel /install.__ARCH__/vmlinuz + append preseed/file=/cdrom/preseeds/default.preseed vga=788 initrd=/install.__ARCH__/initrd.gz -- quiet label installgui menu label ^Graphical install (recommended) menu default - kernel /install.amd/vmlinuz - append preseed/file=/cdrom/preseeds/default.preseed video=vesa:ywrap,mtrr vga=788 initrd=/install.amd/gtk/initrd.gz -- quiet + kernel /install.__ARCH__/vmlinuz + append preseed/file=/cdrom/preseeds/default.preseed video=vesa:ywrap,mtrr vga=788 initrd=/install.__ARCH__/gtk/initrd.gz -- quiet label expert menu label Expert text install - kernel /install.amd/vmlinuz - append preseed/file=/cdrom/preseeds/expert.preseed vga=788 initrd=/install.amd/initrd.gz -- quiet + kernel /install.__ARCH__/vmlinuz + append preseed/file=/cdrom/preseeds/expert.preseed vga=788 initrd=/install.__ARCH__/initrd.gz -- quiet label expertgui menu label Expert graphical install - kernel /install.amd/vmlinuz - append preseed/file=/cdrom/preseeds/expert.preseed video=vesa:ywrap,mtrr vga=788 initrd=/install.amd/gtk/initrd.gz -- quiet + kernel /install.__ARCH__/vmlinuz + append preseed/file=/cdrom/preseeds/expert.preseed video=vesa:ywrap,mtrr vga=788 initrd=/install.__ARCH__/gtk/initrd.gz -- quiet diff --git a/iso/injection.py b/iso/injection.py index 71c7448..0ebe290 100644 --- a/iso/injection.py +++ b/iso/injection.py @@ -481,25 +481,28 @@ def inject_files_into_iso( ) p.ok("MBR extraction complete.") + arch = "amd" if "amd64" in path_to_input_iso_file.name else "386" + # For some reason this 'xen' thing takes up an extra 50-70ish MB compared # to the original iso ... not sure to understand ... but doesn't seem to be # actually used anywhere so let's get rid of it to save space ... - os.system(f"chmod +w '{path_to_extracted_iso_dir}/install.amd'") - os.system(f"chmod -R +w '{path_to_extracted_iso_dir}/install.amd/xen'") - os.system(f"rm -rf '{path_to_extracted_iso_dir}/install.amd/xen'") - os.system(f"chmod -w '{path_to_extracted_iso_dir}/install.amd'") + os.system(f"chmod +w '{path_to_extracted_iso_dir}/install.{arch}'") + os.system(f"chmod -R +w '{path_to_extracted_iso_dir}/install.{arch}/xen'") + os.system(f"rm -rf '{path_to_extracted_iso_dir}/install.{arch}/xen'") + os.system(f"chmod -w '{path_to_extracted_iso_dir}/install.{arch}'") # ADd the input files to the extracted ISO - os.system(f"chmod +w {path_to_extracted_iso_dir}/isolinux/*") + os.system(f"chmod -R +w {path_to_extracted_iso_dir}/isolinux") os.system(f"cp -r ./files_to_inject/* {path_to_extracted_iso_dir}/") - os.system(f"chmod -w {path_to_extracted_iso_dir}/isolinux/*") + os.system(f'sed "s@__ARCH__@{arch}@g" -i "{path_to_extracted_iso_dir}/isolinux/menu.cfg"') + os.system(f"chmod -R -w {path_to_extracted_iso_dir}/isolinux") # This stuff gotta go into the initrd with cpio trick etc temp_file_dir = TemporaryDirectory() os.system(f"mkdir -p {temp_file_dir.name}/usr/share/graphics/") os.system(f"cp ./files_to_inject/logo.png {temp_file_dir.name}/usr/share/graphics/logo_debian.png") append_file_contents_to_initrd_archive( - path_to_extracted_iso_dir/"install.amd"/"gtk"/"initrd.gz", + path_to_extracted_iso_dir/f"install.{arch}"/"gtk"/"initrd.gz", temp_file_dir.name, "usr/share/graphics/logo_debian.png" )