build-ubuntu-ami 1.0.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,11 +4,18 @@
4
4
  # Log output to the console, syslog, and /var/log/user-data.log
5
5
  exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
6
6
 
7
- # Download and mount the clean image
7
+ # Download and extract the clean image
8
8
  image=/mnt/<%= image_name %>.img
9
- imagedir=/mnt/<%= image_name %>-cloudimg-<%= arch %>
10
- wget -qO- <%= image_url %> |
11
- tar xzf - -C /mnt
9
+ imagedir=/mnt/<%= image_name %>
10
+ wget -qO- <%= image_url %> | tar xzf - -C /mnt
11
+
12
+ # The image is 1.4GB by default
13
+ # Add 4GB for good measure
14
+ dd if=/dev/zero bs=1024k count=4096 >> $image
15
+ e2fsck -p -f $image
16
+ resize2fs $image
17
+
18
+ # Mount the image
12
19
  mkdir -p $imagedir
13
20
  mount -o loop $image $imagedir
14
21
 
@@ -70,7 +77,7 @@ mount $dev $ebsimagedir
70
77
  # Copy file system from temporary rootdir to EBS volume
71
78
  tar -cSf - -C $imagedir . | sudo tar xvf - -C $ebsimagedir
72
79
 
73
- # Unmount
80
+ # Unmount
74
81
  umount $imagedir
75
82
  umount $ebsimagedir
76
83
 
@@ -138,7 +138,7 @@ class BuildUbuntuAmi
138
138
  puts "waiting for user_data to complete and server to shut down..."
139
139
  puts "Follow along by running:"
140
140
  puts " ssh -l #{server.username} #{server.dns_name} 'tail -f /var/log/user-data.log'"
141
- server.wait_for { state == 'stopped' }
141
+ server.wait_for(60*60*24*7) { state == 'stopped' }
142
142
 
143
143
  puts "Detaching volume"
144
144
  volume.server = nil
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-ubuntu-ami
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-29 00:00:00.000000000 Z
12
+ date: 2013-01-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog