summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2010-01-22 16:42:54 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2010-01-22 16:42:54 +0000
commit2feb60424384c917fde753647d8aed39d3d4e7ef (patch)
tree0fa718f5260929d38581272765bbf276b8032c85 /pkgs
parent2ae7ffd707585c9f60c3e5c761fe60238a07b09d (diff)
downloadnixpkgs-2feb60424384c917fde753647d8aed39d3d4e7ef.tar
nixpkgs-2feb60424384c917fde753647d8aed39d3d4e7ef.tar.gz
nixpkgs-2feb60424384c917fde753647d8aed39d3d4e7ef.tar.bz2
nixpkgs-2feb60424384c917fde753647d8aed39d3d4e7ef.tar.lz
nixpkgs-2feb60424384c917fde753647d8aed39d3d4e7ef.tar.xz
nixpkgs-2feb60424384c917fde753647d8aed39d3d4e7ef.tar.zst
nixpkgs-2feb60424384c917fde753647d8aed39d3d4e7ef.zip
* 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
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/tools/virtualization/amazon-ec2-ami-tools/default.nix8
-rw-r--r--pkgs/tools/virtualization/amazon-ec2-ami-tools/writable.patch33
2 files changed, 41 insertions, 0 deletions
diff --git a/pkgs/tools/virtualization/amazon-ec2-ami-tools/default.nix b/pkgs/tools/virtualization/amazon-ec2-ami-tools/default.nix
index 58a833a33ea..e5114ddaed6 100644
--- a/pkgs/tools/virtualization/amazon-ec2-ami-tools/default.nix
+++ b/pkgs/tools/virtualization/amazon-ec2-ami-tools/default.nix
@@ -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
diff --git a/pkgs/tools/virtualization/amazon-ec2-ami-tools/writable.patch b/pkgs/tools/virtualization/amazon-ec2-ami-tools/writable.patch
new file mode 100644
index 00000000000..c8d0597b479
--- /dev/null
+++ b/pkgs/tools/virtualization/amazon-ec2-ami-tools/writable.patch
@@ -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?