boxgrinder-ubuntu-plugin 0.1.2 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog ADDED
@@ -0,0 +1,2 @@
1
+ Tue Nov 15 10:53:00 CET 2011 - 0.2
2
+ * Initial support for 'post:' in appliance definition file
data/README.md CHANGED
@@ -12,7 +12,7 @@ Boxgrinder can be easily installed in Ubuntu via rubygems.
12
12
 
13
13
  Install libguestfs deps first:
14
14
 
15
- $ sudo apt-get install libsys-virt-perl ubuntu-vm-builder libvirt-bin \
15
+ $ sudo apt-get install grub-pc lvm2 watershed dosfstools libsys-virt-perl ubuntu-vm-builder libvirt-bin \
16
16
  rubygems libvirt-dev libxslt-dev libxml2-dev gcc make \
17
17
  ruby-dev qemu-kvm augeas-lenses btrfs-tools cryptsetup \
18
18
  diff jfsutils libaugeas0 libhivex0 libntfs10 ntfsprogs \
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake'
6
6
  require 'jeweler'
7
7
  Jeweler::Tasks.new do |gem|
8
8
  # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
9
- gem.version = '0.1.2'
9
+ gem.version = '0.2'
10
10
  gem.name = "boxgrinder-ubuntu-plugin"
11
11
  gem.homepage = "http://github.com/rubiojr/boxgrinder-ubuntu-plugin"
12
12
  gem.license = "MIT"
@@ -36,7 +36,6 @@ module BoxGrinder
36
36
  end
37
37
 
38
38
  def create_partitions_file
39
- pcount = 1
40
39
  plist = File.open(@dir.tmp + "/partitions", 'w') do |pl|
41
40
  @log.debug "Creting partition map #{@dir.tmp + '/partitions'}"
42
41
  @appliance_config.hardware.partitions.each do |mpoint, values|
@@ -46,6 +45,25 @@ module BoxGrinder
46
45
  @dir.tmp + "/partitions"
47
46
  end
48
47
 
48
+ def create_commands_file
49
+ commands_file = @dir.tmp + "/commands"
50
+ unless @appliance_config.post['base'].nil?
51
+ clist = File.open(commands_file, 'w') do |cl|
52
+ cl.puts "#!/bin/sh"
53
+ @log.info "Executing post operations after build..."
54
+ @appliance_config.post['base'].each do |cmd|
55
+ cl.puts "chroot $1 #{cmd}"
56
+ end
57
+ @log.debug "Post commands from appliance definition file executed."
58
+ end
59
+ File.chmod(0744, commands_file)
60
+ return commands_file
61
+ else
62
+ @log.debug "No commands specified, skipping."
63
+ return nil
64
+ end
65
+ end
66
+
49
67
  def execute_vmbuilder
50
68
  arch = @appliance_config.hardware.arch
51
69
  arch = 'amd64' if arch == 'x86_64'
@@ -56,6 +74,10 @@ module BoxGrinder
56
74
  end
57
75
  extra_args << "--part #{create_partitions_file}"
58
76
  extra_args << "--rootpass #{@appliance_config.os.password}"
77
+ commands_file = create_commands_file
78
+ if commands_file
79
+ extra_args << "--exec=#{commands_file}"
80
+ end
59
81
  if ENV["BOXGRINDER_DEBUG_VMBUILDER"]
60
82
  extra_args << "--debug"
61
83
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxgrinder-ubuntu-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: '0.2'
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: 2011-11-14 00:00:00.000000000 Z
12
+ date: 2011-11-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Ubuntu OS boxgrinder plugin
15
15
  email: rubiojr@frameos.org
@@ -20,6 +20,7 @@ extra_rdoc_files:
20
20
  - README.md
21
21
  files:
22
22
  - .document
23
+ - Changelog
23
24
  - LICENSE.txt
24
25
  - README.md
25
26
  - Rakefile