From e7494da962a5882aecfd654117a0748a67936a37 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 5 Jun 2008 13:42:18 +0000 Subject: [PATCH] * Allow compression of ISO images. svn path=/nixos/trunk/; revision=11987 --- configuration/rescue-cd.nix | 3 +++ helpers/make-iso9660-image.nix | 5 ++++- helpers/make-iso9660-image.sh | 11 ++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/configuration/rescue-cd.nix b/configuration/rescue-cd.nix index 05420975d5fc..a429304071d9 100644 --- a/configuration/rescue-cd.nix +++ b/configuration/rescue-cd.nix @@ -3,6 +3,7 @@ if builtins.pathExists ../relname then builtins.readFile ../relname else "nixos-${builtins.readFile ../VERSION}" +, compressImage ? false }: rec { @@ -304,6 +305,8 @@ rec { bootable = true; bootImage = "boot/grub/stage2_eltorito"; + + inherit compressImage; }; diff --git a/helpers/make-iso9660-image.nix b/helpers/make-iso9660-image.nix index 5e0bca4c630c..076820bb5c26 100644 --- a/helpers/make-iso9660-image.nix +++ b/helpers/make-iso9660-image.nix @@ -25,6 +25,9 @@ # The path (in the ISO file system) of the boot image. , bootImage ? "" +, # Whether to compress the resulting ISO image with bzip2. + compressImage ? false + }: assert bootable -> bootImage != ""; @@ -33,7 +36,7 @@ stdenv.mkDerivation { name = "iso9660-image"; builder = ./make-iso9660-image.sh; buildInputs = [perl cdrkit]; - inherit isoName bootable bootImage; + inherit isoName bootable bootImage compressImage; # !!! should use XML. sources = map (x: x.source) contents; diff --git a/helpers/make-iso9660-image.sh b/helpers/make-iso9660-image.sh index 5ad8cb475de2..9330002f0b4d 100644 --- a/helpers/make-iso9660-image.sh +++ b/helpers/make-iso9660-image.sh @@ -59,10 +59,15 @@ done cat pathlist | sed -e 's/=\(.*\)=\(.*\)=/\\=\1=\2\\=/' | tee pathlist.safer -# !!! -f is a quick hack. + ensureDir $out/iso -genisoimage -r -J -o $out/iso/$isoName $bootFlags \ - -hide-rr-moved -graft-points -path-list pathlist.safer +genCommand="genisoimage -r -J $bootFlags -hide-rr-moved -graft-points -path-list pathlist.safer" +if test -z "$compressImage"; then + $genCommand -o $out/iso/$isoName +else + $genCommand | bzip2 > $out/iso/$isoName.bz2 +fi + ensureDir $out/nix-support echo $system > $out/nix-support/system