diff options
author | Colin Watson <cjwatson@canonical.com> | 2011-06-13 20:38:44 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2011-06-13 20:38:44 +0200 |
commit | 5d228a8e3ecc60bc481e8ad17d1687cc706de649 (patch) | |
tree | b106ca42d4764c2abe33d7d6ef7d6fa1fab1f76f | |
parent | d5510c99100303d73c00dd59907aeda83594d3b5 (diff) | |
download | vyos-live-build-5d228a8e3ecc60bc481e8ad17d1687cc706de649.tar.gz vyos-live-build-5d228a8e3ecc60bc481e8ad17d1687cc706de649.zip |
Add --initramfs-compression option (Closes: #627677).
-rwxr-xr-x | functions/defaults.sh | 4 | ||||
-rw-r--r-- | manpages/en/lb_config.1 | 4 | ||||
-rwxr-xr-x | scripts/build/lb_chroot_hacks | 25 | ||||
-rwxr-xr-x | scripts/build/lb_config | 12 |
4 files changed, 44 insertions, 1 deletions
diff --git a/functions/defaults.sh b/functions/defaults.sh index 3bb9adc33..4379704ff 100755 --- a/functions/defaults.sh +++ b/functions/defaults.sh @@ -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) diff --git a/manpages/en/lb_config.1 b/manpages/en/lb_config.1 index ac5fc0ba2..d3cc96275 100644 --- a/manpages/en/lb_config.1 +++ b/manpages/en/lb_config.1 @@ -107,6 +107,8 @@ .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 [\fB\-\-interactive\fR shell] @@ -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 diff --git a/scripts/build/lb_chroot_hacks b/scripts/build/lb_chroot_hacks index 33c24d679..2ad85d3b3 100755 --- a/scripts/build/lb_chroot_hacks +++ b/scripts/build/lb_chroot_hacks @@ -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 diff --git a/scripts/build/lb_config b/scripts/build/lb_config index c9c60bebd..d8813b523 100755 --- a/scripts/build/lb_config +++ b/scripts/build/lb_config @@ -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}" |