boxgrinder-build 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/CHANGELOG +7 -0
  2. data/Manifest +0 -0
  3. data/Rakefile +11 -0
  4. data/bin/boxgrinder-build +33 -27
  5. data/boxgrinder-build.gemspec +38 -0
  6. data/lib/boxgrinder-build/appliance.rb +32 -41
  7. data/lib/boxgrinder-build/helpers/appliance-customize-helper.rb +3 -48
  8. data/lib/boxgrinder-build/helpers/guestfs-helper.rb +98 -12
  9. data/lib/boxgrinder-build/helpers/linux-helper.rb +69 -0
  10. data/lib/boxgrinder-build/helpers/package-helper.rb +20 -11
  11. data/lib/boxgrinder-build/helpers/plugin-helper.rb +32 -32
  12. data/lib/boxgrinder-build/managers/plugin-manager.rb +98 -0
  13. data/lib/boxgrinder-build/plugins/base-plugin.rb +70 -17
  14. data/spec/Rakefile +13 -0
  15. data/spec/appliance-spec.rb +195 -0
  16. data/spec/helpers/appliance-customize-helper-spec.rb +30 -0
  17. data/spec/helpers/guestfs-helper-spec.rb +129 -0
  18. data/spec/helpers/linux-helper-spec.rb +50 -0
  19. data/spec/helpers/package-helper-spec.rb +6 -0
  20. data/spec/helpers/plugin-helper-spec.rb +63 -0
  21. data/spec/managers/plugin-manager-spec.rb +27 -0
  22. data/spec/plugins/base-plugin-spec.rb +89 -0
  23. data/spec/rspec/src/appliances/jeos-f13.appl +27 -0
  24. metadata +60 -157
  25. data/docs/examples/appliances/appliances.appl +0 -5
  26. data/docs/examples/appliances/minimal.appl +0 -9
  27. data/docs/examples/appliances/mix.appl +0 -8
  28. data/docs/examples/appliances/packages.appl +0 -13
  29. data/docs/node-info/pom.xml +0 -31
  30. data/docs/node-info/src/main/webapp/META-INF/MANIFEST.MF +0 -3
  31. data/docs/node-info/src/main/webapp/WEB-INF/web.xml +0 -7
  32. data/docs/node-info/src/main/webapp/index.jsp +0 -70
  33. data/lib/boxgrinder-build/helpers/rake-helper.rb +0 -71
  34. data/lib/boxgrinder-build/managers/base-plugin-manager.rb +0 -62
  35. data/lib/boxgrinder-build/managers/delivery-plugin-manager.rb +0 -39
  36. data/lib/boxgrinder-build/managers/operating-system-plugin-manager.rb +0 -6
  37. data/lib/boxgrinder-build/managers/platform-plugin-manager.rb +0 -26
  38. data/lib/boxgrinder-build/plugins/delivery/base/base-delivery-plugin.rb +0 -43
  39. data/lib/boxgrinder-build/plugins/delivery/local/local-plugin.rb +0 -57
  40. data/lib/boxgrinder-build/plugins/delivery/s3/aws-helper.rb +0 -64
  41. data/lib/boxgrinder-build/plugins/delivery/s3/s3-plugin.rb +0 -190
  42. data/lib/boxgrinder-build/plugins/delivery/sftp/sftp-plugin.rb +0 -159
  43. data/lib/boxgrinder-build/plugins/os/base/kickstart.rb +0 -148
  44. data/lib/boxgrinder-build/plugins/os/base/rhel-based-os-plugin.rb +0 -51
  45. data/lib/boxgrinder-build/plugins/os/base/rpm-based-os-plugin.rb +0 -134
  46. data/lib/boxgrinder-build/plugins/os/base/src/appliance.ks.erb +0 -41
  47. data/lib/boxgrinder-build/plugins/os/base/src/base.repo +0 -4
  48. data/lib/boxgrinder-build/plugins/os/base/src/motd.init +0 -21
  49. data/lib/boxgrinder-build/plugins/os/base/validators/rpm-dependency-validator.rb +0 -162
  50. data/lib/boxgrinder-build/plugins/os/base-operating-system-plugin.rb +0 -37
  51. data/lib/boxgrinder-build/plugins/os/centos/centos-plugin.rb +0 -52
  52. data/lib/boxgrinder-build/plugins/os/fedora/fedora-plugin.rb +0 -74
  53. data/lib/boxgrinder-build/plugins/os/rhel/rhel-plugin.rb +0 -40
  54. data/lib/boxgrinder-build/plugins/platform/base-platform-plugin.rb +0 -37
  55. data/lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb +0 -332
  56. data/lib/boxgrinder-build/plugins/platform/ec2/src/f12/yum.conf +0 -24
  57. data/lib/boxgrinder-build/plugins/platform/ec2/src/f12-i386-boxgrinder.repo +0 -11
  58. data/lib/boxgrinder-build/plugins/platform/ec2/src/f12-x86_64-boxgrinder.repo +0 -11
  59. data/lib/boxgrinder-build/plugins/platform/ec2/src/fstab_32bit +0 -8
  60. data/lib/boxgrinder-build/plugins/platform/ec2/src/fstab_64bit +0 -8
  61. data/lib/boxgrinder-build/plugins/platform/ec2/src/ifcfg-eth0 +0 -7
  62. data/lib/boxgrinder-build/plugins/platform/ec2/src/rc_local +0 -29
  63. data/lib/boxgrinder-build/plugins/platform/vmware/src/README +0 -42
  64. data/lib/boxgrinder-build/plugins/platform/vmware/src/base.vmdk +0 -19
  65. data/lib/boxgrinder-build/plugins/platform/vmware/src/base.vmx +0 -45
  66. data/lib/boxgrinder-build/plugins/platform/vmware/vmware-plugin.rb +0 -181
  67. data/lib/boxgrinder-build/validators/appliance-config-parameter-validator.rb +0 -37
  68. data/lib/boxgrinder-build/validators/appliance-validator.rb +0 -84
  69. data/lib/boxgrinder-build/validators/config-validator.rb +0 -48
  70. data/lib/boxgrinder-build/validators/ssh-validator.rb +0 -35
  71. data/lib/boxgrinder-build/validators/validator.rb +0 -91
@@ -1,332 +0,0 @@
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/platform/base-platform-plugin'
22
-
23
- module BoxGrinder
24
- class EC2Plugin < BasePlatformPlugin
25
- def info
26
- {
27
- :name => :ec2,
28
- :full_name => "Amazon Elastic Compute Cloud (Amazon EC2)"
29
- }
30
- end
31
-
32
- SUPPORTED_OSES = {
33
- 'rhel' => [ '5' ],
34
- 'centos' => [ '5' ],
35
- 'fedora' => [ '11' ]
36
- }
37
-
38
- REGIONS = {'us_east' => 'url'}
39
-
40
- KERNELS = {
41
- 'fedora' => {
42
- '11' => {
43
- 'i386' => { :rpm => 'http://repo.oddthesis.org/packages/other/kernel-xen-2.6.21.7-2.fc8.i686.rpm' },
44
- 'x86_64' => { :rpm => 'http://repo.oddthesis.org/packages/other/kernel-xen-2.6.21.7-2.fc8.x86_64.rpm' }
45
- }
46
- },
47
- 'centos' => {
48
- '5' => {
49
- 'i386' => { :rpm => 'http://repo.oddthesis.org/packages/other/kernel-xen-2.6.21.7-2.fc8.i686.rpm' },
50
- 'x86_64' => { :rpm => 'http://repo.oddthesis.org/packages/other/kernel-xen-2.6.21.7-2.fc8.x86_64.rpm' }
51
- }
52
- },
53
- 'rhel' => {
54
- '5' => {
55
- 'i386' => { :rpm => 'http://repo.oddthesis.org/packages/other/kernel-xen-2.6.21.7-2.fc8.i686.rpm' },
56
- 'x86_64' => { :rpm => 'http://repo.oddthesis.org/packages/other/kernel-xen-2.6.21.7-2.fc8.x86_64.rpm' }
57
- }
58
- }
59
- }
60
-
61
- def after_init
62
- @deliverables[:disk] = "#{@appliance_config.path.dir.build}/ec2/#{@appliance_config.name}.ec2"
63
- end
64
-
65
- def supported_os
66
- supported = ""
67
-
68
- SUPPORTED_OSES.each_key do |os_name|
69
- supported << "#{os_name}, versions: #{SUPPORTED_OSES[os_name].join(", ")}"
70
- end
71
-
72
- supported
73
- end
74
-
75
- def execute(raw_disk)
76
- if File.exists?(@deliverables[:disk])
77
- @log.info "EC2 image for #{@appliance_config.name} appliance already exists, skipping..."
78
- return
79
- end
80
-
81
- unless !SUPPORTED_OSES[@appliance_config.os.name].nil? and SUPPORTED_OSES[@appliance_config.os.name].include?(@appliance_config.os.version)
82
- @log.error "EC2 platform plugin for Linux operating systems supports: #{supported_os}. Your OS is #{@appliance_config.os.name} #{@appliance_config.os.version}."
83
- return
84
- end
85
-
86
- FileUtils.mkdir_p File.dirname(@deliverables[:disk])
87
-
88
- @log.info "Converting #{@appliance_config.name} appliance image to EC2 format..."
89
-
90
- begin
91
- ec2_prepare_disk
92
- ec2_create_filesystem
93
- rescue => e
94
- raise "Error while preparing EC2 disk image. See logs for more info"
95
- end
96
-
97
- ec2_disk_mount_dir = "#{@appliance_config.path.dir.build}/tmp/ec2-#{rand(9999999999).to_s.center(10, rand(9).to_s)}"
98
- raw_disk_mount_dir = "#{@appliance_config.path.dir.build}/tmp/raw-#{rand(9999999999).to_s.center(10, rand(9).to_s)}"
99
-
100
-
101
- begin
102
- ec2_mounts = mount_image( @deliverables[:disk], ec2_disk_mount_dir )
103
- raw_mounts = mount_image( raw_disk, raw_disk_mount_dir )
104
- rescue => e
105
- @log.debug e
106
- raise "Error while mounting image. See logs for more info"
107
- end
108
-
109
- sync_files(raw_disk_mount_dir, ec2_disk_mount_dir)
110
-
111
- umount_image(raw_disk, raw_disk_mount_dir, raw_mounts)
112
- umount_image(@deliverables[:disk], ec2_disk_mount_dir, ec2_mounts)
113
-
114
- customize(@deliverables[:disk]) do |guestfs, guestfs_helper|
115
- # TODO is this really needed?
116
- @log.debug "Uploading '/etc/resolv.conf'..."
117
- guestfs.upload( "/etc/resolv.conf", "/etc/resolv.conf" )
118
- @log.debug "'/etc/resolv.conf' uploaded."
119
-
120
- create_devices(guestfs)
121
- upload_fstab(guestfs)
122
-
123
- guestfs.mkdir("/data") if @appliance_config.is64bit?
124
-
125
- enable_networking(guestfs)
126
- upload_rc_local(guestfs)
127
-
128
- guestfs_helper.rebuild_rpm_database
129
-
130
- install_additional_packages(guestfs)
131
- change_configuration(guestfs)
132
-
133
- unless @appliance_config.post['ec2'].nil?
134
- @appliance_config.post['ec2'].each do |cmd|
135
- @log.debug "Executing #{cmd}"
136
- guestfs.sh( cmd )
137
- end
138
- @log.debug "Post commands from appliance definition file executed."
139
- else
140
- @log.debug "No commands specified, skipping."
141
- end
142
-
143
- # if @appliance_config.os.name.eql?("fedora") and @appliance_config.os.version.to_s.eql?("12")
144
- # @log.debug "Downgrading udev package to use in EC2 environment..."
145
- #
146
- # repo_included = false
147
- #
148
- # @appliance_config.repos.each do |repo|
149
- # repo_included = true if repo['baseurl'] == "http://repo.boxgrinder.org/boxgrinder/packages/fedora/12/RPMS/#{@appliance_config.hardware.arch}"
150
- # end
151
- #
152
- # guestfs.upload( "#{File.dirname( __FILE__ )}/src/f12-#{@appliance_config.hardware.arch}-boxgrinder.repo", "/etc/yum.repos.d/f12-#{@appliance_config.hardware.arch}-boxgrinder.repo" ) unless repo_included
153
- # guestfs.sh( "yum -y downgrade udev-142" )
154
- # guestfs.upload( "#{File.dirname( __FILE__ )}/src/f12/yum.conf", "/etc/yum.conf" )
155
- # guestfs.rm_rf( "/etc/yum.repos.d/f12-#{@appliance_config.hardware.arch}-boxgrinder.repo" ) unless repo_included
156
- #
157
- # @log.debug "Package udev downgraded."
158
- #
159
- # # TODO EC2 fix, remove that after Fedora pushes kernels to Amazon
160
- # @log.debug "Disabling unnecessary services..."
161
- # guestfs.sh( "/sbin/chkconfig ksm off" ) if guestfs.exists( "/etc/init.d/ksm" ) != 0
162
- # guestfs.sh( "/sbin/chkconfig ksmtuned off" ) if guestfs.exists( "/etc/init.d/ksmtuned" ) != 0
163
- # @log.debug "Services disabled."
164
- # end
165
- end
166
-
167
- @log.info "Image converted to EC2 format."
168
- end
169
-
170
- def ec2_prepare_disk
171
- # TODO add progress bar?
172
- # TODO using whole 10GB is fine?
173
- @log.debug "Preparing disk for EC2 image..."
174
- @exec_helper.execute "dd if=/dev/zero of=#{@deliverables[:disk]} bs=1 count=0 seek=#{10 * 1024}M"
175
- @log.debug "Disk for EC2 image prepared"
176
- end
177
-
178
- def ec2_create_filesystem
179
- @log.debug "Creating filesystem..."
180
- @exec_helper.execute "mkfs.ext3 -F #{@deliverables[:disk]}"
181
- @log.debug "Filesystem created"
182
- end
183
-
184
- def calculate_disk_offsets( disk )
185
- @log.debug "Calculating offsets for '#{File.basename(disk)}' disk..."
186
- loop_device = get_loop_device
187
-
188
- @exec_helper.execute("sudo losetup #{loop_device} #{disk}")
189
- offsets = @exec_helper.execute("sudo parted #{loop_device} 'unit B print' | grep -e '^ [0-9]' | awk '{ print $2 }'").scan(/\d+/)
190
- @exec_helper.execute("sudo losetup -d #{loop_device}")
191
-
192
- @log.trace "Offsets:\n#{offsets}"
193
-
194
- offsets
195
- end
196
-
197
- def mount_image(disk, mount_dir)
198
- offsets = calculate_disk_offsets( disk )
199
-
200
- @log.debug "Mounting image #{File.basename(disk)} in #{mount_dir}..."
201
- FileUtils.mkdir_p(mount_dir)
202
-
203
- mounts = {}
204
-
205
- offsets.each do |offset|
206
- loop_device = get_loop_device
207
- @exec_helper.execute("sudo losetup -o #{offset.to_s} #{loop_device} #{disk}")
208
- label = @exec_helper.execute("sudo e2label #{loop_device}").strip.chomp
209
- label = '/' if label == ''
210
- mounts[label] = loop_device
211
- end
212
-
213
- @exec_helper.execute("sudo mount #{mounts['/']} -t ext3 #{mount_dir}")
214
-
215
- mounts.each { |mount_point, loop_device| @exec_helper.execute("sudo mount #{loop_device} -t ext3 #{mount_dir}/#{mount_point}") unless mount_point == '/' }
216
-
217
- @log.trace "Mounts:\n#{mounts}"
218
-
219
- mounts
220
- end
221
-
222
- def umount_image(disk, mount_dir, mounts)
223
- @log.debug "Unmounting image '#{File.basename(disk)}'..."
224
-
225
- mounts.each { |mount_point, loop_device| @exec_helper.execute("sudo umount -d #{loop_device}") unless mount_point == '/' }
226
-
227
- @exec_helper.execute("sudo umount -d #{mounts['/']}")
228
-
229
- FileUtils.rm_rf(mount_dir)
230
- end
231
-
232
-
233
- def sync_files(from_dir, to_dir)
234
- @log.debug "Syncing files between #{from_dir} and #{to_dir}..."
235
- @exec_helper.execute "sudo rsync -u -r -a #{from_dir}/* #{to_dir}"
236
- @log.debug "Sync finished."
237
- end
238
-
239
- def cache_rpms(rpms)
240
- for name in rpms.keys
241
- cache_file = "#{@config.dir.src_cache}/#{name}"
242
-
243
- if (!File.exist?(cache_file))
244
- FileUtils.mkdir_p(@config.dir.src_cache)
245
- @exec_helper.execute("wget #{rpms[name]} -O #{cache_file}")
246
- end
247
- end
248
- end
249
-
250
- def create_devices(guestfs)
251
- @log.debug "Creating required devices..."
252
- guestfs.sh("/sbin/MAKEDEV -d /dev -x console")
253
- guestfs.sh("/sbin/MAKEDEV -d /dev -x null")
254
- guestfs.sh("/sbin/MAKEDEV -d /dev -x zero")
255
- @log.debug "Devices created."
256
- end
257
-
258
- def upload_fstab(guestfs)
259
- @log.debug "Uploading '/etc/fstab' file..."
260
- fstab_file = @appliance_config.is64bit? ? "#{File.dirname(__FILE__)}/src/fstab_64bit" : "#{File.dirname(__FILE__)}/src/fstab_32bit"
261
- guestfs.upload(fstab_file, "/etc/fstab")
262
- @log.debug "'/etc/fstab' file uploaded."
263
- end
264
-
265
- # enable networking on default runlevels
266
- def enable_networking(guestfs)
267
- @log.debug "Enabling networking..."
268
- guestfs.sh("/sbin/chkconfig network on")
269
- guestfs.upload("#{File.dirname(__FILE__)}/src/ifcfg-eth0", "/etc/sysconfig/network-scripts/ifcfg-eth0")
270
- @log.debug "Networking enabled."
271
- end
272
-
273
- def upload_rc_local(guestfs)
274
- @log.debug "Uploading '/etc/rc.local' file..."
275
- rc_local = Tempfile.new('rc_local')
276
- rc_local << guestfs.read_file("/etc/rc.local") + File.read("#{File.dirname(__FILE__)}/src/rc_local")
277
- rc_local.flush
278
-
279
- guestfs.upload(rc_local.path, "/etc/rc.local")
280
-
281
- rc_local.close
282
- @log.debug "'/etc/rc.local' file uploaded."
283
- end
284
-
285
- def install_additional_packages(guestfs)
286
- rpms = {
287
- "ec2-ami-tools.noarch.rpm" => "http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools.noarch.rpm"
288
- }
289
-
290
- begin
291
- kernel_rpm = KERNELS[@appliance_config.os.name][@appliance_config.os.version][@appliance_config.hardware.arch][:rpm]
292
- rpms[File.basename(kernel_rpm)] = kernel_rpm
293
- rescue
294
- end
295
-
296
- cache_rpms(rpms)
297
-
298
- @log.debug "Installing additional packages (#{rpms.keys.join(", ")})..."
299
- guestfs.mkdir_p("/tmp/rpms")
300
-
301
- for name in rpms.keys
302
- cache_file = "#{@config.dir.src_cache}/#{name}"
303
- guestfs.upload(cache_file, "/tmp/rpms/#{name}")
304
- end
305
-
306
- guestfs.sh("rpm -Uvh --nodeps /tmp/rpms/*.rpm")
307
- guestfs.rm_rf("/tmp/rpms")
308
- @log.debug "Additional packages installed."
309
- end
310
-
311
- def change_configuration(guestfs)
312
- @log.debug "Changing configuration files using augeas..."
313
- guestfs.aug_init("/", 0)
314
- # disable password authentication
315
- guestfs.aug_set("/files/etc/ssh/sshd_config/PasswordAuthentication", "no")
316
- guestfs.aug_save
317
- @log.debug "Augeas changes saved."
318
- end
319
-
320
- def get_loop_device
321
- begin
322
- loop_device = @exec_helper.execute("sudo losetup -f 2>&1").strip
323
- rescue
324
- raise "No free loop devices available, please free at least one. See 'losetup -d' command."
325
- end
326
-
327
- loop_device
328
- end
329
-
330
-
331
- end
332
- end
@@ -1,24 +0,0 @@
1
- [main]
2
- cachedir=/var/cache/yum/$basearch/$releasever
3
- keepcache=0
4
- debuglevel=2
5
- logfile=/var/log/yum.log
6
- exactarch=1
7
- obsoletes=1
8
- gpgcheck=1
9
- plugins=1
10
- installonly_limit=3
11
- exclude=udev*
12
-
13
- # This is the default, if you make this bigger yum won't see if the metadata
14
- # is newer on the remote and so you'll "gain" the bandwidth of not having to
15
- # download the new metadata and "pay" for it by yum not having correct
16
- # information.
17
- # It is esp. important, to have correct metadata, for distributions like
18
- # Fedora which don't keep old packages around. If you don't like this checking
19
- # interupting your command line usage, it's much better to have something
20
- # manually check the metadata once an hour (yum-updatesd will do this).
21
- # metadata_expire=90m
22
-
23
- # PUT YOUR REPOS HERE OR IN separate files named file.repo
24
- # in /etc/yum.repos.d
@@ -1,11 +0,0 @@
1
- [boxgrinder-i386]
2
- name=boxgrinder-i386
3
- enabled=1
4
- gpgcheck=0
5
- baseurl=http://repo.boxgrinder.org/boxgrinder/packages/fedora/12/RPMS/i386
6
-
7
- [boxgrinder-noarch]
8
- name=boxgrinder-noarch
9
- enabled=1
10
- gpgcheck=0
11
- baseurl=http://repo.boxgrinder.org/boxgrinder/packages/fedora/12/RPMS/noarch
@@ -1,11 +0,0 @@
1
- [boxgrinder-x86_64]
2
- name=boxgrinder-x86_64
3
- enabled=1
4
- gpgcheck=0
5
- baseurl=http://repo.boxgrinder.org/boxgrinder/packages/fedora/12/RPMS/x86_64
6
-
7
- [boxgrinder-noarch]
8
- name=boxgrinder-noarch
9
- enabled=1
10
- gpgcheck=0
11
- baseurl=http://repo.boxgrinder.org/boxgrinder/packages/fedora/12/RPMS/noarch
@@ -1,8 +0,0 @@
1
- /dev/sda1 / ext3 defaults 1 1
2
- /dev/sda2 /mnt ext3 defaults 1 2
3
- /dev/sda3 swap swap defaults 0 0
4
- none /dev/pts devpts gid=5,mode=620 0 0
5
- none /dev/shm tmpfs defaults 0 0
6
- none /proc proc defaults 0 0
7
- none /sys sysfs defaults 0 0
8
-
@@ -1,8 +0,0 @@
1
- /dev/sda1 / ext3 defaults 1 1
2
- /dev/sdb /mnt ext3 defaults 0 0
3
- /dev/sdc /data ext3 defaults 0 0
4
- none /dev/pts devpts gid=5,mode=620 0 0
5
- none /dev/shm tmpfs defaults 0 0
6
- none /proc proc defaults 0 0
7
- none /sys sysfs defaults 0 0
8
-
@@ -1,7 +0,0 @@
1
- DEVICE=eth0
2
- BOOTPROTO=dhcp
3
- ONBOOT=yes
4
- TYPE=Ethernet
5
- USERCTL=yes
6
- PEERDNS=yes
7
- IPV6INIT=no
@@ -1,29 +0,0 @@
1
- curl http://169.254.169.254/2009-04-04/meta-data/public-keys/0/openssh-key 2>/dev/null >/tmp/my-key
2
-
3
- if [ $? -eq 0 ] ; then
4
- if [ ! -d /root/.ssh ] ; then
5
- mkdir -p /root/.ssh
6
- chmod 700 /root/.ssh
7
- fi
8
-
9
- dd if=/dev/urandom count=50 2>/dev/null|md5sum|awk '{ print $1 }'|passwd --stdin root >/dev/null
10
- cat /tmp/my-key >> /root/.ssh/authorized_keys
11
- chmod 600 /root/.ssh/authorized_keys
12
-
13
- for home in `find /home/* -maxdepth 0 -type d 2>/dev/null | tr '\n' ' '`; do
14
- user=`echo $home | awk -F '/' '{ print $3 }'`
15
-
16
- if [ ! -d $home/.ssh ] ; then
17
- mkdir -p $home/.ssh
18
- chmod 700 $home/.ssh
19
- chown $user $home/.ssh
20
- fi
21
-
22
- dd if=/dev/urandom count=50 2>/dev/null|md5sum|awk '{ print $1 }'|passwd --stdin $user >/dev/null
23
- cat /tmp/my-key >> $home/.ssh/authorized_keys
24
- chmod 600 $home/.ssh/authorized_keys
25
- chown $user $home/.ssh/authorized_keys
26
-
27
- done
28
- rm /tmp/my-key
29
- fi
@@ -1,42 +0,0 @@
1
- #NAME# version #VERSION#
2
-
3
- This package contains #APPLIANCE_NAME# image for VMware.
4
-
5
- VMware Personal (VMware Fusion, VMware Server, VMware Player)
6
- =============================================================
7
-
8
- Required files:
9
- ---------------
10
-
11
- #APPLIANCE_NAME#.raw
12
- #APPLIANCE_NAME#-personal.vmx
13
- #APPLIANCE_NAME#-personal.vmdk
14
-
15
- Required steps:
16
- ---------------
17
-
18
- 1. Extract required files into one directory.
19
- 2. Rename #APPLIANCE_NAME#-personal.vmx to #APPLIANCE_NAME#.vmx
20
- 3. Rename #APPLIANCE_NAME#-personal.vmdk to #APPLIANCE_NAME#.vmdk
21
- 4. Add #APPLIANCE_NAME#.vmx to inventory.
22
- 3. Run appliance.
23
-
24
- VMware Enterprise (VMware ESX/ESXi/, VMware vSphere)
25
- ====================================================
26
-
27
- Required files:
28
- ---------------
29
-
30
- #APPLIANCE_NAME#.raw
31
- #APPLIANCE_NAME#-enterprise.vmx
32
- #APPLIANCE_NAME#-enterprise.vmdk
33
-
34
- Required steps:
35
- ---------------
36
-
37
- 1. Extract required files into one directory.
38
- 2. Rename #APPLIANCE_NAME#-personal.vmx to #APPLIANCE_NAME#.vmx
39
- 3. Rename #APPLIANCE_NAME#-personal.vmdk to #APPLIANCE_NAME#.vmdk
40
- 4. Upload all files to ESX server using vSpehere/VI client.
41
- 5. Add #APPLIANCE_NAME#.vmx to inventory.
42
- 6. Run appliance.
@@ -1,19 +0,0 @@
1
- # Disk DescriptorFile
2
- version=1
3
- CID=fffffffe
4
- parentCID=ffffffff
5
- createType="#TYPE#"
6
-
7
- # Extent description
8
- RW #TOTAL_SECTORS# #EXTENT_TYPE# "#NAME#.raw" #NUMBER#
9
-
10
- # The Disk Data Base
11
- #DDB
12
-
13
- ddb.toolsVersion = "0"
14
- ddb.adapterType = "lsilogic"
15
- ddb.geometry.sectors = "#SECTORS#"
16
- ddb.geometry.heads = "#HEADS#"
17
- ddb.geometry.cylinders = "#CYLINDERS#"
18
- ddb.encoding = "UTF-8"
19
- ddb.virtualHWVersion = "#HW_VERSION#"
@@ -1,45 +0,0 @@
1
-
2
- #!/usr/bin/vmware
3
-
4
- config.version = "8"
5
- virtualHW.version = "4"
6
- guestOS = "#GUESTOS#"
7
- displayName = "#NAME#"
8
- annotation = "#SUMMARY# | Version: #VERSION# | Built by: #BUILDER#"
9
- guestinfo.vmware.product.long = "#NAME#"
10
- guestinfo.vmware.product.url = "http://www.jboss.org/stormgrind/projects/boxgrinder.html"
11
- guestinfo.vmware.product.class = "virtual machine"
12
- numvcpus = "#VCPU#"
13
- memsize = "#MEM_SIZE#"
14
- MemAllowAutoScaleDown = "FALSE"
15
- MemTrimRate = "-1"
16
- uuid.action = "create"
17
- tools.remindInstall = "TRUE"
18
- hints.hideAll = "TRUE"
19
- tools.syncTime = "TRUE"
20
- serial0.present = "FALSE"
21
- serial1.present = "FALSE"
22
- parallel0.present = "FALSE"
23
- logging = "TRUE"
24
- log.fileName = "#NAME#.log"
25
- log.append = "TRUE"
26
- log.keepOld = "3"
27
- isolation.tools.hgfs.disable = "FALSE"
28
- isolation.tools.dnd.disable = "FALSE"
29
- isolation.tools.copy.enable = "TRUE"
30
- isolation.tools.paste.enabled = "TRUE"
31
- floppy0.present = "FALSE"
32
-
33
- scsi0:0.present = "TRUE"
34
- scsi0:0.fileName = "#NAME#.vmdk"
35
- scsi0:0.mode = "persistent"
36
- scsi0:0.startConnected = "TRUE"
37
- scsi0:0.writeThrough = "TRUE"
38
- scsi0.present = "TRUE"
39
- scsi0.virtualDev = "lsilogic"
40
-
41
- ethernet0.present = "TRUE"
42
- ethernet0.connectionType = "nat"
43
- ethernet0.addressType = "generated"
44
- ethernet0.generatedAddressOffset = "0"
45
- ethernet0.autoDetect = "TRUE"