Based on https://sowhatisthesolution.wordpress.com/2016/03/13/headless-debian-install-via-ssh/
wget https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.3.0-amd64-netinst.iso
sudo mount -o loop -t iso9660 debian-9.3.0-amd64-netinst.iso isoorig/
mkdir isonew
rsync -a -H –exclude=TRANS.TBL isoorig/ isonew
cd isonew
# edit all files defined here
mkisofs -o ../custom_install.iso -r -J -no-emul-boot -boot-load-size 4 -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat ../isonew