Skip to content

Instantly share code, notes, and snippets.

@youssefeldakar
Created December 24, 2019 12:10
Show Gist options
  • Save youssefeldakar/9b5664c6f00d7369f9f4bd08e7a674a2 to your computer and use it in GitHub Desktop.
Save youssefeldakar/9b5664c6f00d7369f9f4bd08e7a674a2 to your computer and use it in GitHub Desktop.
Get Debian (or Ubuntu) netboot installer files for multiple distributions
#!/bin/sh
#
# [email protected]
#
# get-d-i.sh ftp.debian.org/debian/{lenny,squeeze} archive.ubuntu.com/ubuntu/lucid
for i in $*; do
IFS=/ read h d v <<EOF
$i
EOF
for j in amd64 i386; do
mkdir -p $d-installer.$v
mkdir -p $d-installer.$v/.$j
cd $d-installer.$v/.$j
wget -q http://$h/$d/dists/$v/main/installer-$j/current/images/netboot/netboot.tar.gz && tar zxf netboot.tar.gz
cd ..
if [ -e $d-installer/$j ]; then
rm -r $d-installer/$j
fi
cp -r .$j/$d-installer/$j .
rm -r .$j
# Rewrite paths that reference the installer directory.
find $j/pxelinux.cfg $j/boot-screens -follow -type f | xargs \
sed -i "s/$d-installer\//$d-installer\.$v\//"
cd ..
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment