summaryrefslogtreecommitdiff
path: root/server-build/my-simple-cdd/01-make-iso.sh
diff options
context:
space:
mode:
Diffstat (limited to 'server-build/my-simple-cdd/01-make-iso.sh')
-rwxr-xr-xserver-build/my-simple-cdd/01-make-iso.sh66
1 files changed, 66 insertions, 0 deletions
diff --git a/server-build/my-simple-cdd/01-make-iso.sh b/server-build/my-simple-cdd/01-make-iso.sh
new file mode 100755
index 0000000..241af11
--- /dev/null
+++ b/server-build/my-simple-cdd/01-make-iso.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+# Shell script to build the ISO.
+# We use simple-cdd, but then need to patch the resulting
+# ISO to avoid GRUB/isolinux prompting for the installation
+# method and to avoid the Debian installer from asking questions
+# about the language (which it does before reading the preseed
+# file with the configuration, so those MUST be passed via
+# kernel parameters. Badly documented!).
+
+# What does not yet work:
+# - Debian installer asks for the 'wootaler' profile.
+# (not sure which option to set in profiles/wootaler.preseed,
+# or if using 'profiles' is the wrong approach entirely here)
+
+set -eu
+
+ISO=installer.iso
+
+if [ -f $ISO ]
+then
+ echo "Confirm removal of existing '$ISO' by pressing 'y':"
+ rm -i $ISO
+ if [ -f $ISO ]
+ then
+ echo "'$ISO' already exists, exiting..."
+ exit 0
+ fi
+fi
+
+# Will create images/debian-10-amd64-CD-1.iso
+export KERNEL_PARAMS="preseed/file=/cdrom/simple-cdd/default.preseed locale=en_US.UTF-8 keymap=us language=en country=US"
+
+build-simple-cdd --verbose --profiles wootaler --auto-profiles wootaler --dist buster
+
+# Use shell variable, in case the above changes in the future...
+IMG=images/debian-10-amd64-CD-1.iso
+
+# Create directory for unpacking the ISO
+rm -rf cd/
+mkdir cd/
+bsdtar -C cd/ -xf $IMG
+chmod -R +w cd/
+
+# Modify ISO
+
+# This may seem to have no effect, as GRUB is usually not used to boot the ISO.
+# But, just better be safe.
+# Make sure to also adjust kernel parameters here!
+cp iso/grub.cfg cd/boot/grub/
+
+# Change 'timeout' to 2 to ensure we boot non-interactively
+cp iso/isolinux.cfg cd/isolinux/
+# Remove graphical installer option from menu, so text-based is first
+cp iso/menu.cfg cd/isolinux/
+# Adds kernel parameters to setup language in Debian installer
+cp iso/txt.cfg cd/isolinux/
+
+
+# Finally, pack the ISO
+# Extract header from original ISO
+dd if=$IMG bs=1 count=432 of=isohdpfx.bin
+xorriso -as mkisofs -o $ISO -isohybrid-mbr isohdpfx.bin -c isolinux/boot.cat -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table ./cd
+
+# Delete temporary files
+rm isohdpfx.bin -r cd/