summaryrefslogtreecommitdiff
path: root/server-build/my-simple-cdd/make-iso.sh
blob: f24c6fee271dcf71894778ef808190679e312faa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/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

# 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 installer.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/