#!/bin/sh

cd x86_64
curl --location --remote-time http://ftp.debian.org/debian/dists/bullseye/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz --time-cond initrd.gz.orig -o initrd.gz.orig
curl --location --remote-time http://ftp.debian.org/debian/dists/bullseye/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux --time-cond linux -o linux

#https://wiki.debian.org/DebianInstaller/NetbootFirmware

curl --location --remote-time http://cdimage.debian.org/cdimage/unofficial/non-free/firmware/bullseye/current/firmware.cpio.gz --time-cond firmware.cpio.gz -o firmware.cpio.gz
if [ "firmware.cpio.gz" -nt "initrd.gz" ] || [ "initrd.gz.orig" -nt "initrd.gz" ]; then
  cat initrd.gz.orig firmware.cpio.gz > initrd.gz
fi
