[
  {
    "path": ".gitignore",
    "content": "*.iso\n*.qcow\n*.swp\ntmp/\ntodo.md\n"
  },
  {
    "path": "Dockerfile",
    "content": "FROM debian:trixie\n\nRUN apt-get update && apt-get install -y \\\n  make wget libarchive-tools syslinux syslinux-utils cpio genisoimage \\\n  coreutils util-linux \\\n  && rm -rf /var/lib/apt/lists/*\n"
  },
  {
    "path": "LICENSE",
    "content": "BSD 3-Clause License\n\nCopyright (c) 2018, Philipp Pagel\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n  list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n  this list of conditions and the following disclaimer in the documentation\n  and/or other materials provided with the distribution.\n\n* Neither the name of the copyright holder nor the names of its\n  contributors may be used to endorse or promote products derived from\n  this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "Makefile",
    "content": "include Makevars\n.PHONY: help install-depends config download image unpack bootconfig preseed md5 \\\niso qemu-bios qemu-uefi usb FAT clean mrproper docker-image\\\n\nhelp:\n\t@echo\n\t@echo \"Usage:\"\n\t@echo\n\t@echo \"  make install-depends       Install dependencies\"\n\t@echo \"  make config                Edit configuration (Makevars)\"\n\t@echo \"  make download              download *latest* Debian netinst image\"\n\t@echo \"  make example-preseed.cfg   download example-preseed.cfg from Debian\"\n\t@echo \"  make image                 Build the ISO image\"\n\t@echo \"  make docker-image          Build ISO image using a Docker container\"\n\t@echo \"  make qemu-bios             Boot ISO image in QEMU (BIOS mode)\"\n\t@echo \"  make qemu-uefi             Boot ISO image in QEMU (UEFI boot)\"\n\t@echo \"  make usb                   Write ISO to USB device\"\n\t@echo \"  make FAT                   Add a FAT partition ot the USB stick\"\n\t@echo \"  make clean                 Clean up temporary files and folders\"\n\t@echo \"  make mrproper      Make clean and remove the output ISO\"\n\t@echo\n\t@echo \"See README.md for details\"\n\t@echo\n\ninstall-depends:\n\tsudo apt-get install \\\n\t\twget libarchive-tools syslinux syslinux-utils cpio genisoimage \\\n\t\tcoreutils qemu-system qemu-system-x86 qemu-utils util-linux\n\nconfig:\n\t\"$(if $(EDITOR),$(EDITOR),editor)\" Makevars\n\n.ONESHELL:\ndownload:\n\tset -e\n\tTMPFILE=`mktemp -p ./`\n\twget -O $$TMPFILE https://www.debian.org/CD/netinst/\n\tIMGURL=`grep -o -P -e \"https://cdimage.debian.org/debian-cd/current/${ARCH}/iso-cd/debian.*?netinst.iso\" $$TMPFILE | head -n1`\n\twget -N $$IMGURL\n\trm -f $$TMPFILE\n\n\nexample-preseed.cfg:\n\twget -N -O $@ https://www.debian.org/releases/stable/example-preseed.txt\n\nimage: unpack bootconfig preseed md5sums iso \n\nunpack:\n\t# Unpack the image to the folder and set write permissions.\n\trm -rf ${TMP}\n\tmkdir ${TMP}\n\tbsdtar -C ${TMP} -xf ${SOURCE}\n\tchmod -R +w ${TMP}\n\nbootconfig: \n\t# Create a minimal boot config – no menu, no prompt\n\t# isolinux (BIOS)\n\tsed -e \"s/<ARCH>/${ARCHFOLDER}/g\" \\\n\t\t-e \"s/<CONSOLE>/console=${CONSOLE}/g\" \\\n\t\t${ISOLINUX_CFG_TEMPLATE} > ${TMP}/isolinux/isolinux.cfg\n\t# grub (UEFI)\n\tsed -e \"s/<ARCH>/${ARCHFOLDER}/g\" \\\n\t\t-e \"s/<CONSOLE>/console=${CONSOLE}/g\" \\\n\t\t${GRUB_CFG_TEMPLATE} > ${TMP}/boot/grub/grub.cfg\n\npreseed: preseed.cfg\n\t# Write the preseed file to initrd.\n\tgunzip ${TMP}/install.${ARCHFOLDER}/initrd.gz\n\techo preseed.cfg | cpio -H newc -o -A -F ${TMP}/install.${ARCHFOLDER}/initrd\n\tgzip ${TMP}/install.${ARCHFOLDER}/initrd\n\nmd5sums:\n\t# Recreate the MD5 sums of all files.\n\tfind ${TMP}/ -type f -exec md5sum {} \\; > ${TMP}/md5sum.txt\n\n\niso: ${TMP}\n\t# Create ISO and fix MBR for USB boot.\n\tgenisoimage -V ${LABEL} \\\n\t\t-r -J -b isolinux/isolinux.bin -c isolinux/boot.cat \\\n\t\t-no-emul-boot -boot-load-size 4 -boot-info-table \\\n\t\t-eltorito-alt-boot \\\n\t\t-e boot/grub/efi.img \\\n\t\t-no-emul-boot \\\n\t\t-o ${TARGET} ${TMP}\n\tisohybrid --uefi ${TARGET}\n\nqemu-bios: image.qcow\n\t# boot image in qemu (BIOS mode)\n\t@echo\n\t@echo \"Once the installer has launched networking you can log in:\\n\"\n\t@echo \"    ssh installer@localhost -p22222\\n\"\n\t@echo \"It may take a few minutes for the installer to get to that point.\\n\"\n\t@echo \"Alternatively connect to the serial console:\\n\"\n\t@echo \"    telnet localhost 33333\\n\"\n\t${QEMU} -m 1024 \\\n\t\t-net user,hostfwd=tcp::22222-:22 \\\n\t\t-net nic \\\n\t\t-hda image.qcow \\\n\t\t-serial telnet:localhost:33333,server,nowait \\\n\t\t-cdrom ${TARGET}\n\nqemu-uefi: image.qcow\n\t# boot image in qemu (UEFI mode)\n\t@echo\n\t@echo \"Once the installer has launched networking you can log in:\\n\"\n\t@echo \"    ssh installer@localhost -p22222\\n\"\n\t@echo \"It may take a few minutes for the installer to get to that point.\\n\"\n\t@echo \"Alternatively connect to the serial console:\\n\"\n\t@echo \"    telnet localhost 33333\\n\"\n\t${QEMU} -m 1024 \\\n\t\t-net user,hostfwd=tcp::22222-:22 \\\n\t\t-bios /usr/share/ovmf/OVMF.fd \\\n\t\t-net nic \\\n\t\t-hda image.qcow \\\n\t\t-serial telnet:localhost:33333,server,nowait \\\n\t\t-cdrom ${TARGET}\n\nimage.qcow:\n\t# Create a virtual disk for QEMU.\n\tqemu-img create -f qcow2 $@ 10G\n\nusb:\n\t# Write the image to usb stick.\n\t@echo \"This will overwrite all data on ${USBDEV}!\"\n\t@read -p \"Type 'yes' if you really want to do this: \" proceed; \\\n\tif [ $$proceed = \"yes\" ] ; then \\\n\t\techo \"writing image to ${USBDEV}\"; \\\n\t\tsudo dd if=${TARGET} of=${USBDEV} bs=4k ; \\\n\t\tsync ; \\\n\telse \\\n\t\techo \"Aborting\" ; \\\n\tfi\n\nFAT:\n\t# Add a FAT partition in the remaining free space (e.g. for driver files).\n\t@echo \"This will overwrite ${USBDEV}!\"\n\t@read -p \"Type 'yes' if you really want to do this: \" proceed; \\\n\tif [ $$proceed = \"yes\" ] ; then \\\n\techo \" , , 0xb\" | sudo sfdisk ${USBDEV} -N 3 ;\\\n\t\tsudo mkfs.vfat ${USBDEV}3 ;\\\n\t\tsync ;\\\n\telse \\\n\t\techo \"Aborting\" ; \\\n\tfi\n\nDocker: Dockerfile\n\tdocker build -t debian-headless .\n\ndocker-image: Docker\n\tdocker run --rm -w /build -v $(shell pwd):/build -it debian-headless make image\n\nclean:\n\trm -rf ${TMP}\n\trm -f image.qcow\n\nmrproper: clean\n\trm -f ${TARGET}\n\tdocker image rm -f debian-headless\n\n"
  },
  {
    "path": "Makevars",
    "content": "# Configuration\n\n# Source ISO image file\nSOURCE = debian-13.4.0-amd64-netinst.iso\n\n# Target ISO image file\nTARGET = debian-13.4.0-amd64-netinst-hl.iso\n\n# Image label (must be ≤ 32 chars)\nLABEL = Debian-13.4.0-amd64-headless\n\n# Machine architecture \n# As of Debian 13 (Trixie), only `amd64` is supported.\n# For legacy versions (Bookworm and earlier), you can \n# also choose `i368`.\n# Other architectures are not supported, because they\n# use very different boot mechanisms\nARCH = amd64\n#ARCH = i386    # only available for Debian 12.x an earlier\n\n# Where to find the usb drive\n# CAUTION: if set incorrectly you may ruin your system!\n#USBDEV = /dev/null\nUSBDEV = /dev/sda\n\n############################################################\n# You can probably leave alone everything below this line \n############################################################\n\n# Console configuration\n#\n# Format: DEV[,PARMS]\n# DEV: typically ttyS0, ttyS1 or ttyUSB0\n#\n# SERIALPARMS format (according to LINUX kenrel documentation):\n# depend on the driver. For the serial port this\n# defines the baudrate/parity/bits/flow control of\n# the port, in the format BBBBPNF, where BBBB is the\n# speed, P is parity (n/o/e), N is number of bits,\n# and F is flow control ('r' for RTS). Default is\n# 9600n8. The maximum baudrate is 115200.\n# For serial console:\nCONSOLE = ttyS0,115200n8\n# For local console (i.e. also offer normal non-headless installation):\n# CONSOLE = tty0\n\n# Folder for image unpacking\nTMP = tmp\n\nISOLINUX_CFG_TEMPLATE = templates/isolinux.cfg.template\nGRUB_CFG_TEMPLATE = templates/grub.cfg.template\n\n# set architecture-dependent variables\nifeq \"${ARCH}\" \"amd64\" \n    ARCHFOLDER = amd\n    QEMU = qemu-system-x86_64\nelse ifeq \"${ARCH}\" \"i386\"\n    ARCHFOLDER = 386\n    QEMU = qemu-system-i386\nendif\n\n# vim: set syntax=make :\n"
  },
  {
    "path": "README.md",
    "content": "# Debian headless/remote installation\n\nInstalling Debian is easy enough – but what if you have no physical access to\nthe target machine or it has no screen or keyboard? Stock images require at\nleast a few local key strokes before you can continue the installation,\nremotely...\n\nThis little tool will remaster a stock Debian image for 100% remote installation\nvia ssh or serial console.\n\n## In a nutshell\n    \n    # Edit the configuration variables\n    make config\n\n    # download the latest Debian netinst image\n    make download\n\n    # Adapt preseed.cfg\n    edit preseed.cfg\n\n    # Build image\n    make image\n\n    # Write image to usb stick\n    make usb\n\n\n## Motivation\n\nI wanted to install Debian on a server remotely – i.e. without keyboard access\nor the chance to peek at a physical screen. I found plenty of information on\nthe net but none of the tutorials really worked for me. Some included\npreseeding the image but failed to automatically start the installation without\na key press, others seemed to customize a zillion things but ended up getting\nstuck in some error message or other.  The problem with ssh remote installation\nwith stock images is that they still require some initial human interaction to\nselect the desired menu option and some basic setup before the network is\nconfigured. That makes the whole point of remote installation moot...\n\nSo I read my way through lots of tutorials and put together a slim working\nsolution – at least working for me. So here is my minimal and lazy solution to\nDebian headless installation image building.  I mostly documented it for myself\nbut maybe it's useful for someone out there.\n\nMy main intent was to connect to the ssh-server of the Debian installer.\nAnother possible route for headless installation is via serial console. That\ncan either be a physical RS-232 cable or a virtual serial port provided by a\nremote management module/software such as HPEs iLO or something similar.\n\n## Known quirks and issues\n\nThe Makefile we use here to implement all functionality intentionally lacks\nsome of the typical Make magic: Targets don't track dependencies so you will\nhave to rebuild everything, whenever you change something. So please `make\nclean`, first. Yes – a full build will cost you a valuable six seconds every\ntime. Use them to worship code simplicity.\n\nI didn't have much luck with booting i386 images via UEFI – neither the stock\nDebian images nor the remastered ones. But maybe it's just my particular\nmachine/BIOS...\n\n\n## Dependencies\n\nTo install all necessary tools run:\n\n    make install-depends\n\nThis tool was developed and tested on Debian LINUX. While all major LINUX\ndistributions are likely to offer the necessary pieces of software, there may\nbe some non-obvious differences. Accordingly, I recommend to run this on a\nDebian system. One difference that I am aware of is that many distributions use\neither `genisoimage` or `mkisofs` and make one of them a symbolic link to the\nother. In this particular case, they are not interchangeable – `genisoimage`\nis required.\n\nIf you don't have a Debian system, you can build using a docker container –\nsee [below](#building-in-a-non-debian-environment)\n\n\n## Configuration\n\nEdit `Makevars` and set the variables to match your situation. You can use \n\n    make config\n\nto do so. This should work on most Debian-based systems. If it doesn't, just edit\nthe `Makevars` file with your preferred text editor.\n\n\n### Image names, architecture and usb device\n\nAt the very minimum you need to set the following variables:\n\n`SOURCE`: the name of your stock Debian ISO image file.\n\n`TARGET` the name of the remastered ISO image.\n\n`ARCH` (DEPRECATED) indicates the target processor architecture – `amd64` or\n`i386` (other architectures are not supported). This variable is used to\nidentify the installation folder in the image (`install.amd`) and to determine\nwhich image to download. As of Debian 13, `i386` is no longer a supported\narchitecture.  For the moment, I will keep the variable to support working with\nlegacy versions. In the long run this option will disappear.\n\n`USBDEV` is the device file that represents your usb stick. The latter is\nneeded for `make usb` and `make FAT`. Be **extra careful** to set `USBDEV`\ncorrectly! If you set it incorrectly, you may overwrite your system disk!\n\n`LABEL` is the CD volume label. It *must* be ≤ 32 chars in length.\n\n\n\n### Console parameters\n\nWhile the main goal of this project was to allow installation via `ssh`, a serial \nconsole is an alternative in some cases.\n\nThe following default config for the serial console device should work most of\nthe time:\n\n    CONSOLE = ttyS0,115200n8\n\nWhen the serial console is active, *all output* is redirected to the serial\ninterface and you will not see boot messages or the installer on a connected\nscreen after that point. Accordingly, normal local installation will not work.\nIf you want your image to allow local installation (i.e. non-headless),\ninstead, you may set\n\n    CONSOLE = tty0\n\n\n\n## Download Debian installation image\n\nYou can just download the latest Debian *netinst* image with\n\n    make download\n\nIf this is not the image you want to start with, just download/provide one\nyourself and save it in the folder where this Makefile lives.  \n\nIn any case, make sure to set the `SOURCE` variable in the config file (`make\nconfig`) to match the image name.\n\n\n\n## Preseeding\n\nPreseeding is Debian's method of automatically answering some or all of the\nconfiguration questions you usually have to answer during the installation\nprocess.\n\nYou *must provide* a `preseed.cfg` file for headless installation!\n\nThe included `preseed.cfg` file configures the bare minimum to get past the\ninstaller questions so that network and ssh can be launched.  Please edit the\nfile – at least change the password...\n\nIf the minimal file does not cover all your needs, get a full template\n\n    make example-preseed.cfg\n    mv example-preseed.cfg preseed.cfg\n\nand modify it to your needs. For comprehensive information on preseeding, study\nthis:\n\n<https://www.debian.org/releases/stable/amd64/apb.en.html>\n\nor\n\n<https://www.debian.org/releases/stable/i386/apb.en.html>\n\n\n## Building the ISO\n\n    make clean\n    make image\n\n\n## Manual modifications to the image\n\nFor experts, only! If you know what you are doing, you can now enter the `tmp`\nfolder and add packages, edit files etc. You can find some information on what\nyou can do [here](https://wiki.debian.org/DebianInstaller/Modify/CD). But you\ndon't need to manually follow the steps for re-creating md5 sums and assembling\nthe image.\n\nTo pack your changes into the image just run the last steps manually, again:\n\n    make md5sums\n    make iso\n\n\n## Dry run it\n\nThis step is optional but may save you a lot of trouble later.\n\n    make qemu-bios\n    make qemu-uefi\n\nThis will fire up a QEMU session booting your new image.\n\n\nYou can follow the\nboot process in the emulator and eventually connect to the installer like this:\n\n    ssh installer@localhost -p22222\n\nOr via serial console:\n\n    telnet localhost 33333\n\nSo you can test-drive the installation before trying it on a real server.  The\ndefault password is `r00tme` – please change it in the preseeding file.\nAlternatively, you can configure passwordless login via ssh key file – there\nis example code in the `preseed.cfg`. For this to work, you need to provide the\nkey file from a local web server. In pinch, this may be all you need:\n\n    python3 -m http.server\n\nAnd here a little screenshot of what that looks like in qemu. The two bottom\npanels show the local screen (left) and the serial console (right):\n\n![](screenshot.png)\n\n\n## Write to usb stick or burn cd\n\nIf you still have a cdrom drive, use your favorite ISO burner to write the\nimage to cd. I can't find my old usb-cd drive and prefer using a usb stick,\nanyway:\n\nInsert a USB stick and find out its device file\n\n    lsblk\n\n**Double check**, that `USBDEV` is set correctly in `Makevars`.\n\n**Caution:** The next two steps will write to the device configured in the\n`USBDEV`. If you failed to set that correctly, you will overwrite whatever disk\nhappens to be associated with that device!\n\nWrite the image to the stick:\n\n    make usb\n\nAdd a FAT partition to the stick:\n\n    make FAT\n\nThis may be useful if you need to add custom firmware files or anything else\nyou would like to use during installation.\n\n\n## Building in a non-Debian environment\n\nThe build process works on Debian machines. However, some users want to install\na headless Debian machine but don't run Debian on their own computer. If you\nrun into problems building the image on your OS, you can use the `docker-image`\ntarget.  This will build a minimal Debian container, install the dependencies\nand run the build process in the docker container, instead of your local OS.\nThat way, you can easily run this on non-Debian systems like Arch, Fedora etc.\nPlease note that the output files of the docker build are owned by root, so you\nneed to clean up with `sudo make clean` afterwards.\n\n## Remote Installation via ssh\n\nInsert the USB stick (or CD) in the target system and power it up. Wait a few\nminutes for the installer to boot and bring up the network. Find out the IP\naddress of the machine (e.g. from the router/DHCP server). Alternatively,\nconfigure static IP in the preseed file. Once the system is up you should be\nable to ping it. Now log in and complete the installation remotely:\n\n    ssh installer@yourmachine\n\nThe default password is `r00tme`; it can (and should!) be configured in the\npreseeding file.  Alternatively, you can configure passwordless login via ssh\nkey file – there is example code in the `preseed.cfg`. For this to work, you\nneed to provide the key file from a local web server.\n\nNOTE: The included minimal `preseed.cfg` assumes that you are connected via\nLAN cable (as a server should be). If you want to/must use a WIFI connection you\nneed to configure this.\n\n\n## Remote installation via serial console\n\nIf the serial interface was configured correctly, you should be able to connect\nthrough a terminal program (`cu`, `minicom`, etc.) via serial interface.  E.g.\n\n    cu -l /dev/ttyUSB0 -s 115200 \n\nor\n\n    screen /dev/ttyUSB0 115200\n\nWhere `/dev/ttyUSB0` is the serial interface on your local computer which is\nconnected to the server.\n\nIn the case of a virtual serial interface in iLO (or similar), please refer to\nthe manufacturers instructions on how to connect to it.\n\n\n## Random notes\n\nJust because it took me a while to realize: The Debian remote-installer uses\n`screen` to provide multiple virtual consoles. You can switch between them with\n`CTRL-a TAB`. See `man screen` for more information.\n\n\n# Contributing\n\nIf you found a bug or have an idea for improvements, feel free to open an issue and\ndescribe the fix or feature you have in mind. Please don't submit a pull request\nwithout discussing it, first.\n\n"
  },
  {
    "path": "preseed.cfg",
    "content": "#### Contents of the preconfiguration file (for stretch)\n### Localization\n# Locale sets language and country.\nd-i debian-installer/locale string en_US.UTF-8\nd-i debian-installer/language string en\nd-i debian-installer/country string DE\n\n# Keyboard selection.\nd-i console-keymaps-at/keymap select us\nd-i keyboard-configuration/xkb-keymap select us\n\n### Network configuration\n#d-i netcfg/choose_interface select eth0\nd-i netcfg/choose_interface select auto\n\n# Any hostname and domain names assigned from dhcp take precedence over\n# values set here. However, setting the values still prevents the questions\n# from being shown, even if values come from dhcp.\nd-i netcfg/get_hostname string tempwatch\nd-i netcfg/get_domain string local\n\n# If you want to force a hostname, regardless of what either the DHCP\n# server returns or what the reverse DNS entry for the IP is, uncomment\n# and adjust the following line.\n#d-i netcfg/hostname string tempwatch\n\n# Static network configuration - uncomment if desired\n#d-i netcfg/disable_autoconfig boolean true\n#d-i netcfg/get_ipaddress string 192.168.0.10\n#d-i netcfg/get_netmask string 255.255.255.0\n#d-i netcfg/get_gateway string 192.168.0.1\n#d-i netcfg/get_nameservers string 192.168.0.1\n#d-i netcfg/confirm_static boolean true\n\n\n# If non-free firmware is needed for the network or other hardware, you can\n# configure the installer to always try to load it, without prompting. Or\n# change to false to disable asking.\nd-i hw-detect/load_firmware boolean true\n\n# Setup network console\nd-i preseed/early_command string anna-install network-console\nd-i network-console/start select continue\n# Login with password:\nd-i network-console/password password r00tme\nd-i network-console/password-again password r00tme\n# Login with ssh key:\n# d-i network-console/authorized_keys_url string https://my.server/authorized_key\n# disable login with password:\n# d-i network-console/password-disabled boolean true\n"
  },
  {
    "path": "preseed_with_ssh_keys.cfg",
    "content": "#### Contents of the preconfiguration file (for stretch)\n### Localization\n# Locale sets language and country.\nd-i debian-installer/locale string en_US.UTF-8\nd-i debian-installer/language string en\nd-i debian-installer/country string DE\n\n# Keyboard selection.\nd-i console-keymaps-at/keymap select us\nd-i keyboard-configuration/xkb-keymap select us\n\n### Network configuration\n#d-i netcfg/choose_interface select eth0\nd-i netcfg/choose_interface select auto\n\n# Any hostname and domain names assigned from dhcp take precedence over\n# values set here. However, setting the values still prevents the questions\n# from being shown, even if values come from dhcp.\nd-i netcfg/get_hostname string tempwatch\nd-i netcfg/get_domain string local\n\n# If you want to force a hostname, regardless of what either the DHCP\n# server returns or what the reverse DNS entry for the IP is, uncomment\n# and adjust the following line.\n#d-i netcfg/hostname string tempwatch\n\n# Static network configuration - uncomment if desired\n#d-i netcfg/disable_autoconfig boolean true\n#d-i netcfg/get_ipaddress string 192.168.0.10\n#d-i netcfg/get_netmask string 255.255.255.0\n#d-i netcfg/get_gateway string 192.168.0.1\n#d-i netcfg/get_nameservers string 192.168.0.1\n#d-i netcfg/confirm_static boolean true\n\n\n# If non-free firmware is needed for the network or other hardware, you can\n# configure the installer to always try to load it, without prompting. Or\n# change to false to disable asking.\nd-i hw-detect/load_firmware boolean true\n\n# Setup network console\n#\n# It also adds an ssh key so it's possible to ssh using a hardcoded key\n# instead of a hardcoded password\n#\n# CONFIG: the ssh key used is a fake key. Replace it with your key.\n\nd-i preseed/early_command string anna-install network-console; \\\nmkdir -p /.ssh; \\\n/bin/sh -c \"echo 'ssh-ed25519 IkxcEAPhTmUlSPMGXtXwGDOyMJoPuPw1vMcoWF1VtyvDX6b1uEG7A68hLEAdaglpEYPs foobar' >> /.ssh/authorized_keys\"; \\\nchown -R root:root /.ssh/; \\\nchmod 600 /.ssh/authorized_keys; \\\nchmod 700 /.ssh/\n\nd-i network-console/start select continue\n# Login with password:\n#d-i network-console/password password r00tme\n#d-i network-console/password-again password r00tme\n\n# Login with ssh key:\n# d-i network-console/authorized_keys_url string https://my.server/authorized_key\n# disable login with password:\n# d-i network-console/password-disabled boolean true\n\n# The hashed password. The hash used is 'yescrypt'. The password is r00tme\nd-i passwd/root-password-crypted password $y$j9T$KExqDg1NJD/O8tOKKPFKZ0$0oYiztbbVLLitCPtVd5TKxeB1edk.CusVf3WeIzmvE6\n\n# Install dropbear and use it for initramfs. It's only useful for rare cases,\n# like remotely unlocking LUKS.\n# CONFIG: it expects dropbear to be in /cdrom/extra/\n#   This can be done by putting the following commands into Makefile\n#   at the end of 'unpack' target. Adjust the dropbear files location for your case.\n#     mkdir -p ${TMP}/extra\n#     cp ../distrib/dropbear/* ${TMP}/extra\n#   If you have a big installation media, like DLBD, then dropbear is already available\n#   and you can replace `cp + dpkg` with `apt-get install`\n# CONFIG: the ssh key used is a fake key. Replace it with your key.\n# CONFIG: change the dpkg file names to the ones available in your case.\n# CONFIG: change the dropbear port (6322 in this case) with the one that suits you.\n\nd-i preseed/late_command string in-target mkdir -p /root/.ssh; \\\nin-target /bin/sh -c \"echo 'ssh-ed25519 IkxcEAPhTmUlSPMGXtXwGDOyMJoPuPw1vMcoWF1VtyvDX6b1uEG7A68hLEAdaglpEYPs foobar' >> /root/.ssh/authorized_keys\"; \\\nin-target chown -R root:root /root/.ssh/; \\\nin-target chmod 600 /root/.ssh/authorized_keys; \\\nin-target chmod 700 /root/.ssh/; \\\nin-target apt-get -y install libcrypt1 libtomcrypt1 libtommath1 zlib1g; \\\ncp /cdrom/extra/dropbear* /target/tmp; \\\nin-target dpkg -i /tmp/dropbear-bin_2022.83-1+deb12u1_amd64.deb; \\\nin-target dpkg -i /tmp/dropbear-initramfs_2022.83-1+deb12u1_all.deb; \\\nin-target /bin/sh -c \"echo 'ssh-ed25519 IkxcEAPhTmUlSPMGXtXwGDOyMJoPuPw1vMcoWF1VtyvDX6b1uEG7A68hLEAdaglpEYPs foobar' >> /etc/dropbear/initramfs/authorized_keys\"; \\\nin-target /bin/sh -c \"echo 'DROPBEAR_OPTIONS=\\\"-I 300 -j -k -p 6322 -s -c cryptroot-unlock\\\" ' >> /etc/dropbear/initramfs/dropbear.conf\"; \\\nin-target update-initramfs -u\n\n"
  },
  {
    "path": "templates/grub.cfg.template",
    "content": "default=Install\ntimeout=0\nmenuentry 'Install' {\n    set background_color=black\n    linux    /install.<ARCH>/vmlinuz vga=788 <CONSOLE> --- <CONSOLE>\n    initrd   /install.<ARCH>/initrd.gz\n}\n"
  },
  {
    "path": "templates/isolinux.cfg.template",
    "content": "DEFAULT install\n  SAY Now booting the debian installer\nLABEL install\n\tkernel /install.<ARCH>/vmlinuz\n    append vga=788 <CONSOLE> initrd=/install.<ARCH>/initrd.gz --- quiet\n"
  }
]