Add --initramfs-compression option (Closes: #627677).

This commit is contained in:
Colin Watson 2011-06-13 20:38:44 +02:00 committed by Daniel Baumann
parent d5510c9910
commit 5d228a8e3e
4 changed files with 44 additions and 1 deletions

View File

@ -84,6 +84,8 @@ Set_defaults ()
LZIP_OPTIONS="${LZIP_OPTIONS:---best}"
LZMA_OPTIONS="${LZMA_OPTIONS:---best}"
# Setting apt recommends
case "${LB_MODE}" in
emdebian|progress)
@ -153,6 +155,8 @@ Set_defaults ()
;;
esac
LB_INITRAMFS_COMPRESSION="${LB_INITRAMFS_COMPRESSION:-gzip}"
# Setting initsystem
case "${LB_MODE}" in
ubuntu)

View File

@ -106,6 +106,8 @@
[\fB\-\-includes\fR \fIPATH\fR]
.br
[\fB\-\-initramfs\fR auto|none|live\-boot|casper]
.br
[\fB\-\-initramfs\-compression\fR bzip2|gzip|lzma]
.br
[\fB\-\-initsystem\fR sysvinit|runit|systemd|upstart|none]
.br
@ -349,6 +351,8 @@ sets the hostname of the live system.
sets the path to the includes that live\-build is going to use, e.g. additional minimal documentation that you want to have on all live systems. By default, this is set to /usr/share/live/build/includes/. Choose none to disable inclusion of documentation.
.IP "\fB\-\-initramfs\fR auto|none|live\-boot|casper" 4
sets the name of package that contains the live system specific initramfs modification. By default, auto is used, which means that at build time of the image rather than on configuration time, the value will be expanded to casper when building ubuntu systems, to live\-boot for all other systems. Using 'none' is useful if the resulting system image should not be a live image (experimental).
.IP "\fB\-\-initramfs\-compression\fR bzip2|gzip|lzma]
defines the compression program to be used to compress the initramfs. Defaults to gzip.
.IP "\fB\-\-interactive\fR shell" 4
defines if after the chroot stage and before the beginning of the binary stage, a interactive shell login should be spawned in the chroot in order to allow you to do manual customizations. Once you close the shell with logout or exit, the build will continue as usual. Note that it's strongly discouraged to use this for anything else than testing. Modifications that should be present in all builds of a live system should be properly made through hooks. Everything else destroys the beauty of being able to completely automatise the build process and making it non interactive. By default, this is of course false.
.IP "\fB\-\-isohybrid\-options\fR \fIOPTION\fR|""\fIOPTIONS\fR""" 4

View File

@ -183,6 +183,31 @@ esac
Chroot chroot "${UPDATE_INITRAMFS_OPTIONS} update-initramfs -k all -t -u"
# We probably ought to use COMPRESS= in a temporary file in
# /etc/initramfs-tools/conf.d/ instead, but it's hard to pass options that
# way.
case "${LB_INITRAMFS_COMPRESSION}" in
gzip)
;;
bzip2)
for INITRAMFS in $(find chroot/boot -name 'initrd*'); do
zcat "${INITRAMFS}" | bzip2 -c ${BZIP2_OPTIONS} > "${INITRAMFS}.new"
mv "${INITRAMFS}.new" "${INITRAMFS}"
done
;;
lzma)
# We probably ought to use COMPRESS= in a temporary file in
# /etc/initramfs-tools/conf.d/ instead, but it's hard to
# pass options that way.
for INITRAMFS in $(find chroot/boot -name 'initrd*'); do
zcat "${INITRAMFS}" | lzma -c ${LZMA_OPTIONS} > "${INITRAMFS}.new"
mv "${INITRAMFS}.new" "${INITRAMFS}"
done
;;
esac
# Ensure readable permissions on initramfs. loop-aes-utils sets umask to
# protect GPG keys, which live-build does not support.
# Note: Use find rather than chmod on the wildcard, one never knows what

View File

@ -78,6 +78,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [--ignore-system-defaults]\n\
\t [--includes PATH|none]\n\
\t [--initramfs auto|none|live-boot|casper]\n\
\t [--initramfs-compression bzip2|gzip|lzma]\n\
\t [--initsystem sysvinit|runit|systemd|upstart|none]\n\
\t [--interactive shell]\n\
\t [--isohybrid-options OPTION|\"OPTIONS\"]\n\
@ -150,7 +151,7 @@ Local_arguments ()
LONG_OPTIONS="apt:,apt-ftp-proxy:,apt-http-proxy:,apt-options:,aptitute-options:,
apt-pipeline:,apt-recommends:,apt-secure:,bootstrap:,cache:,cache-indices:,cache-packages:,
cache-stages:,debconf-frontend:,debconf-nowarnings:,debconf-priority:,dump,
initramfs:,initsystem:,fdisk:,losetup:,mode:,repositories:,root-command:,use-fakeroot:,tasksel:,includes:,
initramfs:,initramfs-compression:,initsystem:,fdisk:,losetup:,mode:,repositories:,root-command:,use-fakeroot:,tasksel:,includes:,
templates:,architectures:,bootstrap-flavour:,bootstrap-keyring:,clean,
distribution:,parent-distribution:,parent-debian-installer-distribution:,parent-mirror-bootstrap:,parent-mirror-chroot:,parent-mirror-chroot-security:,parent-mirror-chroot-volatile:,parent-mirror-chroot-backports:,parent-mirror-binary:,
parent-mirror-binary-security:,parent-mirror-binary-volatile:,parent-mirror-binary-backports:,parent-mirror-debian-installer:,
@ -314,6 +315,11 @@ Local_arguments ()
shift 2
;;
--initramfs-compression)
LB_INITRAMFS_COMPRESSION="${2}"
shift 2
;;
--initsystem)
LB_INITSYSTEM="${2}"
shift 2
@ -939,6 +945,10 @@ LB_DEBCONF_PRIORITY="${LB_DEBCONF_PRIORITY}"
# (Default: ${LB_INITRAMFS})
LB_INITRAMFS="${LB_INITRAMFS}"
# \$LB_INITRAMFS_COMPRESSION: set initramfs compression
# (Default: ${LB_INITRAMFS_COMPRESSION})
LB_INITRAMFS_COMPRESSION="${LB_INITRAMFS_COMPRESSION}"
# \$LB_INITSYSTEM: set init system
# (Default: ${LB_INITSYSTEM})
LB_INITSYSTEM="${LB_INITSYSTEM}"