summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorColin Watson <cjwatson@canonical.com>2011-06-13 20:38:44 +0200
committerDaniel Baumann <daniel@debian.org>2011-06-13 20:38:44 +0200
commit5d228a8e3ecc60bc481e8ad17d1687cc706de649 (patch)
treeb106ca42d4764c2abe33d7d6ef7d6fa1fab1f76f /scripts
parentd5510c99100303d73c00dd59907aeda83594d3b5 (diff)
downloadvyos-live-build-5d228a8e3ecc60bc481e8ad17d1687cc706de649.tar.gz
vyos-live-build-5d228a8e3ecc60bc481e8ad17d1687cc706de649.zip
Add --initramfs-compression option (Closes: #627677).
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build/lb_chroot_hacks25
-rwxr-xr-xscripts/build/lb_config12
2 files changed, 36 insertions, 1 deletions
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}"