diff options
author | Daniel Baumann <daniel@debian.org> | 2009-09-11 09:39:13 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2011-03-09 19:09:46 +0100 |
commit | ec83843d6e5e7b1ca8473cf7f9b05fdfe10d220f (patch) | |
tree | 698870045e2c5a468166df30694ec67b6522462e | |
parent | a8e71bdb038388640eeb2276f6697546aded3505 (diff) | |
download | vyos-live-build-ec83843d6e5e7b1ca8473cf7f9b05fdfe10d220f.tar.gz vyos-live-build-ec83843d6e5e7b1ca8473cf7f9b05fdfe10d220f.zip |
Allowing to overwrite default gzip options through config switch or option.
-rwxr-xr-x | functions/defaults.sh | 10 | ||||
-rwxr-xr-x | helpers/lh_binary_net | 9 | ||||
-rwxr-xr-x | helpers/lh_binary_tar | 9 | ||||
-rwxr-xr-x | helpers/lh_config | 9 | ||||
-rwxr-xr-x | helpers/lh_source_debian-live | 9 | ||||
-rwxr-xr-x | helpers/lh_source_net | 9 | ||||
-rwxr-xr-x | helpers/lh_source_tar | 9 | ||||
-rw-r--r-- | manpages/lh_config.en.1 | 4 |
8 files changed, 32 insertions, 36 deletions
diff --git a/functions/defaults.sh b/functions/defaults.sh index cbff1f93d..470885759 100755 --- a/functions/defaults.sh +++ b/functions/defaults.sh @@ -74,6 +74,16 @@ Set_defaults () APT_OPTIONS="${APT_OPTIONS:---yes}" APTITUDE_OPTIONS="${APTITUDE_OPTIONS:---assume-yes}" + GZIP_OPTIONS="${GZIP_OPTIONS:---best}" + + if gzip --help | grep -qs "\-\-rsyncable" && \ + ! echo ${GZIP_OPTIONS} | grep -q rsyncable + then + GZIP_OPTIONS="${GZIP_OPTIONS} --rsyncable" + else + GZIP_OPTIONS="$(echo ${GZIP_OPTIONS} | sed -e 's|--rsyncable||')" + fi + # Setting apt recommends case "${LH_MODE}" in debian|debian-release|ubuntu) diff --git a/helpers/lh_binary_net b/helpers/lh_binary_net index 3e962c49e..15f6388ca 100755 --- a/helpers/lh_binary_net +++ b/helpers/lh_binary_net @@ -140,13 +140,8 @@ case "${LH_NET_TARBALL}" in ;; gzip) - if gzip --help | grep -qs "\-\-rsyncable" - then - tar cf ../binary-net.tar * - gzip --rsyncable --best ../binary-net.tar - else - tar cfz ../binary-net.tar.gz * - fi + tar cf ../binary-net.tar * + gzip ${GZIP_OPTIONS} ../binary-net.tar ;; tar) diff --git a/helpers/lh_binary_tar b/helpers/lh_binary_tar index 110e5cdf7..7c769d594 100755 --- a/helpers/lh_binary_tar +++ b/helpers/lh_binary_tar @@ -45,13 +45,8 @@ Create_lockfile .lock # Remove old binary rm -f binary.tar.gz -if gzip --help | grep -qs '\-\-rsyncable' -then - tar cf binary-tar.tar binary - gzip --rsyncable --best binary-tar.tar -else - tar cfz binary-tar.tar.gz binary -fi +tar cf binary-tar.tar binary +gzip ${GZIP_OPTIONS} binary-tar.tar # Creating stage file Create_stagefile .stage/binary_tar diff --git a/helpers/lh_config b/helpers/lh_config index 57a8b9e82..03297be07 100755 --- a/helpers/lh_config +++ b/helpers/lh_config @@ -71,6 +71,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\ \t [--force]\n\ \t [--genisoimage genisomage|mkisofs]\n\ \t [--grub-splash FILE]\n\ +\t [--gzip-options OPTION|\"OPTIONS\"]\n\ \t [--hooks FILE]\n\ \t [--hostname NAME]\n\ \t [--ignore-system-defaults]\n\ @@ -136,7 +137,7 @@ Local_arguments () templates:,architecture:,bootstrap-config:,bootstrap-flavour:,bootstrap-keyring:,clean, distribution:,mirror-bootstrap:,mirror-chroot:,mirror-chroot-security:,mirror-binary:, mirror-binary-security:,categories:,chroot-filesystem:,union-filesystem:,exposed-root:,virtual-root-size:, - hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:, + gzip-options:,hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:, packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,binary-filesystem:,binary-images:, binary-indices:,bootappend-install:,bootappend-live:,bootloader:,checksums:,chroot-build:, debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,debian-installer-gui:, @@ -429,6 +430,11 @@ Local_arguments () shift 2 ;; + --gzip-options) + GZIP_OPTIONS="${2}" + shift 2 + ;; + --hooks) LH_HOOKS="${2}" shift 2 @@ -904,6 +910,7 @@ _QUIET="${_QUIET}" # Internal stuff (FIXME) APT_OPTIONS="${APT_OPTIONS}" APTITUDE_OPTIONS="${APTITUDE_OPTIONS}" +GZIP_OPTIONS="${GZIP_OPTIONS}" EOF # Creating lh_bootstrap_* configuration diff --git a/helpers/lh_source_debian-live b/helpers/lh_source_debian-live index 03b39925b..809794c00 100755 --- a/helpers/lh_source_debian-live +++ b/helpers/lh_source_debian-live @@ -62,13 +62,8 @@ cd source SUFFIX="$(date +%Y%m%d.%s)" -if gzip --help | grep -qs '\-\-rsyncable' -then - tar cf debian-live-config_${SUFFIX}.tar debian-live - gzip --rsyncable --best debian-live-config_${SUFFIX}.tar -else - tar cfz debian-live-config_${SUFFIX}.tar.gz debian-live -fi +tar cf debian-live-config_${SUFFIX}.tar debian-live +gzip ${GZIP_OPTIONS} debian-live-config_${SUFFIX}.tar cd "${OLDPWD}" diff --git a/helpers/lh_source_net b/helpers/lh_source_net index 8ffeb3c83..eb32ed9ad 100755 --- a/helpers/lh_source_net +++ b/helpers/lh_source_net @@ -54,13 +54,8 @@ then fi # Create tarball -if gzip --help | grep -qs '\-\-rsyncable' -then - tar cf source-net.tar source - gzip --rsyncable --best source-net.tar -else - tar cfz source-net.tar.gz source -fi +tar cf source-net.tar source +gzip ${GZIP_OPTIONS} source-net.tar # Creating stage file Create_stagefile .stage/source_net diff --git a/helpers/lh_source_tar b/helpers/lh_source_tar index 64c191c01..cbf3f839d 100755 --- a/helpers/lh_source_tar +++ b/helpers/lh_source_tar @@ -55,13 +55,8 @@ then fi # Create tarball -if gzip --help | grep -qs '\-\-rsyncable' -then - tar cf source.tar source - gzip --rsyncable --best source.tar -else - tar cfz source.tar.gz source -fi +tar cf source.tar source +gzip ${GZIP_OPTIONS} source.tar # Creating stage file Create_stagefile .stage/source_tar diff --git a/manpages/lh_config.en.1 b/manpages/lh_config.en.1 index ede1a29f7..7248a2ecd 100644 --- a/manpages/lh_config.en.1 +++ b/manpages/lh_config.en.1 @@ -90,6 +90,8 @@ lh_config \- create configuration for live\-helper .br [\fB\-\-grub\-splash\fR \fIFILE\fR] .br + [\fB\-\-gzip\-options\fR \fIOPTION\fR|"\fIOPTIONS\fR"] +.br [\fB\-\-hooks\fR \fIFILE\fR] .br [\fB\-\-hostname\fR \fINAME\fR] @@ -292,6 +294,8 @@ sets the filename of the fdisk binary from the host system that should be used. sets the filename of the genisoimage binary from the host system that should be used. This is autodetected and does generally not need any customization. .IP "\fB\-\-grub\-splash\fR \fIFILE\fR" 4 defines the name of an optional to be included splash screen graphic for the grub bootloader. +.IP "\fB\-\-gzip\-options\fR \fIOPTION\fR|"\fIOPTIONS\fR"" 4 +defines the default options that will be appended to (almost) every gzip call during the building of the image. By default, this is set to \-\-best to use highest (but slowest) compression. Dynamically, if the host system supports it, also \-\-rsyncable is added. .IP "\fB\-\-hooks\fR \fIFILE\fR" 4 defines which hooks available in /usr/share/live-helper/examples/hooks should be activated. Normally, there are no hooks executed. Make sure you know and understood the hook before you enable it. .IP "\fB\-\-hostname\fR \fINAME\fR" 4 |