* A patch to ec2-bundle-image to make it work properly on read-only

images (in the Nix store).

svn path=/nixpkgs/trunk/; revision=19616
This commit is contained in:
Eelco Dolstra 2010-01-22 16:42:54 +00:00
parent 2ae7ffd707
commit 2feb604243
2 changed files with 41 additions and 0 deletions

View File

@ -10,6 +10,14 @@ stdenv.mkDerivation {
sha256 = "2a7c848abea286234adcbb08938cfad50b844ecdfc7770e781289d9d396a1972";
};
# Amazon EC2 requires that disk images are writable. If they're
# not, the VM immediately terminates with a mysterious
# "Server.InternalError" message. Since disk images generated in
# the Nix store are read-only, they must be made writable in the
# tarball uploaded to Amazon S3. So add a `--mode=0755' flag to the
# tar invocation.
patches = [ ./writable.patch ];
installPhase =
''
ensureDir $out

View File

@ -0,0 +1,33 @@
diff -rc --exclude '*~' ec2-ami-tools-1.3-45758-orig/lib/ec2/amitools/bundle.rb ec2-ami-tools-1.3-45758/lib/ec2/amitools/bundle.rb
*** ec2-ami-tools-1.3-45758-orig/lib/ec2/amitools/bundle.rb 2009-12-02 22:28:44.000000000 +0100
--- ec2-ami-tools-1.3-45758/lib/ec2/amitools/bundle.rb 2010-01-22 16:16:13.000000000 +0100
***************
*** 80,86 ****
# piped via several processes. The tee is used to allow a
# digest of the file to be calculated without having to re-read
# it from disk.
! tar = EC2::Platform::Current::Tar::Command.new.create.dereference.sparse
tar.add(File::basename( image_file ), File::dirname( image_file ))
openssl = EC2::Platform::Current::Constants::Utility::OPENSSL
pipeline = EC2::Platform::Current::Pipeline.new('image-bundle-pipeline', debug)
--- 80,86 ----
# piped via several processes. The tee is used to allow a
# digest of the file to be calculated without having to re-read
# it from disk.
! tar = EC2::Platform::Current::Tar::Command.new.create.dereference.sparse.writable
tar.add(File::basename( image_file ), File::dirname( image_file ))
openssl = EC2::Platform::Current::Constants::Utility::OPENSSL
pipeline = EC2::Platform::Current::Pipeline.new('image-bundle-pipeline', debug)
diff -rc --exclude '*~' ec2-ami-tools-1.3-45758-orig/lib/ec2/platform/linux/tar.rb ec2-ami-tools-1.3-45758/lib/ec2/platform/linux/tar.rb
*** ec2-ami-tools-1.3-45758-orig/lib/ec2/platform/linux/tar.rb 2009-12-02 22:28:44.000000000 +0100
--- ec2-ami-tools-1.3-45758/lib/ec2/platform/linux/tar.rb 2010-01-22 16:16:11.000000000 +0100
***************
*** 31,36 ****
--- 31,37 ----
def update; @options << '-u'; self; end
def sparse; @options << '-S'; self; end
def dereference; @options << '-h'; self; end
+ def writable; @options << '--mode=0755'; self; end
def archive(filename)
filename = '-' if filename.nil?