2016-07-26 15:34:30 +02:00
|
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
# This script do the following:
|
|
|
|
|
# Download Memtest
|
|
|
|
|
|
2018-02-14 10:25:14 +01:00
|
|
|
|
if command -v in.tftpd > /dev/null; then
|
|
|
|
|
source /etc/default/tftpd-hpa
|
|
|
|
|
else
|
|
|
|
|
TFTP_DIRECTORY="/srv/tftp"
|
|
|
|
|
fi
|
2016-07-26 15:34:30 +02:00
|
|
|
|
|
2018-02-14 10:28:31 +01:00
|
|
|
|
|
|
|
|
|
if ! command -v unzip > /dev/null; then
|
2018-02-14 10:56:23 +01:00
|
|
|
|
apt -y install unzip
|
2018-02-14 10:28:31 +01:00
|
|
|
|
fi
|
|
|
|
|
|
2016-07-26 15:34:30 +02:00
|
|
|
|
### Memtest {{{
|
|
|
|
|
MEMTEST_VERSION="5.01"
|
|
|
|
|
MEMTEST_URL="http://www.memtest.org/download/${MEMTEST_VERSION}/memtest86+-${MEMTEST_VERSION}.bin.gz"
|
2018-02-14 10:25:14 +01:00
|
|
|
|
MEMTEST_INSTALLER_DIR="${TFTP_DIRECTORY}/installer/memtest/"
|
2016-07-26 15:34:30 +02:00
|
|
|
|
|
|
|
|
|
# (re)Create the installer directory
|
|
|
|
|
rm -rf ${MEMTEST_INSTALLER_DIR}
|
|
|
|
|
mkdir -p ${MEMTEST_INSTALLER_DIR}
|
2018-02-14 10:56:23 +01:00
|
|
|
|
pushd ${MEMTEST_INSTALLER_DIR} > /dev/null
|
2016-07-26 15:34:30 +02:00
|
|
|
|
|
2018-02-14 10:25:14 +01:00
|
|
|
|
# Config file
|
|
|
|
|
CONFIG_PXE="${TFTP_DIRECTORY}/installer/menu.cfg.diag.example"
|
|
|
|
|
rm -f ${CONFIG_PXE} && touch ${CONFIG_PXE}
|
|
|
|
|
|
2016-07-26 15:34:30 +02:00
|
|
|
|
# Download the last version and set simpler name (without the **.bin** extension !)
|
2018-02-14 10:56:23 +01:00
|
|
|
|
#wget ${MEMTEST_URL} -O - | gzip -d > memtest86+-${MEMTEST_VERSION}.bin
|
|
|
|
|
wget --quiet ${MEMTEST_URL} -O - | gzip -d > memtest86+-${MEMTEST_VERSION}.bin
|
2016-07-26 15:34:30 +02:00
|
|
|
|
ln -s memtest86+-${MEMTEST_VERSION}.bin memtest86+
|
|
|
|
|
|
2018-02-14 10:56:23 +01:00
|
|
|
|
popd > /dev/null
|
2016-07-26 15:34:30 +02:00
|
|
|
|
|
|
|
|
|
# Config file
|
|
|
|
|
/bin/cat >> "${CONFIG_PXE}" << EOF
|
|
|
|
|
label memtest
|
|
|
|
|
menu label ^Memory diagnostic tool (Memtest)
|
|
|
|
|
kernel installer/memtest/memtest86+
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
### }}}
|
|
|
|
|
|
2016-07-27 14:09:20 +02:00
|
|
|
|
### Gparted {{{
|
2017-02-15 10:03:15 +01:00
|
|
|
|
GPARTED_VERSION="0.27.0-1"
|
2018-02-14 10:25:14 +01:00
|
|
|
|
GPARTED_INSTALLER_DIR="${TFTP_DIRECTORY}/installer/gparted"
|
2016-07-27 14:09:20 +02:00
|
|
|
|
|
|
|
|
|
# (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}
|
2018-02-14 10:56:23 +01:00
|
|
|
|
pushd ${GPARTED_INSTALLER_DIR}/${ARCH} > /dev/null
|
2016-07-27 14:09:20 +02:00
|
|
|
|
|
|
|
|
|
# Download and extract only PXE files
|
2018-02-14 10:56:23 +01:00
|
|
|
|
#wget "${GPARTED_URL}" -O "${GPARTED_TEMP_FILE}"
|
|
|
|
|
wget --quiet "${GPARTED_URL}" -O "${GPARTED_TEMP_FILE}"
|
|
|
|
|
#unzip -j "${GPARTED_TEMP_FILE}" live/filesystem.squashfs live/initrd.img live/vmlinuz -d .
|
|
|
|
|
unzip -q -j "${GPARTED_TEMP_FILE}" live/filesystem.squashfs live/initrd.img live/vmlinuz -d .
|
2016-07-27 14:09:20 +02:00
|
|
|
|
rm -f "${GPARTED_TEMP_FILE}"
|
|
|
|
|
|
2018-02-14 10:56:23 +01:00
|
|
|
|
popd > /dev/null
|
2016-07-27 14:09:20 +02:00
|
|
|
|
|
|
|
|
|
/bin/cat >> "${CONFIG_PXE}" << EOF
|
|
|
|
|
label gpartedlive${ARCH}
|
|
|
|
|
menu label Partiton Manager ${ARCH} (^Gparted)
|
|
|
|
|
kernel installer/gparted/${ARCH}/vmlinuz
|
2016-09-20 12:13:32 +02:00
|
|
|
|
append initrd=installer/gparted/${ARCH}/initrd.img boot=live config components union=overlay username=user noswap noeject ip= vga=788 fetch=tftp://129.20.203.27/installer/gparted/${ARCH}/filesystem.squashfs
|
2016-07-27 14:09:20 +02:00
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### }}}
|
|
|
|
|
|
|
|
|
|
# Config file
|
|
|
|
|
/bin/cat >> "${CONFIG_PXE}" << EOF
|
|
|
|
|
label separator
|
|
|
|
|
menu label -----
|
|
|
|
|
label mainmenu
|
|
|
|
|
menu label ^Back..
|
|
|
|
|
menu exit
|
|
|
|
|
EOF
|
|
|
|
|
|
2016-07-26 15:34:30 +02:00
|
|
|
|
exit 0
|