tftpboot/scripts/download_clonezilla.sh

53 lines
1.6 KiB
Bash
Raw Normal View History

#!/bin/bash
# This script do the following:
# Download Clonezilla Stable for amd64 and i686
# Make a PXE's config file (aka menu.cfg)
TFTP_ROOT="/var/lib/tftpboot"
CZ_INSTALLER_DIR="${TFTP_ROOT}/installer/clonezilla"
CZ_CONFIG_PXE="${CZ_INSTALLER_DIR}/menu.cfg.example"
CZ_VERSION="2.4.7-8"
# Create directories and config file
rm -rf "${CZ_INSTALLER_DIR}"
mkdir -p "${CZ_INSTALLER_DIR}"
touch "${CZ_CONFIG_PXE}"
for ARCH in amd64 i686; do # For available classic architecture
CZ_URL="https://osdn.jp/dl/clonezilla/clonezilla-live-${CZ_VERSION}-${ARCH}.zip"
CZ_TEMP_FILE="/tmp/clonezilla-live-"${CZ_VERSION}"-"${ARCH}".zip "
# Create and go into directory
mkdir -p ${CZ_INSTALLER_DIR}/${ARCH}
pushd ${CZ_INSTALLER_DIR}/${ARCH}
# Download and extract only PXE files
wget "${CZ_URL}" -O "${CZ_TEMP_FILE}"
unzip -j "${CZ_TEMP_FILE}" live/vmlinuz live/initrd.img live/filesystem.squashfs -d .
rm -f "${CZ_TEMP_FILE}"
popd
# Config file
/bin/cat >> "${CZ_CONFIG_PXE}" << EOF
label live${ARCH}
menu label Clonezilla Live ^${ARCH}
kernel installer/clonezilla/${ARCH}/vmlinuz
2016-09-20 12:13:32 +02:00
APPEND initrd=installer/clonezilla/${ARCH}/initrd.img boot=live username=user union=overlay config components quiet noswap edd=on nomodeset nodmraid locales= keyboard-layouts= ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_batch=no net.ifnames=0 nosplash noprompt fetch=tftp://129.20.203.27/installer/clonezilla/${ARCH}/filesystem.squashfs
EOF
done
# Config file
/bin/cat >> "${CZ_CONFIG_PXE}" << EOF
label separator
menu label -----
label mainmenu
menu label ^Back..
menu exit
EOF
exit 0