Allowing to overwrite default gzip options through config switch or option.

This commit is contained in:
Daniel Baumann 2009-09-11 09:39:13 +02:00
parent a8e71bdb03
commit ec83843d6e
8 changed files with 32 additions and 36 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -89,6 +89,8 @@ lh_config \- create configuration for live\-helper
[\fB\-\-genisoimage\fR genisomage|mkisofs]
.br
[\fB\-\-grub\-splash\fR \fIFILE\fR]
.br
[\fB\-\-gzip\-options\fR \fIOPTION\fR|"\fIOPTIONS\fR"]
.br
[\fB\-\-hooks\fR \fIFILE\fR]
.br
@ -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