Adding support for zsync control files generation, thanks to Hector Oron <hector.oron@gmail.com> for the idea and prototype.

This commit is contained in:
Daniel Baumann 2012-07-18 19:09:16 +02:00
parent 310be05bff
commit 75ca21eaec
4 changed files with 137 additions and 1 deletions

View File

@ -943,6 +943,9 @@ Set_defaults ()
;;
esac
# Setting zsync
LB_ZSYNC="${LB_ZSYNC:-true}"
# Setting chroot option
LB_BUILD_WITH_CHROOT="${LB_BUILD_WITH_CHROOT:-true}"

View File

@ -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

121
scripts/build/lb_binary_zsync Executable file
View File

@ -0,0 +1,121 @@
#!/bin/sh
## live-build(7) - System Build Scripts
## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
##
## 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

View File

@ -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.