From 21815cb707e78ed1899c74c09503cc5b696383e6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 2 Jan 2011 00:36:20 +0100 Subject: Generalizing compression handling and adding support for lzip tarballs. --- scripts/build/lb_binary_net | 21 ++++++++++++--------- scripts/build/lb_binary_tar | 20 ++++++++++++++++++-- scripts/build/lb_config | 14 ++++++++++++-- scripts/build/lb_source_net | 24 ++++++++++++++++++------ scripts/build/lb_source_tar | 28 ++++++++++++++++++++++------ 5 files changed, 82 insertions(+), 25 deletions(-) (limited to 'scripts/build') diff --git a/scripts/build/lb_binary_net b/scripts/build/lb_binary_net index 8ec5950b4..fd2770ebe 100755 --- a/scripts/build/lb_binary_net +++ b/scripts/build/lb_binary_net @@ -29,7 +29,7 @@ then exit 0 fi -if [ "${LB_NET_TARBALL}" = "none" ] +if [ "${LB_NET_TARBALL}" = "false" ] then exit 0 fi @@ -115,12 +115,11 @@ then fi # Remove old binary -rm -f binary-net.tar.bz2 -rm -f binary-net.tar.gz -rm -f binary-net.tar +rm -f binary-net.tar.bz2 binary-net.tar.gz binary-net.tar.lz binary-net.tar # Creating image file ROOT_DIR=$(basename ${LB_NET_ROOT_PATH}) + if [ "${ROOT_DIR}" = "chroot" ] then mv chroot chroot.tmp @@ -135,18 +134,22 @@ mkdir binary.tmp mv ${ROOT_DIR} tftpboot binary.tmp cd binary.tmp -case "${LB_NET_TARBALL}" in +tar cf ../binary-net.tar * + +case "${_COMPRESSION}" in bzip2) - tar cfj ../binary-net-tar.bz2 * + bzip2 ${BZIP2_OPTIONS} ../binary-net.tar ;; gzip) - tar cf ../binary-net.tar * gzip ${GZIP_OPTIONS} ../binary-net.tar ;; - tar) - tar cf ../binary-net.tar * + lzip) + lzip ${LZIP_OPTIONS} ../binary-net.tar + ;; + + none) ;; esac diff --git a/scripts/build/lb_binary_tar b/scripts/build/lb_binary_tar index 3e89bd74f..183b67f89 100755 --- a/scripts/build/lb_binary_tar +++ b/scripts/build/lb_binary_tar @@ -44,10 +44,26 @@ Check_lockfile .lock Create_lockfile .lock # Remove old binary -rm -f binary.tar.gz +rm -f binary.tar.bz2 binary.tar.gz binary.tar.lz binary.tar tar cf binary-tar.tar binary -gzip ${GZIP_OPTIONS} binary-tar.tar + +case "${_COMPRESSION}" in + bzip2) + bzip2 ${BZIP2_OPTIONS} binary-tar.tar + ;; + + gzip) + gzip ${GZIP_OPTIONS} binary-tar.tar + ;; + + lzip) + lzip ${LZIP_OPTIONS} binary-tar.tar + ;; + + none) + ;; +esac # Creating stage file Create_stagefile .stage/binary_tar diff --git a/scripts/build/lb_config b/scripts/build/lb_config index ffddc8039..e9ebd9af6 100755 --- a/scripts/build/lb_config +++ b/scripts/build/lb_config @@ -53,6 +53,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\ \t [--cache-packages true|false]\n\ \t [--cache-stages STAGE|\"STAGES\"]\n\ \t [--checksums md5|sha1|sha256|none]\n\ +\t [--compression bzip2|gzip|lzip|none]\n\ \t [--build-with-chroot true|false]\n\ \t [--chroot-filesystem ext2|ext3|squashfs|plain|jffs2]\n\ \t [--clean\n\ @@ -109,7 +110,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\ \t [--net-cow-mountoptions OPTIONS]\n\ \t [--net-cow-path PATH]\n\ \t [--net-cow-server IP|HOSTNAME]\n\ -\t [--net-tarball bzip2|gzip|tar|none]\n\ +\t [--net-tarball true|false]\n\ \t [-p|--package-lists LIST|\"LISTS\"]\n\ \t [--packages PACKAGE|\"PACKAGES\"]\n\ \t [--quiet]\n\ @@ -144,7 +145,7 @@ Local_arguments () mirror-binary-security:,mirror-binary-volatile:,mirror-binary-backports:,mirror-debian-installer:,archive-areas:,chroot-filesystem:,exposed-root:,virtual-root-size:, gzip-options:,hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:, packages:,package-lists:,tasks:,security:,volatile:,backports:,sysvinit:,binary-filesystem:,binary-images:, - apt-indices:,bootappend-install:,bootappend-live:,bootloader:,checksums:,build-with-chroot:, + apt-indices:,bootappend-install:,bootappend-live:,bootloader:,checksums:,compression:,build-with-chroot:, debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,debian-installer-gui:, encryption:,grub-splash:,hostname:,isohybrid-options:,iso-application:,iso-preparer:,iso-publisher:, iso-volume:,jffs2-eraseblock:,memtest:,net-root-filesystem:,net-root-mountoptions:, @@ -555,6 +556,11 @@ Local_arguments () shift 2 ;; + --compression) + LB_COMPRESSION="${2}" + shift 2 + ;; + --build-with-chroot) LB_BUILD_WITH_CHROOT="${2}" shift 2 @@ -1143,6 +1149,10 @@ LB_BOOTLOADER="${LB_BOOTLOADER}" # (Default: ${LB_CHECKSUMS}) LB_CHECKSUMS="${LB_CHECKSUMS}" +# \$LB_COMPRESSION: set compression +# (Default: ${LB_COMPRESSION}) +LB_COMPRESSION="${LB_COMPRESSION}" + # \${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. diff --git a/scripts/build/lb_source_net b/scripts/build/lb_source_net index aa425c424..319d2a625 100755 --- a/scripts/build/lb_source_net +++ b/scripts/build/lb_source_net @@ -49,14 +49,26 @@ Check_lockfile .lock Create_lockfile .lock # Remove old source -if [ -f source-net.tar.gz ] -then - rm -f source-net.tar.gz -fi +rm -f source-net.tar.bz2 source-net.tar.gz source-net.tar.lz source-net.tar -# Create tarball tar cf source-net.tar source -gzip ${GZIP_OPTIONS} source-net.tar + +case "${_COMPRESSION}" in + bzip2) + bzip2 ${BZIP2_OPTIONS} source-net.tar + ;; + + gzip) + gzip ${GZIP_OPTIONS} source-net.tar + ;; + + lzip) + lzip ${LZIP_OPTIONS} source-net.tar + ;; + + none) + ;; +esac # Creating stage file Create_stagefile .stage/source_net diff --git a/scripts/build/lb_source_tar b/scripts/build/lb_source_tar index 4d45e2c21..56c5ec7cb 100755 --- a/scripts/build/lb_source_tar +++ b/scripts/build/lb_source_tar @@ -50,15 +50,31 @@ Check_lockfile .lock Create_lockfile .lock # Remove old source -rm -f source.debian.tar.gz -rm -f source.debian-live.tar.gz +rm -f source.debian.tar.bz2 source.debian.tar.gz source.debian.tar.lz source.debian.tar +rm -f source.debian-live.tar.bz2 source.debian-live.tar.gz source.debian-live.tar.lz source.debian-live.tar -# Create tarballs tar cf source.debian.tar source/debian -gzip ${GZIP_OPTIONS} source.debian.tar - tar cf source.debian-live.tar source/debian-live -gzip ${GZIP_OPTIONS} source.debian-live.tar + +case "${_COMPRESSION}" in + bzip2) + bzip2 ${BZIP2_OPTIONS} source.debian.tar + bzip2 ${BZIP2_OPTIONS} source.debian-live.tar + ;; + + gzip) + gzip ${GZIP_OPTIONS} source.debian.tar + gzip ${GZIP_OPTIONS} source.debian-live.tar + ;; + + lzip) + lzip ${LZIP_OPTIONS} source.debian.tar + lzip ${LZIP_OPTIONS} source.debian-live.tar + ;; + + none) + ;; +esac # Creating stage file Create_stagefile .stage/source_tar -- cgit v1.2.3