From 75ca21eaec4b6f80997e6cce81e8b9d54bd58e7f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 18 Jul 2012 19:09:16 +0200 Subject: Adding support for zsync control files generation, thanks to Hector Oron for the idea and prototype. --- scripts/build/lb_binary | 2 + scripts/build/lb_binary_zsync | 121 ++++++++++++++++++++++++++++++++++++++++++ scripts/build/lb_config | 12 ++++- 3 files changed, 134 insertions(+), 1 deletion(-) create mode 100755 scripts/build/lb_binary_zsync (limited to 'scripts') diff --git a/scripts/build/lb_binary b/scripts/build/lb_binary index 564b056c6..0ffb7bf88 100755 --- a/scripts/build/lb_binary +++ b/scripts/build/lb_binary @@ -89,6 +89,8 @@ lb binary_tar ${*} lb binary_hdd ${*} lb binary_virtual-hdd ${*} +lb binary_zsync ${*} + if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] then # Deconfiguring chroot diff --git a/scripts/build/lb_binary_zsync b/scripts/build/lb_binary_zsync new file mode 100755 index 000000000..21cc01784 --- /dev/null +++ b/scripts/build/lb_binary_zsync @@ -0,0 +1,121 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +## This is free software, and you are welcome to redistribute it +## under certain conditions; see COPYING for details. + + +set -e + +# Including common functions +. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build zsync control files')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LB_ZSYNC}" != "true" ] +then + exit 0 +fi + +Echo_message "Begin building zsync control files..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_zsync + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Checking depends +Check_package chroot/usr/bin/zsyncmake zsync + +# Restoring cache +Restore_cache cache/packages.binary + +# Installing depends +Install_package + +case "${LB_BINARY_IMAGES}" in + iso) + _IMAGES="binary.iso" + ;; + + iso-hybrid) + _IMAGES="binary.hybrid.iso" + ;; + + hdd) + _IMAGES="binary.img" + ;; + + net) + _IMAGES="binary.netboot.tar*" + ;; + + tar) + _IMAGES="binary.tar*" + ;; +esac + +for _IMAGE in ${_IMAGES} +do + if [ -e "${_IMAGE}" ] + then + case "${LB_BUILD_WITH_CHROOT}" in + true) + mv ${_IMAGE} chroot + Chroot chroot "zsyncmake -C -b 2048 -u ${_IMAGE} ${_IMAGE}" + mv chroot/${_IMAGE} chroot/${_IMAGE}.zsync ./ + ;; + + false) + zsyncmake -C -b 2048 -u "${_IMAGE}" "${_IMAGE}" + ;; + esac + + case "${LB_COMPRESSION}" in + bzip2) + bzip2 ${BZIP2_OPTIONS} ${_IMAGE}.zsync + ;; + + gzip) + gzip ${GZIP_OPTIONS} ${_IMAGE}.zsync + ;; + + lzip) + lzip ${LZIP_OPTIONS} ${_IMAGE}.zsync + ;; + + none) + ;; + esac + fi +done + +#CHECKSUMS + +# Saving cache +Save_cache cache/packages.binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .build/binary_zsync diff --git a/scripts/build/lb_config b/scripts/build/lb_config index 41d427b66..97719a628 100755 --- a/scripts/build/lb_config +++ b/scripts/build/lb_config @@ -55,6 +55,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\ \t [--cache-stages STAGE|\"STAGES\"]\n\ \t [--checksums md5|sha1|sha256|none]\n\ \t [--compression bzip2|gzip|lzip|none]\n\ +\t [--zsync true|false]\n\ \t [--build-with-chroot true|false]\n\ \t [--chroot-filesystem ext2|ext3|ext4|squashfs|jffs2|none]\n\ \t [--clean\n\ @@ -167,7 +168,7 @@ Local_arguments () archives:,archive-areas:,parent-archive-areas:,chroot-filesystem:,exposed-root:, gzip-options:,hooks:,interactive:,keyring-packages:,linux-flavours:,linux-packages:, package-lists:,security:,volatile:,backports:,binary-filesystem:,binary-images:, - apt-indices:,bootappend-install:,bootappend-live:,bootappend-failsafe:,bootloader:,checksums:,compression:,build-with-chroot:, + apt-indices:,bootappend-install:,bootappend-live:,bootappend-failsafe:,bootloader:,checksums:,compression:,zsync:,build-with-chroot:, debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,debian-installer-gui:, grub-splash:,isohybrid-options:,hdd-label:,hdd-size:,iso-application:,iso-preparer:,iso-publisher:, iso-volume:,jffs2-eraseblock:,memtest:,net-root-filesystem:,net-root-mountoptions:, @@ -631,6 +632,11 @@ Local_arguments () shift 2 ;; + --zsync) + LB_ZSYNC="${2}" + shift 2 + ;; + --build-with-chroot) LB_BUILD_WITH_CHROOT="${2}" shift 2 @@ -1318,6 +1324,10 @@ LB_CHECKSUMS="${LB_CHECKSUMS}" # (Default: ${LB_COMPRESSION}) LB_COMPRESSION="${LB_COMPRESSION}" +# \$LB_ZSYNC: set zsync +# (Default: ${LB_ZSYNC}) +LB_ZSYNC="${LB_ZSYNC}" + # \${LB_BUILD_WITH_CHROOT: control if we build binary images chrooted # (Default: ${LB_BUILD_WITH_CHROOT}) # DO NEVER, *NEVER*, *N*E*V*E*R* SET THIS OPTION to false. -- cgit v1.2.3