tftpboot/scripts/download_debian.sh

61 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# This script do the following:
# Download Debian Stable (Stretch)
# Download Debian Testing (Buster)
# Download Debian oldStable (Jessie)
# Download Debian oldoldStable (Wheezy)
# Download Debian Unstable (Sid)
# Make an PXE's config file (aka menu.cfg)
if command -v in.tftpd > /dev/null; then
source /etc/default/tftpd-hpa
else
TFTP_DIRECTORY="/srv/tftp"
fi
DEBIAN_INSTALLER_DIR="${TFTP_DIRECTORY}/installer/debian"
DEBIAN_CONFIG_PXE="${DEBIAN_INSTALLER_DIR}/menu.cfg.example"
# Create directories and config file
rm -rf "${DEBIAN_INSTALLER_DIR}"
mkdir -p "${DEBIAN_INSTALLER_DIR}"
touch "${DEBIAN_CONFIG_PXE}"
for DISTRO in stretch buster jessie wheezy sid; do # For ALL Debian's version
for ARCH in amd64 i386; do # For all classic architecture
# Create and go into directory
mkdir -p ${DEBIAN_INSTALLER_DIR}/${DISTRO}/${ARCH}
pushd ${DEBIAN_INSTALLER_DIR}/${DISTRO}/${ARCH}
# Download files
wget http://ftp.fr.debian.org/debian/dists/${DISTRO}/main/installer-${ARCH}/current/images/netboot/debian-installer/${ARCH}/linux -O linux
wget http://ftp.fr.debian.org/debian/dists/${DISTRO}/main/installer-${ARCH}/current/images/netboot/debian-installer/${ARCH}/initrd.gz -O initrd.gz
popd
# Config file
/bin/cat >> "${DEBIAN_CONFIG_PXE}" << EOF
label ${DISTRO}${ARCH}
menu label Debian GNU/Linux ${DISTRO} ^${ARCH} bits
kernel installer/debian/${DISTRO}/${ARCH}/linux
append vga=normal initrd=installer/debian/${DISTRO}/${ARCH}/initrd.gz -- quiet
EOF
done
# Config file
/bin/cat >> "${DEBIAN_CONFIG_PXE}" << EOF
label separator
menu label ---
EOF
done
# Config file
/bin/cat >> "${DEBIAN_CONFIG_PXE}" << EOF
label mainmenu
menu label ^Back...
menu exit
EOF
exit 0