From 764990e01f98226a4fdc427faa96425dfd163783 Mon Sep 17 00:00:00 2001 From: Gardais Jeremy Date: Tue, 26 Jul 2016 17:14:22 +0200 Subject: [PATCH] Add a script to download PXE files for Clonezilla --- scripts/README.md | 19 +++++++++---- scripts/download_clonezilla.sh | 52 ++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 5 deletions(-) create mode 100755 scripts/download_clonezilla.sh diff --git a/scripts/README.md b/scripts/README.md index 60583df..6c90b2d 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -5,8 +5,9 @@ * [Download Debian](#download_debiansh) * [Download Ubuntu](#download_ubuntush) * [Make Debian Initrd with Firmware](#make_debian_initrd_with_firmwaresh) - * [Download diag tools](#download_diag_toolssh) * [Debian late_command](#debian-late_command) + * [Download diag tools](#download_diag_toolssh) + * [Download Clonezilla](#download_clonezillash) ## Description Set of scripts to download and generate necessary files to allow differents GNU/Linux distributions to boot through the network. @@ -37,10 +38,6 @@ The script will provide Debian's netboot installers with **additionnals firmware * **qlogic** : For QLogic Infiniband, SCSI, Fibre Channel/FCoE adapters. * Extract initrd and firmwares packages to build a new initrd. -### download_diag_tools.sh -The script will download some diagnostic tools : - * memtest86 from [memtest86's official website][memtest official website]. - ### Debian late_command #### Description @@ -76,5 +73,17 @@ in-target /usr/bin/tftp ${IP.SRV.TFTP} -c get ${PATH/TO/TFTPD/ROOT}/scripts/late in-target tar xzf /tmp/latecommand.tar.gz -C /tmp/ ; \ in-target /bin/sh /tmp/latecommand/post.sh ``` +### download_diag_tools.sh +The script will download some diagnostic tools : + * memtest86 from [memtest86's official website][memtest official website]. + +### download_clonezilla.sh +* Download PXE files for Clonezilla live from [OSDN][OSDN url]. A Sourceforge repository is also available but…; see the [Clonezilla download page][clonezilla download] for more informations. +* Download for both **amd64** and **i686**. +* Make a example configuration file. +* More informations on the [Clonezilla website][clonezilla via pxe server]. [memtest official website]: http://www.memtest.org/#downiso "Memtest86+ download" +[OSDN url]: https://osdn.jp/projects/clonezilla/ +[clonezilla dowload]: http://clonezilla.org/downloads/download.php?branch=stable +[clonezilla via pxe server]: http://clonezilla.org/livepxe.php "Clonezilla Live on PXE server" diff --git a/scripts/download_clonezilla.sh b/scripts/download_clonezilla.sh new file mode 100755 index 0000000..734cf18 --- /dev/null +++ b/scripts/download_clonezilla.sh @@ -0,0 +1,52 @@ +#!/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 + 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.27.239/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