boxgrinder-build 0.2.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/bin/boxgrinder-build +81 -0
  2. data/docs/examples/appliances/appliances.appl +5 -0
  3. data/docs/examples/appliances/minimal.appl +9 -0
  4. data/docs/examples/appliances/mix.appl +8 -0
  5. data/docs/examples/appliances/packages.appl +13 -0
  6. data/lib/boxgrinder-build/appliance.rb +85 -18
  7. data/lib/boxgrinder-build/helpers/appliance-customize-helper.rb +2 -2
  8. data/lib/boxgrinder-build/helpers/guestfs-helper.rb +18 -15
  9. data/lib/boxgrinder-build/helpers/package-helper.rb +65 -0
  10. data/lib/boxgrinder-build/helpers/plugin-helper.rb +89 -0
  11. data/lib/boxgrinder-build/{defaults.rb → managers/base-plugin-manager.rb} +41 -8
  12. data/lib/{boxgrinder-build.rb → boxgrinder-build/managers/delivery-plugin-manager.rb} +15 -18
  13. data/lib/boxgrinder-build/managers/operating-system-plugin-manager.rb +6 -0
  14. data/{bin/boxgrinder → lib/boxgrinder-build/managers/platform-plugin-manager.rb} +6 -3
  15. data/lib/boxgrinder-build/plugins/base-plugin.rb +98 -0
  16. data/lib/boxgrinder-build/plugins/delivery/base/base-delivery-plugin.rb +43 -0
  17. data/lib/boxgrinder-build/plugins/delivery/local/local-plugin.rb +57 -0
  18. data/lib/boxgrinder-build/{helpers → plugins/delivery/s3}/aws-helper.rb +0 -0
  19. data/lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb +133 -0
  20. data/lib/boxgrinder-build/{helpers/ssh-helper.rb → plugins/delivery/sftp/sftp-plugin.rb} +61 -42
  21. data/lib/boxgrinder-build/{appliance-kickstart.rb → plugins/os/base/kickstart.rb} +45 -55
  22. data/lib/boxgrinder-build/{images/raw-image.rb → plugins/os/base/rpm-based-os-plugin.rb} +63 -60
  23. data/lib/boxgrinder-build/{erb → plugins/os/base/src}/appliance.ks.erb +2 -5
  24. data/{src → lib/boxgrinder-build/plugins/os/base/src}/base.repo +0 -0
  25. data/{src → lib/boxgrinder-build/plugins/os/base/src}/motd.init +0 -0
  26. data/lib/boxgrinder-build/{validators/appliance-dependency-validator.rb → plugins/os/base/validators/rpm-dependency-validator.rb} +1 -1
  27. data/lib/boxgrinder-build/{models/ssh-config.rb → plugins/os/base-operating-system-plugin.rb} +10 -17
  28. data/lib/boxgrinder-build/plugins/os/centos/centos-plugin.rb +72 -0
  29. data/lib/boxgrinder-build/plugins/os/fedora/fedora-plugin.rb +66 -0
  30. data/lib/boxgrinder-build/plugins/os/rhel/rhel-plugin.rb +38 -0
  31. data/lib/boxgrinder-build/plugins/platform/base-platform-plugin.rb +37 -0
  32. data/lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb +283 -0
  33. data/{src → lib/boxgrinder-build/plugins/platform/ec2/src}/f12/yum.conf +0 -0
  34. data/{src/ec2 → lib/boxgrinder-build/plugins/platform/ec2/src}/f12-i386-boxgrinder.repo +0 -0
  35. data/{src/ec2 → lib/boxgrinder-build/plugins/platform/ec2/src}/f12-x86_64-boxgrinder.repo +0 -0
  36. data/{src/ec2 → lib/boxgrinder-build/plugins/platform/ec2/src}/fstab_32bit +0 -0
  37. data/{src/ec2 → lib/boxgrinder-build/plugins/platform/ec2/src}/fstab_64bit +0 -0
  38. data/{src/ec2 → lib/boxgrinder-build/plugins/platform/ec2/src}/ifcfg-eth0 +0 -0
  39. data/{src/ec2 → lib/boxgrinder-build/plugins/platform/ec2/src}/rc_local +1 -4
  40. data/{src/README.vmware → lib/boxgrinder-build/plugins/platform/vmware/src/README} +10 -10
  41. data/{src → lib/boxgrinder-build/plugins/platform/vmware/src}/base.vmdk +1 -1
  42. data/{src → lib/boxgrinder-build/plugins/platform/vmware/src}/base.vmx +0 -0
  43. data/lib/boxgrinder-build/plugins/platform/vmware/vmware-plugin.rb +181 -0
  44. data/lib/boxgrinder-build/validators/config-validator.rb +0 -19
  45. metadata +73 -44
  46. data/docs/examples/appliances/appliances-appliance/appliances-appliance.appl +0 -6
  47. data/docs/examples/appliances/appliances-appliance/appliances-appliance.pp +0 -16
  48. data/docs/examples/appliances/minimal-appliance/minimal-appliance.appl +0 -2
  49. data/docs/examples/appliances/minimal-appliance/minimal-appliance.pp +0 -16
  50. data/docs/examples/appliances/mix-appliance/mix-appliance.appl +0 -9
  51. data/docs/examples/appliances/mix-appliance/mix-appliance.pp +0 -16
  52. data/docs/examples/appliances/packages-appliance/packages-appliance.appl +0 -6
  53. data/docs/examples/appliances/packages-appliance/packages-appliance.pp +0 -16
  54. data/extras/sign-rpms +0 -12
  55. data/lib/boxgrinder-build/boxgrinder.rb +0 -93
  56. data/lib/boxgrinder-build/helpers/release-helper.rb +0 -136
  57. data/lib/boxgrinder-build/images/ec2-image.rb +0 -317
  58. data/lib/boxgrinder-build/images/vmware-image.rb +0 -214
  59. data/lib/boxgrinder-build/validators/appliance-definition-validator.rb +0 -89
  60. data/lib/progressbar/progressbar.rb +0 -236
  61. data/src/oddthesis/RPM-GPG-KEY-oddthesis +0 -30
  62. data/src/oddthesis/oddthesis.repo +0 -23
@@ -18,76 +18,78 @@
18
18
  # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19
19
  # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
20
20
 
21
- require 'rake/tasklib'
22
- require 'yaml'
23
- require 'boxgrinder-build/helpers/guestfs-helper'
24
- require 'boxgrinder-core/helpers/exec-helper'
21
+ require 'boxgrinder-build/plugins/os/base-operating-system-plugin'
25
22
 
26
23
  module BoxGrinder
27
- class RAWImage < Rake::TaskLib
24
+ class RPMBasedOSPlugin < BaseOperatingSystemPlugin
25
+ def after_init
26
+ @deliverables[:disk] = "#{@appliance_config.path.dir.raw.build_full}/#{@appliance_config.name}-sda.raw"
28
27
 
29
- def initialize( config, appliance_config, options = {} )
30
- @config = config
31
- @appliance_config = appliance_config
32
-
33
- @log = options[:log] || Logger.new(STDOUT)
34
- @exec_helper = options[:exec_helper] || ExecHelper.new( { :log => @log } )
35
-
36
- @tmp_dir = "#{@config.dir.root}/#{@config.dir.build}/tmp"
37
-
38
- define_tasks
28
+ @deliverables[:metadata] = {
29
+ :descriptor => "#{@appliance_config.path.dir.raw.build_full}/#{@appliance_config.name}.xml"
30
+ }
39
31
  end
40
32
 
41
- def define_tasks
42
- desc "Build #{@appliance_config.simple_name} appliance."
43
- task "appliance:#{@appliance_config.name}" => [ @appliance_config.path.file.raw.xml, "appliance:#{@appliance_config.name}:validate:dependencies" ]
33
+ def build_with_appliance_creator( repos )
34
+ Kickstart.new( @config, @appliance_config, repos, :log => @log ).create
35
+ RPMDependencyValidator.new( @config, @appliance_config, @options ).resolve_packages
44
36
 
45
- directory @tmp_dir
37
+ tmp_dir = "#{@config.dir.root}/#{@config.dir.build}/tmp"
38
+ FileUtils.mkdir_p( tmp_dir )
46
39
 
47
- file @appliance_config.path.file.raw.xml => [ @appliance_config.path.file.raw.kickstart, "appliance:#{@appliance_config.name}:validate:dependencies", @tmp_dir ] do
48
- build_raw_image
49
- do_post_build_operations
50
- end
51
- end
52
-
53
- def build_raw_image
54
- @log.info "Building #{@appliance_config.simple_name} appliance..."
40
+ @log.info "Building #{@appliance_config.name} appliance..."
55
41
 
56
- @exec_helper.execute "sudo PYTHONUNBUFFERED=1 appliance-creator -d -v -t #{@tmp_dir} --cache=#{@config.dir.rpms_cache}/#{@appliance_config.main_path} --config #{@appliance_config.path.file.raw.kickstart} -o #{@appliance_config.path.dir.raw.build} --name #{@appliance_config.name} --vmem #{@appliance_config.hardware.memory} --vcpu #{@appliance_config.hardware.cpus}"
42
+ @exec_helper.execute "sudo appliance-creator -d -v -t #{tmp_dir} --cache=#{@config.dir.rpms_cache}/#{@appliance_config.main_path} --config #{@appliance_config.path.file.raw.kickstart} -o #{@appliance_config.path.dir.raw.build} --name #{@appliance_config.name} --vmem #{@appliance_config.hardware.memory} --vcpu #{@appliance_config.hardware.cpus}"
57
43
 
58
44
  # fix permissions
59
45
  @exec_helper.execute "sudo chmod 777 #{@appliance_config.path.dir.raw.build_full}"
60
- @exec_helper.execute "sudo chmod 666 #{@appliance_config.path.file.raw.disk}"
61
- @exec_helper.execute "sudo chmod 666 #{@appliance_config.path.file.raw.xml}"
46
+ @exec_helper.execute "sudo chmod 666 #{@deliverables[:disk]}"
47
+ @exec_helper.execute "sudo chmod 666 #{@deliverables[:metadata][:descriptor]}"
48
+
49
+ customize( @deliverables[:disk] ) do |guestfs, guestfs_helper|
50
+ @log.info "Executing post operations after build..."
51
+
52
+ mount_partitions( guestfs, guestfs_helper ) if guestfs.list_partitions.size > 1
53
+
54
+ if @appliance_config.post.base.size > 0
55
+ @appliance_config.post.base.each do |cmd|
56
+ @log.debug "Executing #{cmd}"
57
+ guestfs.sh( cmd )
58
+ end
59
+ @log.debug "Post commands from appliance definition file executed."
60
+ else
61
+ @log.debug "No commands specified, skipping."
62
+ end
62
63
 
63
- @log.info "Appliance #{@appliance_config.simple_name} was built successfully."
64
- end
64
+ change_configuration( guestfs )
65
+ set_motd( guestfs )
66
+ install_version_files( guestfs )
67
+ install_repos( guestfs )
68
+
69
+ yield guestfs, guestfs_helper if block_given?
65
70
 
66
- def do_post_build_operations
67
- @log.info "Executing post operations after build..."
71
+ @log.info "Post operations executed."
72
+ end
68
73
 
69
- guestfs_helper = GuestFSHelper.new( @appliance_config.path.file.raw.disk, :log => @log )
70
- guestfs = guestfs_helper.guestfs
74
+ @log.info "Base image for #{@appliance_config.name} appliance was built successfully."
75
+ end
71
76
 
72
- change_configuration( guestfs )
73
- set_motd( guestfs )
74
- install_version_files( guestfs )
75
- install_repos( guestfs )
77
+ def mount_partitions( guestfs, guestfs_helper )
78
+ root_partition = nil
76
79
 
77
- @log.debug "Executing post commands from appliance definition file..."
78
- if @appliance_config.post.base.size > 0
79
- for cmd in @appliance_config.post.base
80
- @log.debug "Executing #{cmd}"
81
- guestfs.sh( cmd )
80
+ guestfs.list_partitions.each do |partition|
81
+ guestfs_helper.mount_partition( partition, '/' )
82
+ if guestfs.exists( '/sbin/e2label' ) != 0
83
+ root_partition = partition
84
+ break
82
85
  end
83
- @log.debug "Post commands from appliance definition file executed."
84
- else
85
- @log.debug "No commands specified, skipping."
86
+ guestfs.umount( partition )
86
87
  end
87
88
 
88
- guestfs.close
89
-
90
- @log.info "Post operations executed."
89
+ guestfs.list_partitions.each do |partition|
90
+ next if partition == root_partition
91
+ guestfs_helper.mount_partition( partition, guestfs.sh( "/sbin/e2label #{partition}" ).chomp.strip )
92
+ end
91
93
  end
92
94
 
93
95
  def change_configuration( guestfs )
@@ -99,11 +101,18 @@ module BoxGrinder
99
101
  @log.debug "Augeas changes saved."
100
102
  end
101
103
 
104
+ def install_version_files( guestfs )
105
+ @log.debug "Installing BoxGrinder version files..."
106
+ guestfs.sh( "echo 'BOXGRINDER_VERSION=#{@config.version_with_release}' > /etc/sysconfig/boxgrinder" )
107
+ guestfs.sh( "echo 'APPLIANCE_NAME=#{@appliance_config.name}' >> /etc/sysconfig/boxgrinder" )
108
+ @log.debug "Version files installed."
109
+ end
110
+
102
111
  def set_motd( guestfs )
103
112
  @log.debug "Setting up '/etc/motd'..."
104
113
  # set nice banner for SSH
105
114
  motd_file = "/etc/init.d/motd"
106
- guestfs.upload( "#{@config.dir.base}/src/motd.init", motd_file )
115
+ guestfs.upload( "#{File.dirname( __FILE__ )}/src/motd.init", motd_file )
107
116
  guestfs.sh( "sed -i s/#VERSION#/'#{@appliance_config.version}.#{@appliance_config.release}'/ #{motd_file}" )
108
117
  guestfs.sh( "sed -i s/#APPLIANCE#/'#{@appliance_config.name} appliance'/ #{motd_file}" )
109
118
 
@@ -112,18 +121,11 @@ module BoxGrinder
112
121
  @log.debug "'/etc/motd' is nice now."
113
122
  end
114
123
 
115
- def install_version_files( guestfs )
116
- @log.debug "Installing BoxGrinder version files..."
117
- guestfs.sh( "echo 'BOXGRINDER_VERSION=#{@config.version_with_release}' > /etc/sysconfig/boxgrinder" )
118
- guestfs.sh( "echo 'APPLIANCE_NAME=#{@appliance_config.name}' >> /etc/sysconfig/boxgrinder" )
119
- @log.debug "Version files installed."
120
- end
121
-
122
124
  def install_repos( guestfs )
123
125
  @log.debug "Installing repositories from appliance definition file..."
124
126
  @appliance_config.repos.each do |repo|
125
127
  @log.debug "Installing #{repo['name']} repo..."
126
- repo_file = File.read( "#{@config.dir.base}/src/base.repo").gsub( /#NAME#/, repo['name'] )
128
+ repo_file = File.read( "#{File.dirname( __FILE__ )}/src/base.repo").gsub( /#NAME#/, repo['name'] )
127
129
 
128
130
  ['baseurl', 'mirrorlist'].each do |type|
129
131
  repo_file << ("#{type}=#{repo[type]}\n") unless repo[type].nil?
@@ -133,5 +135,6 @@ module BoxGrinder
133
135
  end
134
136
  @log.debug "Repositories installed."
135
137
  end
138
+
136
139
  end
137
140
  end
@@ -17,11 +17,8 @@ services --enabled=network
17
17
 
18
18
  rootpw <%= root_password %>
19
19
 
20
- <% for partition in partitions %>
21
- part <%= partition['root'] %> --size <%= partition['size'].to_i * 1024 %> --fstype <%= fstype %> --ondisk sda<% end %>
22
-
23
- <% for user in users %>
24
- user --name=<%= user['name'] %><% unless user['home'].nil? %> --homedir=<%= user['home'] %><% end %><% unless user['group'].nil? %> --groups=<%= user['group'] %><% end %><% end unless users.nil? %>
20
+ <% appliance_config.hardware.partitions.each do |root, partition| %>
21
+ part <%= root %> --size <%= (partition['size'].to_f * 1024).to_i %> --fstype <%= fstype %> --ondisk sda<% end %>
25
22
 
26
23
  <% for repo in repos %>
27
24
  <%= repo %><% end %>
@@ -33,7 +33,7 @@ module BoxGrinder
33
33
  attr_reader :mirrorlist
34
34
  end
35
35
 
36
- class ApplianceDependencyValidator
36
+ class RPMDependencyValidator
37
37
  def initialize( config, appliance_config, options = {} )
38
38
  @config = config
39
39
  @appliance_config = appliance_config
@@ -18,27 +18,20 @@
18
18
  # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19
19
  # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
20
20
 
21
- require 'boxgrinder-core/validators/errors'
22
- require 'yaml'
21
+ require 'boxgrinder-build/managers/operating-system-plugin-manager'
22
+ require 'boxgrinder-build/plugins/base-plugin'
23
23
 
24
24
  module BoxGrinder
25
- class SSHConfig
26
- def initialize( config )
27
- @config = config
28
- @cfg = @config.data['ssh']
29
- @options = {}
25
+ class BaseOperatingSystemPlugin < BasePlugin
26
+ def self.inherited(klass)
27
+ OperatingSystemPluginManager.instance << klass
28
+ end
30
29
 
31
- # defaults
32
- @options['sftp_create_path'] = true
33
- @options['sftp_overwrite'] = false
34
- @options['sftp_default_permissions'] = 0644
30
+ alias_method :execute_original, :execute
35
31
 
36
- @options['host'] = @config.release.ssh['host']
37
- @options['username'] = @config.release.ssh['username']
38
- @options['password'] = @config.release.ssh['password']
32
+ def execute( args = nil )
33
+ raise "Build cannot be started before the plugin isn't initialized" if @initialized.nil?
34
+ execute_original( args )
39
35
  end
40
-
41
- attr_reader :options
42
- attr_reader :cfg
43
36
  end
44
37
  end
@@ -0,0 +1,72 @@
1
+ # JBoss, Home of Professional Open Source
2
+ # Copyright 2009, Red Hat Middleware LLC, and individual contributors
3
+ # by the @authors tag. See the copyright.txt in the distribution for a
4
+ # full listing of individual contributors.
5
+ #
6
+ # This is free software; you can redistribute it and/or modify it
7
+ # under the terms of the GNU Lesser General Public License as
8
+ # published by the Free Software Foundation; either version 2.1 of
9
+ # the License, or (at your option) any later version.
10
+ #
11
+ # This software is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this software; if not, write to the Free
18
+ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19
+ # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
20
+
21
+ require 'boxgrinder-build/plugins/os/base/rpm-based-os-plugin'
22
+
23
+ module BoxGrinder
24
+ class CentOSPlugin < RPMBasedOSPlugin
25
+
26
+ CENTOS_REPOS = {
27
+ "5" => {
28
+ "base" => {
29
+ "mirrorlist" => "http://mirrorlist.centos.org/?release=#OS_VERSION#&arch=#ARCH#&repo=os"
30
+ },
31
+ "updates" => {
32
+ "mirrorlist" => "http://mirrorlist.centos.org/?release=#OS_VERSION#&arch=#ARCH#&repo=updates"
33
+ }
34
+ }
35
+ }
36
+
37
+ def info
38
+ {
39
+ :name => :centos,
40
+ :full_name => "CentOS",
41
+ :type => :linux,
42
+ :versions => ["5"]
43
+ }
44
+ end
45
+
46
+ def execute
47
+ adjust_partition_table
48
+
49
+ disk_path = build_with_appliance_creator( CENTOS_REPOS ) do |guestfs, guestfs_helper|
50
+ kernel_version = guestfs.ls("/lib/modules").first
51
+
52
+ @log.debug "Recreating initrd for #{kernel_version} kernel..."
53
+ guestfs.sh( "/sbin/mkinitrd -f -v --preload=mptspi /boot/initrd-#{kernel_version}.img #{kernel_version}" )
54
+ @log.debug "Initrd recreated."
55
+
56
+ @log.debug "Applying root password..."
57
+ guestfs.sh( "/usr/bin/passwd -d root" )
58
+ guestfs.sh( "/usr/sbin/usermod -p '#{@appliance_config.os.password.crypt((0...8).map{65.+(rand(25)).chr}.join)}' root" )
59
+ @log.debug "Password applied."
60
+ end
61
+
62
+ @log.info "Done."
63
+
64
+ disk_path
65
+ end
66
+
67
+ # https://bugzilla.redhat.com/show_bug.cgi?id=466275
68
+ def adjust_partition_table
69
+ @appliance_config.hardware.partitions['/boot'] = { 'root' => '/boot', 'size' => 0.1 } if @appliance_config.hardware.partitions['/boot'].nil?
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,66 @@
1
+ # JBoss, Home of Professional Open Source
2
+ # Copyright 2009, Red Hat Middleware LLC, and individual contributors
3
+ # by the @authors tag. See the copyright.txt in the distribution for a
4
+ # full listing of individual contributors.
5
+ #
6
+ # This is free software; you can redistribute it and/or modify it
7
+ # under the terms of the GNU Lesser General Public License as
8
+ # published by the Free Software Foundation; either version 2.1 of
9
+ # the License, or (at your option) any later version.
10
+ #
11
+ # This software is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this software; if not, write to the Free
18
+ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19
+ # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
20
+
21
+ require 'boxgrinder-build/plugins/os/base/rpm-based-os-plugin'
22
+ require 'boxgrinder-build/plugins/os/base/kickstart'
23
+ require 'boxgrinder-build/plugins/os/base/validators/rpm-dependency-validator'
24
+
25
+ module BoxGrinder
26
+ class FedoraPlugin < RPMBasedOSPlugin
27
+
28
+ FEDORA_REPOS = {
29
+ "12" => {
30
+ "base" => {
31
+ "mirrorlist" => "http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-12&arch=#ARCH#"
32
+ },
33
+ "updates" => {
34
+ "mirrorlist" => "http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f12&arch=#ARCH#"
35
+ }
36
+ },
37
+ "11" => {
38
+ "base" => {
39
+ "mirrorlist" => "http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-11&arch=#ARCH#"
40
+ },
41
+ "updates" => {
42
+ "mirrorlist" => "http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f11&arch=#ARCH#"
43
+ }
44
+ },
45
+ "rawhide" => {
46
+ "base" => {
47
+ "mirrorlist" => "http://mirrors.fedoraproject.org/mirrorlist?repo=rawhide&arch=#ARCH#"
48
+ }
49
+ }
50
+
51
+ }
52
+
53
+ def info
54
+ {
55
+ :name => :fedora,
56
+ :full_name => "Fedora",
57
+ :type => :linux,
58
+ :versions => ["11", "12", "rawhide"]
59
+ }
60
+ end
61
+
62
+ def execute
63
+ build_with_appliance_creator( FEDORA_REPOS )
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,38 @@
1
+ # JBoss, Home of Professional Open Source
2
+ # Copyright 2009, Red Hat Middleware LLC, and individual contributors
3
+ # by the @authors tag. See the copyright.txt in the distribution for a
4
+ # full listing of individual contributors.
5
+ #
6
+ # This is free software; you can redistribute it and/or modify it
7
+ # under the terms of the GNU Lesser General Public License as
8
+ # published by the Free Software Foundation; either version 2.1 of
9
+ # the License, or (at your option) any later version.
10
+ #
11
+ # This software is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this software; if not, write to the Free
18
+ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19
+ # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
20
+
21
+ require 'boxgrinder-build/plugins/os/base/rpm-based-os-plugin'
22
+
23
+ module BoxGrinder
24
+ class RHELPlugin < RPMBasedOSPlugin
25
+ def info
26
+ {
27
+ :name => :rhel,
28
+ :full_name => "Red Hat Enterprise Linux",
29
+ :type => :linux,
30
+ :versions => ["5"]
31
+ }
32
+ end
33
+
34
+ def build
35
+ raise "Build cannot be started until the plugin isn't initialized" if @initialized.nil?
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,37 @@
1
+ # JBoss, Home of Professional Open Source
2
+ # Copyright 2009, Red Hat Middleware LLC, and individual contributors
3
+ # by the @authors tag. See the copyright.txt in the distribution for a
4
+ # full listing of individual contributors.
5
+ #
6
+ # This is free software; you can redistribute it and/or modify it
7
+ # under the terms of the GNU Lesser General Public License as
8
+ # published by the Free Software Foundation; either version 2.1 of
9
+ # the License, or (at your option) any later version.
10
+ #
11
+ # This software is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this software; if not, write to the Free
18
+ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19
+ # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
20
+
21
+ require 'boxgrinder-build/managers/platform-plugin-manager'
22
+ require 'boxgrinder-build/plugins/base-plugin'
23
+
24
+ module BoxGrinder
25
+ class BasePlatformPlugin < BasePlugin
26
+ def self.inherited(klass)
27
+ PlatformPluginManager.instance << klass
28
+ end
29
+
30
+ alias_method :execute_original, :execute
31
+
32
+ def execute(args = nil)
33
+ raise "Conversion cannot be started before the plugin isn't initialized" if @initialized.nil?
34
+ execute_original(args)
35
+ end
36
+ end
37
+ end