Sep 272017
 

I wrote a little snippet to update my PXE server’s Debian netboot image so I can schedule this to run every month or so to ensure that my Netboot image is up to date.

The variables are to set the Debian mirror, architecture, and paths and filenames for the downloaded image file, and where the image file should be un-tarred to.
I have architecture in there because I had some old machines which require i386 kernels. If you don’t need i386, then you can replace all the arch variables and hardcode amd64 instead.

#!/bin/bash
debmirror=http://mirror.internode.on.net/pub/debian
arch=amd64
tmpfile=/tmp/$arch-netboot.tar.gz
tftppath=/srv/tftp/deb-stable/$arch
wget $debmirror/dists/stable/main/installer-$arch/current/images/netboot/netboot.tar.gz -O $tmppath
tar -C $tftppath -xzf $tmpfile ./debian-installer/amd64/initrd.gz ./debian-installer/amd64/linux --strip-components=3

Share