Files
Aamsveen-Audio-Kiosk/build-kiosk-iso-v8.sh
T
2026-09-08 16:00:21 +02:00

1090 lines
27 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
###############################################################################
# Linux Mint 22.3 Aamsveen Audio Kiosk ISO builder
#
# VERSION: v8
#
# Host:
# NixOS 26.11 unstable
#
# Guest:
# Linux Mint 22.3 Cinnamon 64-bit
#
# Design:
#
# BIOS:
# ISO
# -> ISOLINUX
# -> /isolinux/live.cfg
# -> Linux kernel
# -> casper
# -> Ubiquity
#
# UEFI:
# ISO
# -> /boot/grub/efi.img
# -> ORIGINAL Mint EFI GRUB loader
# -> /boot/grub/grub.cfg
# -> Linux kernel
# -> casper
# -> Ubiquity
#
# CRITICAL:
#
# boot/grub/efi.img is NEVER modified.
#
# The custom UEFI menu lives ONLY in:
#
# /boot/grub/grub.cfg
#
# The custom BIOS menu lives in:
#
# /isolinux/live.cfg
#
# xorriso creates the hybrid ISO directly.
# isohybrid is NOT run afterwards.
###############################################################################
set -o pipefail
###############################################################################
# Configuration
###############################################################################
BASE_ISO_FILENAME="linuxmint-22.3-cinnamon-64bit.iso"
NEW_ISO_FILENAME="non-aamsveen-audio-kiosk_v8.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"
###############################################################################
# Helpers
###############################################################################
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"
}
###############################################################################
# Dependency check
#
# NixOS note:
#
# This script intentionally does NOT assume Debian/Ubuntu package paths.
# xorriso, squashfs-tools, etc. must simply be available in PATH.
#
# On NixOS, if necessary:
#
# nix shell nixpkgs#xorriso nixpkgs#squashfsTools
#
###############################################################################
log "Controleer benodigde programma's"
for cmd in \
xorriso \
unsquashfs \
mksquashfs \
find \
sed \
awk \
stat \
mount \
umount \
dd \
cmp \
grep \
sudo
do
require_command "$cmd"
done
###############################################################################
# Input validation
###############################################################################
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"
###############################################################################
# Basic file information
###############################################################################
log "Controleer basis-ISO"
ORIGINAL_ISO_SIZE="$(stat -c%s "$ISO_PATH")"
echo "Originele ISO:"
echo " $ISO_PATH"
echo
echo "Grootte:"
echo " $ORIGINAL_ISO_SIZE bytes"
###############################################################################
# Remove old build directory
###############################################################################
log "Verwijder oude werkmap"
if mountpoint -q "$WORK_DIR/iso-check/efi-verify/mount"; then
sudo umount "$WORK_DIR/iso-check/efi-verify/mount"
fi
rm -rf "$WORK_DIR"
mkdir -p "$WORK_DIR"
###############################################################################
# Remove old output ISO
###############################################################################
if [[ -f "$NEW_ISO_PATH" ]]; then
log "Verwijder oude output ISO"
rm -f "$NEW_ISO_PATH"
fi
###############################################################################
# Preserve ORIGINAL Mint MBR boot code
#
# Only the first 432 bytes are reused.
# The partition tables themselves are generated by xorriso.
###############################################################################
log "Bewaar originele Mint MBR bootcode"
ORIGINAL_MBR="$WORK_DIR/mint-isohybrid-mbr.bin"
dd \
if="$ISO_PATH" \
of="$ORIGINAL_MBR" \
bs=432 \
count=1 \
status=none
[[ "$(stat -c%s "$ORIGINAL_MBR")" -eq 432 ]] \
|| die "Originele MBR bootcode heeft geen 432 bytes."
###############################################################################
# Inspect original ISO boot structure
###############################################################################
log "Controleer originele El Torito bootinformatie"
xorriso \
-indev "$ISO_PATH" \
-report_el_torito plain
log "Controleer originele system area"
xorriso \
-indev "$ISO_PATH" \
-report_system_area plain
###############################################################################
# Extract ISO
###############################################################################
log "Pak Linux Mint ISO uit"
xorriso \
-osirrox on \
-indev "$ISO_PATH" \
-extract / "$WORK_DIR"
###############################################################################
# Verify 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."
[[ -f "$WORK_DIR/isolinux/live.cfg" ]] \
|| die "isolinux/live.cfg ontbreekt."
[[ -d "$WORK_DIR/boot/grub" ]] \
|| die "boot/grub 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."
###############################################################################
# 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."
echo "Squashfs:"
echo " $SQUASHFS_FILE"
###############################################################################
# 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."
ACTUAL_INITRD_NAME="$(basename "$INITRD_FILE")"
echo "Initrd:"
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"
###############################################################################
# Install preseed into ISO
###############################################################################
log "Plaats preseed op 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"
###############################################################################
# Install preseed into live filesystem
#
# /preseed.cfg is deliberately retained because the desktop fallback uses it.
###############################################################################
log "Plaats preseed in live filesystem"
cp \
"$PRESEED_PATH" \
"$SQUASHFS_DIR/preseed.cfg"
chmod 644 \
"$SQUASHFS_DIR/preseed.cfg"
###############################################################################
# Copy installer script into live filesystem
###############################################################################
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 normal Ubiquity launcher
###############################################################################
log "Verwijder standaard Ubiquity launcher"
UBIQUITY_DESKTOP="$SQUASHFS_DIR/usr/share/applications/ubiquity.desktop"
if [[ -f "$UBIQUITY_DESKTOP" ]]; then
rm -f "$UBIQUITY_DESKTOP"
fi
###############################################################################
# Create custom desktop installer launcher
#
# IMPORTANT:
#
# This is a real shell command executed after the live desktop is running.
# Therefore shell syntax IS valid here.
###############################################################################
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 desktop 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
#
# DO NOT modify efi.img.
#
# The original Mint EFI loader is expected to contain:
#
# search --set=root --file /.disk/info
# set prefix=($root)/boot/grub
# configfile ($root)/boot/grub/grub.cfg
#
# Therefore the ISO-level grub.cfg is the real menu.
###############################################################################
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 username=mint hostname=mint quiet splash --
initrd /casper/${ACTUAL_INITRD_NAME}
}
menuentry "Unattended Install Aamsveen Kiosk" --class linuxmint {
set gfxpayload=keep
linux /casper/vmlinuz boot=casper automatic-ubiquity noprompt 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)" --class linuxmint {
set gfxpayload=keep
linux /casper/vmlinuz boot=casper username=mint hostname=mint 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 username=mint hostname=mint quiet splash --
initrd /casper/${ACTUAL_INITRD_NAME}
}
if [ "\$grub_platform" = "efi" ]; then
menuentry "Boot from next volume" {
exit 1
}
menuentry "UEFI Firmware Settings" {
fwsetup
}
if [ -f /boot/memtest.efi ]; then
menuentry "Memory test" {
linux /boot/memtest.efi
}
fi
fi
EOF
###############################################################################
# Verify UEFI GRUB
###############################################################################
log "Controleer UEFI GRUB"
grep -q \
'Unattended Install Aamsveen Kiosk' \
"$GRUB_CFG" \
|| die "UEFI unattended entry ontbreekt."
grep -q \
'automatic-ubiquity' \
"$GRUB_CFG" \
|| die "automatic-ubiquity ontbreekt."
grep -q \
'noprompt' \
"$GRUB_CFG" \
|| die "noprompt ontbreekt."
grep -q \
'file=/cdrom/preseed/preseed.cfg' \
"$GRUB_CFG" \
|| die "UEFI preseed path ontbreekt."
grep -q \
'set timeout=-1' \
"$GRUB_CFG" \
|| die "UEFI timeout=-1 ontbreekt."
###############################################################################
# Verify original EFI image BEFORE ISO creation
###############################################################################
log "Controleer originele EFI 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."
EFI_GRUB_CONTENT="$(
sudo cat "$EFI_GRUB_CFG"
)"
echo "$EFI_GRUB_CONTENT"
grep -q \
'search --set=root --file /.disk/info' \
<<< "$EFI_GRUB_CONTENT" \
|| die "Originele EFI loader mist /.disk/info search."
grep -q \
'set prefix=($root)/boot/grub' \
<<< "$EFI_GRUB_CONTENT" \
|| die "Originele EFI loader mist GRUB prefix."
grep -q \
'configfile ($root)/boot/grub/grub.cfg' \
<<< "$EFI_GRUB_CONTENT" \
|| die "Originele EFI loader mist configfile."
if grep -q \
'Unattended Install Aamsveen Kiosk' \
<<< "$EFI_GRUB_CONTENT"
then
die "Aamsveen menu staat ten onrechte in efi.img."
fi
cleanup_efi
trap - EXIT
###############################################################################
# BIOS / ISOLINUX
#
# We know from the original Mint ISO inspection that live.cfg is the visible
# menu configuration.
###############################################################################
log "Maak BIOS/ISOLINUX bootmenu"
LIVE_CFG_PATH="$WORK_DIR/isolinux/live.cfg"
[[ -f "$LIVE_CFG_PATH" ]] \
|| die "isolinux/live.cfg ontbreekt."
###############################################################################
# Remove previous Aamsveen entry if rebuilding
###############################################################################
TMP_LIVE_CFG="$WORK_DIR/isolinux/live.cfg.tmp"
awk '
BEGIN { skip=0 }
/^[[:space:]]*# ---------------------------------------------------------------------------$/ {
if (skip == 1) {
skip=0
}
}
/^[[:space:]]*label[[:space:]]+unattended-install[[:space:]]*$/ {
skip=1
next
}
skip == 1 {
if ($0 ~ /^[[:space:]]*$/) {
skip=0
}
next
}
{
print
}
' "$LIVE_CFG_PATH" > "$TMP_LIVE_CFG"
mv \
"$TMP_LIVE_CFG" \
"$LIVE_CFG_PATH"
###############################################################################
# Remove existing timeout directives.
#
# We want the BIOS menu to wait indefinitely.
###############################################################################
sed -i \
'/^[[:space:]]*timeout[[:space:]]\+[0-9]\+[[:space:]]*$/d' \
"$LIVE_CFG_PATH"
###############################################################################
# Add unattended entry
###############################################################################
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 noprompt file=/cdrom/preseed/preseed.cfg priority=critical quiet splash --
initrd /casper/${ACTUAL_INITRD_NAME}
# Wait indefinitely for user input.
timeout 0
EOF
###############################################################################
# Verify BIOS configuration
###############################################################################
log "Controleer BIOS/ISOLINUX configuratie"
grep -q \
'label unattended-install' \
"$LIVE_CFG_PATH" \
|| die "BIOS unattended entry ontbreekt."
grep -q \
'Unattended Install Aamsveen Kiosk' \
"$LIVE_CFG_PATH" \
|| die "BIOS Aamsveen menu-entry ontbreekt."
grep -q \
'automatic-ubiquity' \
"$LIVE_CFG_PATH" \
|| die "BIOS automatic-ubiquity ontbreekt."
grep -q \
'file=/cdrom/preseed/preseed.cfg' \
"$LIVE_CFG_PATH" \
|| die "BIOS preseed path ontbreekt."
grep -q \
'^timeout 0$' \
"$LIVE_CFG_PATH" \
|| die "BIOS timeout 0 ontbreekt."
###############################################################################
# Display boot configurations
###############################################################################
echo
echo "================ UEFI grub.cfg ================"
cat "$GRUB_CFG"
echo
echo "================ BIOS live.cfg ================"
cat "$LIVE_CFG_PATH"
###############################################################################
# Rebuild squashfs
###############################################################################
log "Verwijder oude filesystem.squashfs"
rm -f \
"$SQUASHFS_FILE"
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
[[ -f "$WORK_DIR/casper/filesystem.squashfs" ]] \
|| die "Nieuw filesystem.squashfs ontbreekt."
###############################################################################
# Build ISO
###############################################################################
log "Bouw nieuwe ISO met xorriso-native hybrid layout"
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")"
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."
fi
###############################################################################
# Verify El Torito
###############################################################################
log "Controleer El Torito"
xorriso \
-indev "$NEW_ISO_PATH" \
-report_el_torito plain
###############################################################################
# Verify hybrid system area
###############################################################################
log "Controleer hybrid system area"
SYSTEM_AREA_REPORT="$WORK_DIR/system-area-report.txt"
xorriso \
-indev "$NEW_ISO_PATH" \
-report_system_area plain \
> "$SYSTEM_AREA_REPORT"
cat "$SYSTEM_AREA_REPORT"
grep -q \
'System area summary: MBR isohybrid cyl-align-on GPT APM' \
"$SYSTEM_AREA_REPORT" \
|| die "MBR/GPT/APM hybrid layout ontbreekt."
###############################################################################
# Verify boot files
###############################################################################
log "Controleer bootbestanden"
xorriso \
-indev "$NEW_ISO_PATH" \
-find /isolinux -type f -exec lsdl --
###############################################################################
# Verify BIOS config inside final ISO
###############################################################################
log "Controleer BIOS configuratie in eind-ISO"
TMP_CHECK_DIR="$WORK_DIR/iso-check"
mkdir -p "$TMP_CHECK_DIR"
xorriso \
-osirrox on \
-indev "$NEW_ISO_PATH" \
-cpx /isolinux/live.cfg "$TMP_CHECK_DIR/"
FINAL_LIVE_CFG="$TMP_CHECK_DIR/live.cfg"
grep -q \
'label unattended-install' \
"$FINAL_LIVE_CFG" \
|| die "Finale ISO mist BIOS unattended entry."
grep -q \
'automatic-ubiquity' \
"$FINAL_LIVE_CFG" \
|| die "Finale ISO mist BIOS automatic-ubiquity."
###############################################################################
# Verify UEFI config inside final ISO
###############################################################################
log "Controleer UEFI configuratie in eind-ISO"
TMP_GRUB_CHECK="$TMP_CHECK_DIR/grub.cfg"
xorriso \
-osirrox on \
-indev "$NEW_ISO_PATH" \
-cpx /boot/grub/grub.cfg "$TMP_GRUB_CHECK"
grep -q \
'Unattended Install Aamsveen Kiosk' \
"$TMP_GRUB_CHECK" \
|| die "Finale ISO mist UEFI unattended entry."
grep -q \
'automatic-ubiquity' \
"$TMP_GRUB_CHECK" \
|| die "Finale ISO mist UEFI automatic-ubiquity."
grep -q \
'file=/cdrom/preseed/preseed.cfg' \
"$TMP_GRUB_CHECK" \
|| die "Finale ISO mist UEFI preseed path."
###############################################################################
# Verify EFI image remains original
###############################################################################
log "Controleer dat efi.img niet is aangepast"
EFI_VERIFY_DIR="$TMP_CHECK_DIR/efi-verify"
mkdir -p "$EFI_VERIFY_DIR/mount"
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"
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 in finale efi.img."
FINAL_EFI_CONTENT="$(
sudo cat "$FINAL_EFI_GRUB_CFG"
)"
sudo umount \
"$EFI_VERIFY_DIR/mount"
grep -q \
'search --set=root --file /.disk/info' \
<<< "$FINAL_EFI_CONTENT" \
|| die "Finale EFI loader mist Mint search."
grep -q \
'configfile ($root)/boot/grub/grub.cfg' \
<<< "$FINAL_EFI_CONTENT" \
|| die "Finale EFI loader mist ISO-level configfile."
if grep -q \
'Unattended Install Aamsveen Kiosk' \
<<< "$FINAL_EFI_CONTENT"
then
die "Finale efi.img bevat ten onrechte custom Aamsveen menu."
fi
###############################################################################
# Verify kernel/initrd
###############################################################################
log "Controleer kernel en initrd"
xorriso \
-indev "$NEW_ISO_PATH" \
-ls \
/casper/vmlinuz \
/casper/"$ACTUAL_INITRD_NAME"
###############################################################################
# Verify preseed
###############################################################################
log "Controleer preseed"
xorriso \
-indev "$NEW_ISO_PATH" \
-ls \
/preseed/preseed.cfg
###############################################################################
# Verify installer script in squashfs
###############################################################################
[[ -f "$SQUASHFS_DIR/usr/local/bin/install-kiosk-nl.sh" ]] \
|| die "install-kiosk-nl.sh ontbreekt."
[[ -x "$SQUASHFS_DIR/usr/local/bin/install-kiosk-nl.sh" ]] \
|| die "install-kiosk-nl.sh is niet executable."
###############################################################################
# Final report
###############################################################################
log "BUILD VOLTOOID"
echo
echo "ISO:"
echo " $NEW_ISO_PATH"
echo
echo "UEFI:"
echo " Start Linux Mint"
echo " Unattended Install Aamsveen Kiosk"
echo " Compatibility mode"
echo " OEM"
echo " UEFI Firmware Settings"
echo
echo "BIOS:"
echo " Start Linux Mint"
echo " Compatibility mode"
echo " OEM"
echo " Hardware Detection"
echo " Boot from local drive"
echo " Memory test"
echo " Unattended Install Aamsveen Kiosk"
echo
echo "UEFI timeout:"
echo " -1 = oneindig"
echo
echo "BIOS timeout:"
echo " 0 = oneindig"
echo
echo "Installer:"
echo " automatic-ubiquity"
echo " noprompt"
echo " file=/cdrom/preseed/preseed.cfg"
echo " priority=critical"
echo
echo "Hybrid ISO:"
echo " MBR + GPT + APM"
echo " xorriso native"
echo " GEEN isohybrid post-processing"
echo
###############################################################################
# Cleanup
###############################################################################
log "Ruim werkmap op"
cd "$SCRIPT_DIR"
rm -rf "$WORK_DIR"
echo
echo "============================================================"
echo "KLAAR"
echo "============================================================"
echo
echo "ISO:"
echo " $NEW_ISO_PATH"
echo