Ensure to use the correct TFTP_ROOT_DIR

If tftpd-hpa is available, ensure to source it's preferences file.
Otherwise, define a default TFTP_DIRECTORY var.
This commit is contained in:
Jeremy Gardais 2018-02-14 10:25:14 +01:00
parent 1654bf7683
commit a54ecc428c
5 changed files with 51 additions and 25 deletions

View File

@ -4,9 +4,13 @@
# Download Clonezilla Stable for amd64 and i686
# Make a PXE's config file (aka menu.cfg)
TFTP_ROOT="/var/lib/tftpboot"
if command -v in.tftpd > /dev/null; then
source /etc/default/tftpd-hpa
else
TFTP_DIRECTORY="/srv/tftp"
fi
CZ_INSTALLER_DIR="${TFTP_ROOT}/installer/clonezilla"
CZ_INSTALLER_DIR="${TFTP_DIRECTORY}/installer/clonezilla"
CZ_CONFIG_PXE="${CZ_INSTALLER_DIR}/menu.cfg.example"
CZ_VERSION="2.5.0-5"

View File

@ -8,18 +8,26 @@
# Download Debian Unstable (Sid)
# Make an PXE's config file (aka menu.cfg)
TFTP_ROOT="/var/lib/tftpboot"
if command -v in.tftpd > /dev/null; then
source /etc/default/tftpd-hpa
else
TFTP_DIRECTORY="/srv/tftp"
fi
# Config file
CONFIG_PXE="${TFTP_ROOT}/installer/debian/menu.cfg.example"
rm -f ${CONFIG_PXE} && touch ${CONFIG_PXE}
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 ${TFTP_ROOT}/installer/debian/${DISTRO}/${ARCH}
pushd ${TFTP_ROOT}/installer/debian/${DISTRO}/${ARCH}
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
@ -27,7 +35,7 @@ for DISTRO in stretch buster jessie wheezy sid; do # For ALL Debian's version
popd
# Config file
/bin/cat >> "${CONFIG_PXE}" << EOF
/bin/cat >> "${DEBIAN_CONFIG_PXE}" << EOF
label ${DISTRO}${ARCH}
menu label Debian GNU/Linux ${DISTRO} ^${ARCH} bits
kernel installer/debian/${DISTRO}/${ARCH}/linux
@ -36,14 +44,14 @@ EOF
done
# Config file
/bin/cat >> "${CONFIG_PXE}" << EOF
/bin/cat >> "${DEBIAN_CONFIG_PXE}" << EOF
label separator
menu label ---
EOF
done
# Config file
/bin/cat >> "${CONFIG_PXE}" << EOF
/bin/cat >> "${DEBIAN_CONFIG_PXE}" << EOF
label mainmenu
menu label ^Back...
menu exit

View File

@ -3,22 +3,26 @@
# This script do the following:
# Download Memtest
TFTP_ROOT="/var/lib/tftpboot"
# Config file
CONFIG_PXE="${TFTP_ROOT}/installer/menu.cfg.diag.example"
rm -f ${CONFIG_PXE} && touch ${CONFIG_PXE}
if command -v in.tftpd > /dev/null; then
source /etc/default/tftpd-hpa
else
TFTP_DIRECTORY="/srv/tftp"
fi
### Memtest {{{
MEMTEST_VERSION="5.01"
MEMTEST_URL="http://www.memtest.org/download/${MEMTEST_VERSION}/memtest86+-${MEMTEST_VERSION}.bin.gz"
MEMTEST_INSTALLER_DIR="${TFTP_ROOT}/installer/memtest/"
MEMTEST_INSTALLER_DIR="${TFTP_DIRECTORY}/installer/memtest/"
# (re)Create the installer directory
rm -rf ${MEMTEST_INSTALLER_DIR}
mkdir -p ${MEMTEST_INSTALLER_DIR}
pushd ${MEMTEST_INSTALLER_DIR}
# Config file
CONFIG_PXE="${TFTP_DIRECTORY}/installer/menu.cfg.diag.example"
rm -f ${CONFIG_PXE} && touch ${CONFIG_PXE}
# Download the last version and set simpler name (without the **.bin** extension!)
wget ${MEMTEST_URL} -O - | gzip -d > memtest86+-${MEMTEST_VERSION}.bin
ln -s memtest86+-${MEMTEST_VERSION}.bin memtest86+
@ -36,7 +40,7 @@ EOF
### Gparted {{{
GPARTED_VERSION="0.27.0-1"
GPARTED_INSTALLER_DIR="${TFTP_ROOT}/installer/gparted"
GPARTED_INSTALLER_DIR="${TFTP_DIRECTORY}/installer/gparted"
# (re)Create the installer directory
rm -rf ${GPARTED_INSTALLER_DIR}

View File

@ -5,15 +5,19 @@
# Download Ubuntu 17.10 (artful)
# Make a symlink to access to the last LTS
TFTP_ROOT="/var/lib/tftpboot"
if command -v in.tftpd > /dev/null; then
source /etc/default/tftpd-hpa
else
TFTP_DIRECTORY="/srv/tftp"
fi
# last Long Term Support distribution name
LTS="xenial"
for DISTRO in artful ${LTS}; do
for ARCH in amd64 i386; do
mkdir -p ${TFTP_ROOT}/installer/ubuntu/${DISTRO}/${ARCH}
pushd ${TFTP_ROOT}/installer/ubuntu/${DISTRO}/${ARCH}
mkdir -p ${TFTP_DIRECTORY}/installer/ubuntu/${DISTRO}/${ARCH}
pushd ${TFTP_DIRECTORY}/installer/ubuntu/${DISTRO}/${ARCH}
wget http://fr.archive.ubuntu.com/ubuntu/dists/${DISTRO}/main/installer-${ARCH}/current/images/netboot/ubuntu-installer/${ARCH}/linux -O linux
wget http://fr.archive.ubuntu.com/ubuntu/dists/${DISTRO}/main/installer-${ARCH}/current/images/netboot/ubuntu-installer/${ARCH}/initrd.gz -O initrd.gz
popd
@ -21,7 +25,7 @@ for DISTRO in artful ${LTS}; do
done
# Link the LTS distribution name to lts
unlink ${TFTP_ROOT}/installer/ubuntu/lts
ln -s ${LTS} ${TFTP_ROOT}/installer/ubuntu/lts
unlink ${TFTP_DIRECTORY}/installer/ubuntu/lts
ln -s ${LTS} ${TFTP_DIRECTORY}/installer/ubuntu/lts
exit 0

View File

@ -8,6 +8,12 @@
# Extract all downloaded files
# Make a new initrd with the previous firmwares
if command -v in.tftpd > /dev/null; then
source /etc/default/tftpd-hpa
else
TFTP_DIRECTORY="/srv/tftp"
fi
for DISTRO in stretch buster jessie wheezy sid; do # For ALL Debian's version
TEMP_DIR=$(mktemp -d)
@ -48,8 +54,8 @@ for DISTRO in stretch buster jessie wheezy sid; do # For ALL Debian's version
popd
# Move it to PXE Debian installer
mkdir -p /var/lib/tftpboot/installer/debian/${DISTRO}/amd64/
mv initrd.gz /var/lib/tftpboot/installer/debian/${DISTRO}/amd64/initrd_firm.gz
mkdir -p ${TFTP_DIRECTORY}/installer/debian/${DISTRO}/amd64/
mv initrd.gz ${TFTP_DIRECTORY}/installer/debian/${DISTRO}/amd64/initrd_firm.gz
popd