tftpboot/scripts/download_diag_tools.sh

82 lines
2.2 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 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}
### 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/"
# (re)Create the installer directory
rm -rf ${MEMTEST_INSTALLER_DIR}
mkdir -p ${MEMTEST_INSTALLER_DIR}
pushd ${MEMTEST_INSTALLER_DIR}
# 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+
popd
# Config file
/bin/cat >> "${CONFIG_PXE}" << EOF
label memtest
menu label ^Memory diagnostic tool (Memtest)
kernel installer/memtest/memtest86+
EOF
### }}}
### Gparted {{{
GPARTED_VERSION="0.26.1-3"
GPARTED_INSTALLER_DIR="${TFTP_ROOT}/installer/gparted"
# (re)Create the installer directory
rm -rf ${GPARTED_INSTALLER_DIR}
mkdir -p ${GPARTED_INSTALLER_DIR}
for ARCH in amd64 i686; do # For available classic architecture
GPARTED_URL="http://downloads.sourceforge.net/project/gparted/gparted-live-stable/${GPARTED_VERSION}/gparted-live-${GPARTED_VERSION}-${ARCH}.zip"
GPARTED_TEMP_FILE="gparted-live-${GPARTED_VERSION}-${ARCH}.zip"
# Create and go into directory
mkdir -p ${GPARTED_INSTALLER_DIR}/${ARCH}
pushd ${GPARTED_INSTALLER_DIR}/${ARCH}
# Download and extract only PXE files
wget "${GPARTED_URL}" -O "${GPARTED_TEMP_FILE}"
unzip -j "${GPARTED_TEMP_FILE}" live/filesystem.squashfs live/initrd.img live/vmlinuz -d .
rm -f "${GPARTED_TEMP_FILE}"
popd
/bin/cat >> "${CONFIG_PXE}" << EOF
label gpartedlive${ARCH}
menu label Partiton Manager ${ARCH} (^Gparted)
kernel installer/gparted/${ARCH}/vmlinuz
append initrd=installer/gparted/${ARCH}/initrd.img boot=live config components union=overlay username=user noswap noeject ip= vga=788 fetch=tftp://129.20.27.239/installer/gparted/${ARCH}/filesystem.squashfs
EOF
done
### }}}
# Config file
/bin/cat >> "${CONFIG_PXE}" << EOF
label separator
menu label -----
label mainmenu
menu label ^Back..
menu exit
EOF
exit 0