#!/usr/bin/env bash set -euo pipefail ############################################################################### # Linux Mint 22.3 Aamsveen Audio Kiosk ISO builder # # Version: v7 # # Purpose: # # Build a customized Linux Mint 22.3 Cinnamon ISO with: # # 1. Normal "Start Linux Mint" live boot # 2. "Unattended Install Aamsveen Kiosk" boot option # 3. Boot menu waits indefinitely for user input # 4. UEFI + legacy BIOS boot support # 5. USB-hybrid layout generated DIRECTLY by xorriso # # IMPORTANT: # # We deliberately DO NOT run "isohybrid" after xorriso. # # xorriso itself creates the hybrid MBR/GPT/APM layout. # # CRITICAL UEFI DESIGN: # # The original Linux Mint EFI image contains: # # boot/grub/grub.cfg # # containing: # # search --set=root --file /.disk/info # set prefix=($root)/boot/grub # configfile ($root)/boot/grub/grub.cfg # # THIS FILE MUST NOT BE REPLACED. # # The EFI loader first finds the ISO filesystem using /.disk/info and then # loads the REAL ISO-level: # # /boot/grub/grub.cfg # # Therefore: # # /boot/grub/grub.cfg # = our custom UEFI menu # # /boot/grub/efi.img # = original Mint EFI image, untouched # # This fixes: # # error: file /casper/vmlinuz not found # # which occurred when the custom menu was incorrectly placed inside # efi.img/grub.cfg. ############################################################################### set -o pipefail ############################################################################### # Configuration ############################################################################### BASE_ISO_FILENAME="linuxmint-22.3-cinnamon-64bit.iso" NEW_ISO_FILENAME="non-aamsveen-audio-kiosk_v7.iso" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ISO_PATH="$SCRIPT_DIR/$BASE_ISO_FILENAME" SCRIPT_PATH="$SCRIPT_DIR/install-kiosk-nl.sh" PRESEED_PATH="$SCRIPT_DIR/preseed.cfg" WORK_DIR="$SCRIPT_DIR/build-aamsveen" NEW_ISO_PATH="$SCRIPT_DIR/$NEW_ISO_FILENAME" ############################################################################### # Helper functions ############################################################################### die() { echo echo "ERROR: $*" >&2 exit 1 } log() { echo echo "============================================================" echo "$*" echo "============================================================" } require_command() { command -v "$1" >/dev/null 2>&1 \ || die "Required command not found: $1" } ############################################################################### # Check dependencies ############################################################################### log "Controleer benodigde programma's" for cmd in \ xorriso \ unsquashfs \ mksquashfs \ find \ sed \ awk \ stat \ mount \ umount \ dd \ cmp \ sudo do require_command "$cmd" done ############################################################################### # Check input files ############################################################################### log "Controleer invoerbestanden" [[ -f "$ISO_PATH" ]] \ || die "Basis-ISO niet gevonden: $ISO_PATH" [[ -f "$SCRIPT_PATH" ]] \ || die "Installatiescript niet gevonden: $SCRIPT_PATH" [[ -f "$PRESEED_PATH" ]] \ || die "Preseed niet gevonden: $PRESEED_PATH" echo "Basis ISO : $ISO_PATH" echo "Preseed : $PRESEED_PATH" echo "Installer : $SCRIPT_PATH" echo "Output : $NEW_ISO_PATH" ############################################################################### # Check xorriso ############################################################################### log "Controleer xorriso" XORRISO_VERSION="$(xorriso -version | head -n 1 || true)" echo "$XORRISO_VERSION" ############################################################################### # Remove previous build directory ############################################################################### log "Verwijder oude werkmap" if [[ -d "$WORK_DIR" ]]; then rm -rf "$WORK_DIR" fi mkdir -p "$WORK_DIR" ############################################################################### # Remove previous output ISO ############################################################################### if [[ -f "$NEW_ISO_PATH" ]]; then log "Verwijder oude output ISO" rm -f "$NEW_ISO_PATH" fi ############################################################################### # Extract ORIGINAL ISO MBR boot code # # The original Linux Mint ISO contains the hybrid boot code in the first # 432 bytes of the MBR. # # We reuse ONLY the boot code. # # We do NOT copy the original partition table. # xorriso creates the new hybrid partition metadata itself. ############################################################################### log "Bewaar MBR bootcode van originele Linux Mint ISO" ORIGINAL_MBR="$WORK_DIR/mint-isohybrid-mbr.bin" dd \ if="$ISO_PATH" \ of="$ORIGINAL_MBR" \ bs=432 \ count=1 \ status=none [[ -s "$ORIGINAL_MBR" ]] \ || die "Kon MBR bootcode niet uit originele ISO halen." MBR_SIZE="$(stat -c%s "$ORIGINAL_MBR")" [[ "$MBR_SIZE" -eq 432 ]] \ || die "MBR bootcode heeft onverwachte grootte: ${MBR_SIZE} bytes." echo "Originele Mint MBR bootcode: $MBR_SIZE bytes" ############################################################################### # Inspect ORIGINAL ISO boot structure ############################################################################### log "Controleer originele Linux Mint bootinformatie" xorriso \ -indev "$ISO_PATH" \ -report_el_torito plain \ -report_system_area plain ############################################################################### # Extract ISO filesystem ############################################################################### log "Pak Linux Mint ISO uit" xorriso \ -osirrox on \ -indev "$ISO_PATH" \ -extract / "$WORK_DIR" ############################################################################### # Locate filesystem.squashfs ############################################################################### log "Zoek filesystem.squashfs" SQUASHFS_FILE="$( find "$WORK_DIR" \ -type f \ -name "filesystem.squashfs" \ -print \ -quit )" [[ -n "$SQUASHFS_FILE" ]] \ || die "filesystem.squashfs niet gevonden in de ISO." echo "Gevonden:" echo " $SQUASHFS_FILE" ############################################################################### # Check required ISO structure ############################################################################### log "Controleer ISO-structuur" [[ -d "$WORK_DIR/casper" ]] \ || die "casper directory ontbreekt." [[ -f "$WORK_DIR/casper/vmlinuz" ]] \ || die "casper/vmlinuz ontbreekt." [[ -d "$WORK_DIR/isolinux" ]] \ || die "isolinux directory ontbreekt." [[ -f "$WORK_DIR/isolinux/isolinux.bin" ]] \ || die "isolinux/isolinux.bin ontbreekt." [[ -f "$WORK_DIR/isolinux/boot.cat" ]] \ || die "isolinux/boot.cat ontbreekt." [[ -d "$WORK_DIR/boot/grub" ]] \ || die "boot/grub directory ontbreekt." [[ -f "$WORK_DIR/boot/grub/efi.img" ]] \ || die "boot/grub/efi.img ontbreekt." [[ -f "$WORK_DIR/boot/grub/grub.cfg" ]] \ || die "boot/grub/grub.cfg ontbreekt." ############################################################################### # Detect initrd ############################################################################### log "Detecteer initrd" INITRD_FILE="$( find "$WORK_DIR/casper" \ -maxdepth 1 \ -type f \ -iname "initrd*" \ -print \ -quit )" [[ -n "$INITRD_FILE" ]] \ || die "Geen initrd gevonden in $WORK_DIR/casper." ACTUAL_INITRD_NAME="$(basename "$INITRD_FILE")" echo "Initrd gevonden:" echo " $ACTUAL_INITRD_NAME" ############################################################################### # Unpack squashfs ############################################################################### log "Pak squashfs uit" SQUASHFS_DIR="$WORK_DIR/squashfs" mkdir -p "$SQUASHFS_DIR" unsquashfs \ -f \ -d "$SQUASHFS_DIR" \ "$SQUASHFS_FILE" ############################################################################### # Do NOT install automatic systemd installer ############################################################################### log "Geen automatische systemd-installer installeren" ############################################################################### # Copy preseed to ISO ############################################################################### log "Plaats preseed op de ISO" PRESEED_ISO_DIR="$WORK_DIR/preseed" PRESEED_ISO_PATH="$PRESEED_ISO_DIR/preseed.cfg" mkdir -p "$PRESEED_ISO_DIR" cp \ "$PRESEED_PATH" \ "$PRESEED_ISO_PATH" chmod 644 \ "$PRESEED_ISO_PATH" echo "Preseed:" echo " $PRESEED_ISO_PATH" ############################################################################### # Copy preseed into live filesystem ############################################################################### log "Plaats preseed ook in live filesystem" cp \ "$PRESEED_PATH" \ "$SQUASHFS_DIR/preseed.cfg" chmod 644 \ "$SQUASHFS_DIR/preseed.cfg" ############################################################################### # Copy installer script into live system ############################################################################### log "Plaats install-kiosk-nl.sh in live filesystem" INSTALL_SCRIPT_DEST="$SQUASHFS_DIR/usr/local/bin/install-kiosk-nl.sh" mkdir -p \ "$(dirname "$INSTALL_SCRIPT_DEST")" cp \ "$SCRIPT_PATH" \ "$INSTALL_SCRIPT_DEST" chmod +x \ "$INSTALL_SCRIPT_DEST" ############################################################################### # Keep installer script in /home/av-admin ############################################################################### log "Plaats install-kiosk-nl.sh in /home/av-admin" ADMIN_HOME="$SQUASHFS_DIR/home/av-admin" mkdir -p "$ADMIN_HOME" cp \ "$SCRIPT_PATH" \ "$ADMIN_HOME/install-kiosk-nl.sh" chmod +x \ "$ADMIN_HOME/install-kiosk-nl.sh" ############################################################################### # Disable Mint Welcome ############################################################################### log "Schakel mintwelcome uit" MINT_WELCOME="$SQUASHFS_DIR/etc/xdg/autostart/mintwelcome.desktop" if [[ -f "$MINT_WELCOME" ]]; then mv \ "$MINT_WELCOME" \ "$MINT_WELCOME.bak" fi ############################################################################### # Remove standard Ubiquity application entry ############################################################################### log "Verwijder standaard Ubiquity application entry" UBIQUITY_DESKTOP="$SQUASHFS_DIR/usr/share/applications/ubiquity.desktop" if [[ -f "$UBIQUITY_DESKTOP" ]]; then rm -f "$UBIQUITY_DESKTOP" fi ############################################################################### # Create custom installer launcher # # This is the fallback when the live desktop has already booted. ############################################################################### log "Maak aangepaste Ubiquity desktop launcher" CUSTOM_DESKTOP_ENTRY="$SQUASHFS_DIR/usr/share/applications/install-kiosk.desktop" mkdir -p \ "$(dirname "$CUSTOM_DESKTOP_ENTRY")" cat > "$CUSTOM_DESKTOP_ENTRY" << 'EOF' [Desktop Entry] Name=Installeer Audio Kiosk voor Aamsveen Comment=Installeer Linux Mint met Audio Kiosk voor Aamsveen Exec=bash -c 'sudo debconf-set-selections /preseed.cfg && sudo DEBIAN_FRONTEND=noninteractive ubiquity --automatic' Icon=mintubiquity Terminal=false Type=Application Categories=System; EOF chmod 644 \ "$CUSTOM_DESKTOP_ENTRY" ############################################################################### # Replace Mint desktop installer shortcut ############################################################################### log "Maak aangepaste desktop installer shortcut" MINT_DESKTOP_DIR="$SQUASHFS_DIR/home/mint/Desktop" MINT_DESKTOP_ENTRY="$MINT_DESKTOP_DIR/install.desktop" mkdir -p \ "$MINT_DESKTOP_DIR" rm -f \ "$MINT_DESKTOP_ENTRY" cp \ "$CUSTOM_DESKTOP_ENTRY" \ "$MINT_DESKTOP_ENTRY" chmod +x \ "$MINT_DESKTOP_ENTRY" ############################################################################### # Update application database if available ############################################################################### if command -v update-desktop-database >/dev/null 2>&1; then update-desktop-database \ "$SQUASHFS_DIR/usr/share/applications/" \ 2>/dev/null || true fi ############################################################################### # UEFI GRUB configuration # # CRITICAL: # # This modifies ONLY: # # $WORK_DIR/boot/grub/grub.cfg # # It does NOT modify: # # $WORK_DIR/boot/grub/efi.img # # The original efi.img contains a loader which searches for /.disk/info and # then loads this ISO-level grub.cfg. ############################################################################### log "Maak UEFI GRUB bootmenu" GRUB_CFG="$WORK_DIR/boot/grub/grub.cfg" cat > "$GRUB_CFG" << EOF loadfont unicode set color_normal=white/black set color_highlight=black/light-gray set default=0 set timeout=-1 menuentry "Start Linux Mint 22.3 Cinnamon 64-bit" --class linuxmint { set gfxpayload=keep linux /casper/vmlinuz boot=casper uuid=6e72f523-dc09-4880-8910-93ffa64401c5 username=mint hostname=mint iso-scan/filename=\${iso_path} quiet splash -- initrd /casper/${ACTUAL_INITRD_NAME} } menuentry "Unattended Install Aamsveen Kiosk" --class linuxmint { set gfxpayload=keep linux /casper/vmlinuz boot=casper automatic-ubiquity file=/cdrom/preseed/preseed.cfg priority=critical quiet splash -- initrd /casper/${ACTUAL_INITRD_NAME} } menuentry "Start Linux Mint 22.3 Cinnamon 64-bit (compatibility mode)" { linux /casper/vmlinuz boot=casper uuid=6e72f523-dc09-4880-8910-93ffa64401c5 username=mint hostname=mint iso-scan/filename=\${iso_path} noapic noacpi nosplash irqpoll nomodeset -- initrd /casper/${ACTUAL_INITRD_NAME} } menuentry "OEM install (for manufacturers)" { set gfxpayload=keep linux /casper/vmlinuz oem-config/enable=true only-ubiquity boot=casper uuid=6e72f523-dc09-4880-8910-93ffa64401c5 username=mint hostname=mint iso-scan/filename=\${iso_path} quiet splash -- initrd /casper/${ACTUAL_INITRD_NAME} } if [ "\$grub_platform" = "efi" ]; then menuentry 'Boot from next volume' { exit 1 } menuentry 'UEFI Firmware Settings' { fwsetup } menuentry 'Memory test' { linux /boot/memtest.efi } fi EOF ############################################################################### # Verify ISO-level GRUB configuration ############################################################################### log "Controleer ISO-level UEFI GRUB configuratie" cat "$GRUB_CFG" ############################################################################### # IMPORTANT: # # DO NOT MODIFY efi.img # # We verify that its original loader is still present. ############################################################################### log "Controleer originele EFI GRUB loader" EFI_IMG="$WORK_DIR/boot/grub/efi.img" EFI_MOUNT="$WORK_DIR/efi_mount" mkdir -p "$EFI_MOUNT" EFI_MOUNTED=0 cleanup_efi() { if [[ "$EFI_MOUNTED" -eq 1 ]]; then sudo umount "$EFI_MOUNT" 2>/dev/null || true EFI_MOUNTED=0 fi } trap cleanup_efi EXIT sudo mount \ -o loop,ro \ "$EFI_IMG" \ "$EFI_MOUNT" EFI_MOUNTED=1 EFI_GRUB_CFG="$( sudo find "$EFI_MOUNT" \ -type f \ -name "grub.cfg" \ -print \ -quit )" [[ -n "$EFI_GRUB_CFG" ]] \ || die "Geen grub.cfg gevonden in efi.img." echo echo "EFI grub.cfg gevonden:" echo " $EFI_GRUB_CFG" echo echo "================ originele EFI grub.cfg ================" sudo cat "$EFI_GRUB_CFG" echo ############################################################################### # Verify that the EFI loader contains the expected Mint loader commands. ############################################################################### grep -q \ 'search --set=root --file /.disk/info' \ <(sudo cat "$EFI_GRUB_CFG") \ || die "EFI grub.cfg mist de originele Mint 'search --set=root --file /.disk/info'." grep -q \ 'set prefix=(\$root)/boot/grub' \ <(sudo cat "$EFI_GRUB_CFG") \ || die "EFI grub.cfg mist de originele Mint GRUB prefix." grep -q \ 'configfile (\$root)/boot/grub/grub.cfg' \ <(sudo cat "$EFI_GRUB_CFG") \ || die "EFI grub.cfg mist de originele Mint configfile loader." echo echo "OK: originele EFI GRUB loader is intact." cleanup_efi trap - EXIT ############################################################################### # BIOS / ISOLINUX menu # # Mint uses isolinux/live.cfg for the visible BIOS boot menu. # # We preserve the original Mint entries and append our custom unattended # installer. ############################################################################### log "Maak BIOS/ISOLINUX bootmenu" LIVE_CFG_PATH="$WORK_DIR/isolinux/live.cfg" [[ -f "$LIVE_CFG_PATH" ]] \ || die "isolinux/live.cfg ontbreekt." ############################################################################### # Remove an existing unattended entry if present. # # This handles rebuilding from an already modified tree. ############################################################################### sed -i \ '/^[[:space:]]*label[[:space:]]\+unattended-install[[:space:]]*$/,/^[[:space:]]*$/d' \ "$LIVE_CFG_PATH" \ || true ############################################################################### # Remove existing timeout directives. ############################################################################### sed -i \ '/^[[:space:]]*timeout[[:space:]]\+[0-9]\+[[:space:]]*$/d' \ "$LIVE_CFG_PATH" ############################################################################### # Add custom unattended installer. ############################################################################### cat >> "$LIVE_CFG_PATH" << EOF # --------------------------------------------------------------------------- # Aamsveen custom unattended installer # --------------------------------------------------------------------------- label unattended-install menu label ^Unattended Install Aamsveen Kiosk kernel /casper/vmlinuz append boot=casper automatic-ubiquity file=/cdrom/preseed/preseed.cfg priority=critical quiet splash -- initrd /casper/${ACTUAL_INITRD_NAME} # Wait indefinitely for user input. timeout 0 EOF ############################################################################### # Display BIOS configuration ############################################################################### log "Controleer BIOS/ISOLINUX configuratie" cat "$LIVE_CFG_PATH" ############################################################################### # Remove old squashfs ############################################################################### log "Verwijder oude filesystem.squashfs" rm -f \ "$SQUASHFS_FILE" ############################################################################### # Rebuild squashfs ############################################################################### log "Bouw filesystem.squashfs opnieuw" mksquashfs \ "$SQUASHFS_DIR" \ "$WORK_DIR/casper/filesystem.squashfs" \ -b 256K \ -comp xz \ -Xdict-size 100% \ -no-duplicates \ -no-xattrs \ -noappend ############################################################################### # Verify squashfs ############################################################################### [[ -f "$WORK_DIR/casper/filesystem.squashfs" ]] \ || die "Nieuw filesystem.squashfs is niet aangemaakt." ############################################################################### # Do not repack initrd ############################################################################### log "Initrd blijft ongewijzigd" echo "Initrd:" echo " $INITRD_FILE" ############################################################################### # Build ISO # # xorriso creates the hybrid image directly. # # There is NO isohybrid post-processing. ############################################################################### log "Bouw nieuwe ISO met xorriso-native hybride bootlayout" cd "$WORK_DIR" xorriso -as mkisofs \ -r \ -V "NonAamsveenAudioKiosk" \ -J \ -l \ -isohybrid-mbr "$ORIGINAL_MBR" \ -partition_cyl_align on \ -partition_offset 16 \ -partition_hd_cyl 185 \ -partition_sec_hd 32 \ --mbr-force-bootable \ -apm-block-size 2048 \ -iso_mbr_part_type 0x00 \ -c isolinux/boot.cat \ -b isolinux/isolinux.bin \ -no-emul-boot \ -boot-load-size 4 \ -boot-info-table \ -eltorito-alt-boot \ -e boot/grub/efi.img \ -no-emul-boot \ -isohybrid-gpt-basdat \ -isohybrid-apm-hfsplus \ -x "./squashfs" \ -x "./temp_initrd" \ -o "$NEW_ISO_PATH" \ . ############################################################################### # Verify ISO exists ############################################################################### log "Controleer gemaakte ISO" [[ -f "$NEW_ISO_PATH" ]] \ || die "Nieuwe ISO is niet gemaakt." NEW_ISO_SIZE="$(stat -c%s "$NEW_ISO_PATH")" ORIGINAL_ISO_SIZE="$(stat -c%s "$ISO_PATH")" echo echo "Originele ISO : $ORIGINAL_ISO_SIZE bytes" echo "Nieuwe ISO : $NEW_ISO_SIZE bytes" if [[ "$NEW_ISO_SIZE" -lt "$((ORIGINAL_ISO_SIZE * 90 / 100))" ]]; then die "Nieuwe ISO is verdacht klein: minder dan 90% van originele ISO." fi ############################################################################### # Verify El Torito ############################################################################### log "Controleer El Torito bootinformatie" xorriso \ -indev "$NEW_ISO_PATH" \ -report_el_torito plain ############################################################################### # Verify system area ############################################################################### log "Controleer nieuw ISO system area" xorriso \ -indev "$NEW_ISO_PATH" \ -report_system_area plain ############################################################################### # Verify resulting hybrid layout ############################################################################### log "Controleer hybride partitie-indeling" SYSTEM_AREA_REPORT="$WORK_DIR/system-area-report.txt" xorriso \ -indev "$NEW_ISO_PATH" \ -report_system_area plain \ > "$SYSTEM_AREA_REPORT" if ! grep -q \ 'System area summary: MBR isohybrid cyl-align-on GPT APM' \ "$SYSTEM_AREA_REPORT" then die "Nieuwe ISO heeft niet de verwachte Mint-achtige MBR/GPT/APM hybrid layout." fi if ! grep -Eq \ 'MBR partition[[:space:]]*:.*0x80[[:space:]]+0x00' \ "$SYSTEM_AREA_REPORT" then die "MBR partition 1 heeft niet het verwachte type 0x00." fi if ! grep -Eq \ 'MBR partition[[:space:]]*:.*0x00[[:space:]]+0xef' \ "$SYSTEM_AREA_REPORT" then die "MBR EFI partition 2 (0xEF) ontbreekt." fi echo echo "Hybride layout lijkt correct:" echo " MBR + GPT + APM" echo " MBR partition 1 type 0x00" echo " MBR EFI partition 2 type 0xEF" ############################################################################### # Verify boot files ############################################################################### log "Controleer bootbestanden" xorriso \ -indev "$NEW_ISO_PATH" \ -find /isolinux -type f -exec lsdl -- ############################################################################### # Create ISO verification directory ############################################################################### TMP_CHECK_DIR="$WORK_DIR/iso-check" mkdir -p "$TMP_CHECK_DIR" ############################################################################### # Verify custom BIOS configuration ############################################################################### log "Controleer aangepaste BIOS-configuratie" xorriso \ -osirrox on \ -indev "$NEW_ISO_PATH" \ -cpx /isolinux/live.cfg "$TMP_CHECK_DIR/" echo echo "================ /isolinux/live.cfg ================" cat "$TMP_CHECK_DIR/live.cfg" grep -q \ 'label unattended-install' \ "$TMP_CHECK_DIR/live.cfg" \ || die "BIOS unattended-install entry ontbreekt." grep -q \ 'Unattended Install Aamsveen Kiosk' \ "$TMP_CHECK_DIR/live.cfg" \ || die "BIOS Aamsveen menu-entry ontbreekt." ############################################################################### # Verify custom UEFI configuration ############################################################################### log "Controleer aangepaste UEFI-configuratie" TMP_GRUB_CHECK="$TMP_CHECK_DIR/grub.cfg" xorriso \ -osirrox on \ -indev "$NEW_ISO_PATH" \ -cpx /boot/grub/grub.cfg "$TMP_GRUB_CHECK" echo echo "================ /boot/grub/grub.cfg ================" cat "$TMP_GRUB_CHECK" grep -q \ 'Unattended Install Aamsveen Kiosk' \ "$TMP_GRUB_CHECK" \ || die "UEFI Aamsveen menu-entry ontbreekt." grep -q \ 'automatic-ubiquity' \ "$TMP_GRUB_CHECK" \ || die "UEFI automatic-ubiquity ontbreekt." grep -q \ 'file=/cdrom/preseed/preseed.cfg' \ "$TMP_GRUB_CHECK" \ || die "UEFI preseed path ontbreekt." grep -q \ 'set timeout=-1' \ "$TMP_GRUB_CHECK" \ || die "UEFI timeout=-1 ontbreekt." ############################################################################### # Verify EFI image was NOT replaced by our custom menu ############################################################################### log "Controleer dat efi.img origineel is gebleven" EFI_VERIFY_DIR="$TMP_CHECK_DIR/efi-verify" mkdir -p "$EFI_VERIFY_DIR/mount" EFI_VERIFY_MOUNTED=0 cleanup_verify_efi() { if [[ "$EFI_VERIFY_MOUNTED" -eq 1 ]]; then sudo umount "$EFI_VERIFY_DIR" 2>/dev/null || true EFI_VERIFY_MOUNTED=0 fi } trap cleanup_verify_efi EXIT xorriso \ -osirrox on \ -indev "$NEW_ISO_PATH" \ -cpx /boot/grub/efi.img "$EFI_VERIFY_DIR/" sudo mount \ -o loop,ro \ "$EFI_VERIFY_DIR/efi.img" \ "$EFI_VERIFY_DIR/mount" EFI_VERIFY_MOUNTED=1 FINAL_EFI_GRUB_CFG="$( sudo find "$EFI_VERIFY_DIR/mount" \ -type f \ -name "grub.cfg" \ -print \ -quit )" [[ -n "$FINAL_EFI_GRUB_CFG" ]] \ || die "Geen grub.cfg gevonden in de EFI image van de nieuwe ISO." echo echo "================ efi.img grub.cfg ================" sudo cat "$FINAL_EFI_GRUB_CFG" grep -q \ 'search --set=root --file /.disk/info' \ <(sudo cat "$FINAL_EFI_GRUB_CFG") \ || die "Nieuwe ISO EFI loader mist Mint search command." grep -q \ 'configfile (\$root)/boot/grub/grub.cfg' \ <(sudo cat "$FINAL_EFI_GRUB_CFG") \ || die "Nieuwe ISO EFI loader mist configfile command." if grep -q \ 'Unattended Install Aamsveen Kiosk' \ <(sudo cat "$FINAL_EFI_GRUB_CFG") then die "FOUT: custom Aamsveen menu is ten onrechte in efi.img terechtgekomen." fi echo echo "OK: efi.img bevat alleen de originele Mint GRUB loader." cleanup_verify_efi trap - EXIT ############################################################################### # Verify the kernel and initrd are actually present in the finished ISO ############################################################################### log "Controleer kernel en initrd in eind-ISO" xorriso \ -indev "$NEW_ISO_PATH" \ -ls \ /casper/vmlinuz \ /casper/"$ACTUAL_INITRD_NAME" ############################################################################### # Verify preseed is present ############################################################################### log "Controleer preseed in eind-ISO" xorriso \ -indev "$NEW_ISO_PATH" \ -ls \ /preseed/preseed.cfg ############################################################################### # Verify installer script is present inside squashfs ############################################################################### log "Controleer installer script in squashfs" [[ -f "$SQUASHFS_DIR/usr/local/bin/install-kiosk-nl.sh" ]] \ || die "install-kiosk-nl.sh ontbreekt in live filesystem." [[ -x "$SQUASHFS_DIR/usr/local/bin/install-kiosk-nl.sh" ]] \ || die "install-kiosk-nl.sh is niet executable." ############################################################################### # Verify that the separate isohybrid utility was NOT used ############################################################################### log "Hybride bootlayout" echo echo "De ISO is rechtstreeks door xorriso als hybride image gebouwd." echo echo "Er wordt GEEN 'isohybrid' post-processing uitgevoerd." echo echo "Gebruikte opties:" echo echo " -isohybrid-mbr" echo " -partition_cyl_align on" echo " -partition_offset 16" echo " -partition_hd_cyl 185" echo " -partition_sec_hd 32" echo " --mbr-force-bootable" echo " -apm-block-size 2048" echo " -iso_mbr_part_type 0x00" echo " -isohybrid-gpt-basdat" echo " -isohybrid-apm-hfsplus" echo ############################################################################### # Final output ############################################################################### echo echo "============================================================" echo "KLAAR" echo "============================================================" echo echo "Nieuwe ISO:" echo echo " $NEW_ISO_PATH" echo echo "UEFI bootmenu:" echo echo " Start Linux Mint 22.3 Cinnamon 64-bit" echo " Unattended Install Aamsveen Kiosk" echo " Start Linux Mint 22.3 Cinnamon 64-bit (compatibility mode)" echo " OEM install (for manufacturers)" echo echo "BIOS bootmenu:" echo echo " Start Linux Mint" echo " Start Linux Mint in compatibility mode" echo " OEM install" echo " Hardware Detection" echo " Boot from local drive" echo " Memory test" echo " Unattended Install Aamsveen Kiosk" echo echo "UEFI menu timeout:" echo " -1 (wacht oneindig)" echo echo "BIOS menu timeout:" echo " 0 (wacht oneindig)" echo echo "Unattended installatie gebruikt:" echo echo " automatic-ubiquity" echo " file=/cdrom/preseed/preseed.cfg" echo " priority=critical" echo echo "BELANGRIJK:" echo echo " Schrijf deze ISO rechtstreeks naar USB met dd." echo echo " sudo dd if=\"$NEW_ISO_PATH\" of=/dev/sdX bs=4M conv=fsync status=progress" echo echo " Gebruik NIET /dev/sdX1." echo ############################################################################### # Cleanup ############################################################################### log "Ruim werkmap op" cd "$SCRIPT_DIR" rm -rf "$WORK_DIR" echo echo "============================================================" echo "BUILD VOLTOOID" echo "============================================================" echo echo "ISO:" echo " $NEW_ISO_PATH"