Updating year in copyright notices to 2015.
[debian-live-build.git] / scripts / build / binary_zsync
bloba38bd60ea292ccbc7680d5c7ed24e0fac8ded2c0
1 #!/bin/sh
3 ## live-build(7) - System Build Scripts
4 ## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
5 ##
6 ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
7 ## This is free software, and you are welcome to redistribute it
8 ## under certain conditions; see COPYING for details.
11 set -e
13 # Including common functions
14 [ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
16 # Setting static variables
17 DESCRIPTION="$(Echo 'build zsync control files')"
18 HELP=""
19 USAGE="${PROGRAM} [--force]"
21 Arguments "${@}"
23 # Reading configuration files
24 Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
25 Set_defaults
27 if [ "${LIVE_IMAGE_TYPE}" != "iso" ] && [ "${LIVE_IMAGE_TYPE}" != "iso-hybrid" ]
28 then
29 exit 0
32 if [ "${LB_ZSYNC}" != "true" ]
33 then
34 exit 0
37 Echo_message "Begin building zsync control files..."
39 # Requiring stage file
40 Require_stagefile .build/config .build/bootstrap
42 # Checking stage file
43 Check_stagefile .build/binary_zsync
45 # Checking lock file
46 Check_lockfile .lock
48 # Creating lock file
49 Create_lockfile .lock
51 # Checking depends
52 Check_package chroot /usr/bin/zsyncmake zsync
54 # Restoring cache
55 Restore_cache cache/packages.binary
57 # Installing depends
58 Install_package
60 case "${LIVE_IMAGE_TYPE}" in
61 iso)
62 _IMAGES="${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.iso"
65 iso-hybrid)
66 _IMAGES="${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.hybrid.iso"
69 hdd)
70 _IMAGES="${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.img"
73 net)
74 _IMAGES="${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.netboot.tar*"
77 tar)
78 _IMAGES="${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.tar*"
80 esac
82 for _IMAGE in ${_IMAGES}
84 if [ -e "${_IMAGE}" ]
85 then
86 case "${LB_BUILD_WITH_CHROOT}" in
87 true)
88 mv ${_IMAGE} chroot
89 Chroot chroot "zsyncmake -C -b 2048 -u ${_IMAGE} ${_IMAGE}"
90 mv chroot/${_IMAGE} chroot/${_IMAGE}.zsync ./
93 false)
94 zsyncmake -C -b 2048 -u "${_IMAGE}" "${_IMAGE}"
96 esac
98 case "${LB_COMPRESSION}" in
99 bzip2)
100 bzip2 ${BZIP2_OPTIONS} ${_IMAGE}.zsync
103 gzip)
104 gzip ${GZIP_OPTIONS} ${_IMAGE}.zsync
107 lzip)
108 lzip ${LZIP_OPTIONS} ${_IMAGE}.zsync
112 xz ${XZ_OPTIONS} ${_IMAGE}.zsync
115 none)
117 esac
119 done
121 #CHECKSUMS
123 # Saving cache
124 Save_cache cache/packages.binary
126 # Removing depends
127 Remove_package
129 # Creating stage file
130 Create_stagefile .build/binary_zsync