From f3d08daab82b429a9658aa1813e8ef6646094862 Mon Sep 17 00:00:00 2001 From: r00t Date: Wed, 1 Jul 2015 04:00:34 -0400 Subject: [PATCH] make mini opt-in --- extra/build.conf.sample | 14 ++++++- lib/09-yo_dj.func.sh | 89 +++++++++++++++++++++++------------------ 2 files changed, 62 insertions(+), 41 deletions(-) diff --git a/extra/build.conf.sample b/extra/build.conf.sample index 697787f..3f85402 100644 --- a/extra/build.conf.sample +++ b/extra/build.conf.sample @@ -57,6 +57,10 @@ TFTPGRP="root" # (and thus doesn't fit on a normal CD. Still fits on DVDs and USBs though!) MULTIARCH="yes" +# If you would like to build an iPXE-enabled *mini* ISO *in addition to* the ful ISO, +# set this to "yes". Otherwise, just build the full ISO. +BUILDMINI="no" + # set to "yes" to enable pushing new changes to a git repo/committing to a local repo GIT="no" @@ -151,7 +155,6 @@ if [ -z "${MULTIARCH}" ]; then MULTIARCH="y" fi - MULTIARCH=${MULTIARCH:0:1} MULTIARCH=$(echo ${MULTIARCH} | tr [[:upper:]] [[:lower:]]) @@ -160,6 +163,13 @@ if [ -z "${I_AM_A_RACECAR}" ]; then I_AM_A_RACECAR="n" fi - I_AM_A_RACECAR=${I_AM_A_RACECAR:0:1} I_AM_A_RACECAR=$(echo ${I_AM_A_RACECAR} | tr [[:upper:]] [[:lower:]]) + +# BUILD MINI? +if [ -z "${BUILDMINI}" ]; +then + BUILDMINI="n" +fi +BUILDMINI=${BUILDMINI:0:1} +BUILDMINI=$(echo ${BUILDMINI} | tr [[:upper:]] [[:lower:]]) diff --git a/lib/09-yo_dj.func.sh b/lib/09-yo_dj.func.sh index c8d151b..8a73ac6 100644 --- a/lib/09-yo_dj.func.sh +++ b/lib/09-yo_dj.func.sh @@ -278,49 +278,60 @@ EOF -output "${ISODIR}/${ISOFILENAME}" "${TEMPDIR}" >> "${LOGFILE}.${FUNCNAME}" 2>&1 ## Build the mini-ISO ## - echo "Now generating the iPXE images; please wait..." - cd ${BASEDIR}/src/ipxe/src - git clean -xdf > /dev/null 2>&1 - git reset --hard HEAD >> "${LOGFILE}.${FUNCNAME}" 2>&1 - git checkout master >> "${LOGFILE}.${FUNCNAME}" 2>&1 - git pull >> "${LOGFILE}.${FUNCNAME}" 2>&1 - git checkout master >> "${LOGFILE}.${FUNCNAME}" 2>&1 - for i in $(find ${BASEDIR}/src/ipxe_local/patches/ -type f -iname "*.patch" -printf '%P\n'); - do - patch -Np2 < ${BASEDIR}/src/ipxe_local/patches/${i} >> "${LOGFILE}.${FUNCNAME}" 2>&1 - done - #make everything EMBED="${BASEDIR}/src/ipxe_local/EMBED" >> "${LOGFILE}.${FUNCNAME}" 2>&1 - make bin/ipxe.eiso EMBED="${BASEDIR}/src/ipxe_local/EMBED" >> "${LOGFILE}.${FUNCNAME}" 2>&1 - make bin/ipxe.usb EMBED="${BASEDIR}/src/ipxe_local/EMBED" >> "${LOGFILE}.${FUNCNAME}" 2>&1 - # Change this to USB-only... - #make all EMBED="${BASEDIR}/src/ipxe_local/EMBED" >> "${LOGFILE}.${FUNCNAME}" 2>&1 - mv -f ${BASEDIR}/src/ipxe/src/bin/ipxe.usb ${ISODIR}/${USBFILENAME} - mv -f ${BASEDIR}/src/ipxe/src/bin/ipxe.eiso ${ISODIR}/${MINIFILENAME} - make clean > /dev/null 2>&1 - git reset --hard > /dev/null 2>&1 - git clean -xdf > /dev/null 2>&1 - git checkout -- HEAD > /dev/null 2>&1 - #git reset --hard HEAD > /dev/null 2>&1 - echo + if [[ "${BUILDMINI}" == "y" ]]; + then + echo "Now generating the iPXE images; please wait..." + git submodule init >> "${LOGFILE}.${FUNCNAME}" 2>&1 + git submodule update >> "${LOGFILE}.${FUNCNAME}" 2>&1 + cd ${BASEDIR}/src/ipxe/src + git clean -xdf > /dev/null 2>&1 + git reset --hard HEAD >> "${LOGFILE}.${FUNCNAME}" 2>&1 + git checkout master >> "${LOGFILE}.${FUNCNAME}" 2>&1 + git pull >> "${LOGFILE}.${FUNCNAME}" 2>&1 + git checkout master >> "${LOGFILE}.${FUNCNAME}" 2>&1 + for i in $(find ${BASEDIR}/src/ipxe_local/patches/ -type f -iname "*.patch" -printf '%P\n' | sort); + do + patch -Np2 < ${BASEDIR}/src/ipxe_local/patches/${i} >> "${LOGFILE}.${FUNCNAME}" 2>&1 + done + #make everything EMBED="${BASEDIR}/src/ipxe_local/EMBED" >> "${LOGFILE}.${FUNCNAME}" 2>&1 + make bin-i386-efi/ipxe.efi bin-x86_64-efi/ipxe.efi EMBED="${BASEDIR}/src/ipxe_local/EMBED" >> "${LOGFILE}.${FUNCNAME}" 2>&1 + make bin/ipxe.eiso bin/ipxe.usb EMBED="${BASEDIR}/src/ipxe_local/EMBED" >> "${LOGFILE}.${FUNCNAME}" 2>&1 + # Change this to USB-only... + #make all EMBED="${BASEDIR}/src/ipxe_local/EMBED" >> "${LOGFILE}.${FUNCNAME}" 2>&1 + mv -f ${BASEDIR}/src/ipxe/src/bin/ipxe.usb ${ISODIR}/${USBFILENAME} + mv -f ${BASEDIR}/src/ipxe/src/bin/ipxe.eiso ${ISODIR}/${MINIFILENAME} + make clean > /dev/null 2>&1 + git reset --hard > /dev/null 2>&1 + git clean -xdf > /dev/null 2>&1 + git checkout -- HEAD > /dev/null 2>&1 + #git reset --hard HEAD > /dev/null 2>&1 + echo + fi #isohybrid ${ISOFILENAME} cd ${ISODIR} ${RACECAR_CHK}sha256sum ${ISOFILENAME} > ${ISOFILENAME}.sha256 - ${RACECAR_CHK}sha256sum ${MINIFILENAME} > ${MINIFILENAME}.sha256 - ${RACECAR_CHK}sha256sum ${USBFILENAME} > ${USBFILENAME}.sha256 + if [[ "${BUILDMINI}" == "y" ]]; + then + ${RACECAR_CHK}sha256sum ${MINIFILENAME} > ${MINIFILENAME}.sha256 + ${RACECAR_CHK}sha256sum ${USBFILENAME} > ${USBFILENAME}.sha256 + fi cd .. echo "=ISO=" echo "Size: $(ls -lh ${ISODIR}/${ISOFILENAME} | awk '{print $5}')" echo "SHA256: $(awk '{print $1}' ${ISODIR}/${ISOFILENAME}.sha256)" echo "Location: ${ISODIR}/${ISOFILENAME}" - echo "=Mini=" - echo "Size: $(ls -lh ${ISODIR}/${MINIFILENAME} | awk '{print $5}')" - echo "SHA256: $(awk '{print $1}' ${ISODIR}/${MINIFILENAME}.sha256)" - echo "Location: ${ISODIR}/${MINIFILENAME}" - echo "=Mini USB=" - echo "Size: $(ls -lh ${ISODIR}/${USBFILENAME} | awk '{print $5}')" - echo "SHA256: $(awk '{print $1}' ${ISODIR}/${USBFILENAME}.sha256)" - echo "Location: ${ISODIR}/${MINIFILENAME}" + if [[ "${BUILDMINI}" == "y" ]]; + then + echo "=Mini=" + echo "Size: $(ls -lh ${ISODIR}/${MINIFILENAME} | awk '{print $5}')" + echo "SHA256: $(awk '{print $1}' ${ISODIR}/${MINIFILENAME}.sha256)" + echo "Location: ${ISODIR}/${MINIFILENAME}" + echo "=Mini USB=" + echo "Size: $(ls -lh ${ISODIR}/${USBFILENAME} | awk '{print $5}')" + echo "SHA256: $(awk '{print $1}' ${ISODIR}/${USBFILENAME}.sha256)" + echo "Location: ${ISODIR}/${MINIFILENAME}" + fi #rm -rf ${TEMPDIR}/* # are we rsyncing? @@ -329,14 +340,14 @@ EOF echo echo "Now sending to ${RSYNC_HOST} via rsync. This may take a while..." echo "Sending TFTP files..." - rsync -a --info=progress2 ${TFTPDIR} ${RSYNC_HOST}:${RSYNC_DEST}/. + rsync -az --info=progress2 ${TFTPDIR} ${RSYNC_HOST}:${RSYNC_DEST}/. echo "Sending HTTP files..." - rsync -a --info=progress2 ${HTTPDIR} ${RSYNC_HOST}:${RSYNC_DEST}/. + rsync -az --info=progress2 ${HTTPDIR} ${RSYNC_HOST}:${RSYNC_DEST}/. # rsync -a ${TEMPDIR}/boot/${UXNAME}.* ${RSYNC_HOST}:${RSYNC_DEST}/http/. echo "Sending the image files..." - rsync -a --info=progress2 ${ISODIR} ${RSYNC_HOST}:${RSYNC_DEST}/. + rsync -az --info=progress2 ${ISODIR} ${RSYNC_HOST}:${RSYNC_DEST}/. echo "Sending extra files..." - rsync -a --info=progress2 ${ROOTDIR}/extra/packages.* ${RSYNC_HOST}:${RSYNC_DEST}/. - rsync -a --info=progress2 ${ROOTDIR}/VERSION_INFO.txt ${RSYNC_HOST}:${RSYNC_DEST}/. + rsync -az --info=progress2 ${ROOTDIR}/extra/packages.* ${RSYNC_HOST}:${RSYNC_DEST}/. + rsync -az --info=progress2 ${ROOTDIR}/VERSION_INFO.txt ${RSYNC_HOST}:${RSYNC_DEST}/. fi }