2016-07-26 17:14:22 +02:00
|
|
|
#!/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"
|
2017-02-15 09:58:08 +01:00
|
|
|
CZ_VERSION="2.5.0-5"
|
2016-07-26 17:14:22 +02:00
|
|
|
|
|
|
|
# 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
|
2016-07-27 12:16:51 +02:00
|
|
|
CZ_URL="https://osdn.jp/dl/clonezilla/clonezilla-live-${CZ_VERSION}-${ARCH}.zip"
|
|
|
|
CZ_TEMP_FILE="/tmp/clonezilla-live-"${CZ_VERSION}"-"${ARCH}".zip "
|
2016-07-26 17:14:22 +02:00
|
|
|
|
2016-07-27 12:16:51 +02:00
|
|
|
# Create and go into directory
|
|
|
|
mkdir -p ${CZ_INSTALLER_DIR}/${ARCH}
|
|
|
|
pushd ${CZ_INSTALLER_DIR}/${ARCH}
|
2016-07-26 17:14:22 +02:00
|
|
|
|
2016-07-27 12:16:51 +02:00
|
|
|
# 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}"
|
2016-07-26 17:14:22 +02:00
|
|
|
|
2016-07-27 12:16:51 +02:00
|
|
|
popd
|
2016-07-26 17:14:22 +02:00
|
|
|
|
2016-07-27 12:16:51 +02:00
|
|
|
# Config file
|
|
|
|
/bin/cat >> "${CZ_CONFIG_PXE}" << EOF
|
2016-07-26 17:14:22 +02:00
|
|
|
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
|
2016-07-26 17:14:22 +02:00
|
|
|
EOF
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
# Config file
|
|
|
|
/bin/cat >> "${CZ_CONFIG_PXE}" << EOF
|
|
|
|
label separator
|
|
|
|
menu label -----
|
|
|
|
label mainmenu
|
|
|
|
menu label ^Back..
|
|
|
|
menu exit
|
|
|
|
EOF
|
|
|
|
|
|
|
|
exit 0
|