image_optim_pack 0.5.0-x86-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -0
  3. data/.rubocop.yml +79 -0
  4. data/.travis.yml +35 -0
  5. data/CHANGELOG.markdown +210 -0
  6. data/Gemfile +7 -0
  7. data/LICENSE.txt +27 -0
  8. data/Makefile +393 -0
  9. data/README.markdown +93 -0
  10. data/Vagrantfile +60 -0
  11. data/acknowledgements/7z.txt +56 -0
  12. data/acknowledgements/advancecomp.txt +674 -0
  13. data/acknowledgements/bmp2png.txt +8 -0
  14. data/acknowledgements/cexcept.txt +8 -0
  15. data/acknowledgements/gifread.txt +14 -0
  16. data/acknowledgements/gifsicle.txt +343 -0
  17. data/acknowledgements/iqa.txt +30 -0
  18. data/acknowledgements/jhead.txt +12 -0
  19. data/acknowledgements/jpeg-archive.txt +20 -0
  20. data/acknowledgements/jpegoptim.txt +339 -0
  21. data/acknowledgements/libjpeg-turbo.txt +27 -0
  22. data/acknowledgements/libjpeg-x86-simd.txt +17 -0
  23. data/acknowledgements/libjpeg.txt +64 -0
  24. data/acknowledgements/libpng.txt +90 -0
  25. data/acknowledgements/mozjpeg.txt +7 -0
  26. data/acknowledgements/optipng-authors.txt +26 -0
  27. data/acknowledgements/optipng.txt +21 -0
  28. data/acknowledgements/pngcrush.txt +35 -0
  29. data/acknowledgements/pngquant.txt +56 -0
  30. data/acknowledgements/smallfry.txt +13 -0
  31. data/acknowledgements/zlib.txt +34 -0
  32. data/acknowledgements/zopfli-contributors.txt +6 -0
  33. data/acknowledgements/zopfli.txt +201 -0
  34. data/boxes/.gitignore +3 -0
  35. data/boxes/.rubocop.yml +13 -0
  36. data/boxes/Gemfile +11 -0
  37. data/boxes/Rakefile +144 -0
  38. data/boxes/definitions/freebsd-amd64/definition.rb +38 -0
  39. data/boxes/definitions/freebsd-amd64/install.sh +66 -0
  40. data/boxes/definitions/freebsd-i386/definition.rb +38 -0
  41. data/boxes/definitions/freebsd-i386/install.sh +66 -0
  42. data/boxes/definitions/freebsd-postinstall.sh +38 -0
  43. data/boxes/definitions/openbsd-amd64/definition.rb +71 -0
  44. data/boxes/definitions/openbsd-i386/definition.rb +71 -0
  45. data/boxes/definitions/openbsd-postinstall.sh +29 -0
  46. data/image_optim_pack-darwin-x86.gemspec +3 -0
  47. data/image_optim_pack-darwin-x86_64.gemspec +3 -0
  48. data/image_optim_pack-freebsd-amd64.gemspec +3 -0
  49. data/image_optim_pack-freebsd-x86.gemspec +3 -0
  50. data/image_optim_pack-linux-x86.gemspec +3 -0
  51. data/image_optim_pack-linux-x86_64.gemspec +3 -0
  52. data/image_optim_pack-openbsd-x86.gemspec +3 -0
  53. data/image_optim_pack-openbsd-x86_64.gemspec +3 -0
  54. data/image_optim_pack.gemspec +41 -0
  55. data/lib/image_optim/pack.rb +117 -0
  56. data/lib/image_optim_pack.rb +1 -0
  57. data/script/livecheck +116 -0
  58. data/script/run +71 -0
  59. data/script/update_versions +22 -0
  60. data/spec/image_optim/pack_spec.rb +114 -0
  61. data/spec/image_optim_spec.rb +39 -0
  62. data/spec/spec_helper.rb +8 -0
  63. data/vendor/linux-i686/advpng +0 -0
  64. data/vendor/linux-i686/gifsicle +0 -0
  65. data/vendor/linux-i686/jhead +0 -0
  66. data/vendor/linux-i686/jpeg-recompress +0 -0
  67. data/vendor/linux-i686/jpegoptim +0 -0
  68. data/vendor/linux-i686/jpegtran +0 -0
  69. data/vendor/linux-i686/libjpeg.so +0 -0
  70. data/vendor/linux-i686/libpng.so +0 -0
  71. data/vendor/linux-i686/libz.so +0 -0
  72. data/vendor/linux-i686/optipng +0 -0
  73. data/vendor/linux-i686/pngcrush +0 -0
  74. data/vendor/linux-i686/pngquant +0 -0
  75. metadata +182 -0
@@ -0,0 +1,56 @@
1
+ The quantization and dithering code in pngquant is lifted from Jef Poskanzer's
2
+ 'ppmquant', part of his wonderful PBMPLUS tool suite.
3
+
4
+ Greg Roelofs hacked it into a (in his words) "slightly cheesy" 'pamquant' back
5
+ in 1997 (see http://pobox.com/~newt/greg_rgba.html) and finally he ripped out
6
+ the cheesy file-I/O parts and replaced them with nice PNG code in December
7
+ 2000. The PNG reading and writing code is a merged and slightly simplified
8
+ version of readpng, readpng2, and writepng from his book "PNG: The Definitive
9
+ Guide."
10
+ In 2014 Greg has relicensed the code under the simplified BSD license.
11
+
12
+ Note that both licenses are basically BSD-like; that is, use the code however
13
+ you like, as long as you acknowledge its origins.
14
+
15
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
16
+
17
+ pngquant.c:
18
+
19
+ © 1989, 1991 by Jef Poskanzer.
20
+
21
+ Permission to use, copy, modify, and distribute this software and its
22
+ documentation for any purpose and without fee is hereby granted, provided
23
+ that the above copyright notice appear in all copies and that both that
24
+ copyright notice and this permission notice appear in supporting
25
+ documentation. This software is provided "as is" without express or
26
+ implied warranty.
27
+
28
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
29
+
30
+ pngquant.c and rwpng.c/h:
31
+
32
+ © 1997-2002 by Greg Roelofs; based on an idea by Stefan Schneider.
33
+ © 2009-2014 by Kornel Lesiński.
34
+
35
+ All rights reserved.
36
+
37
+ Redistribution and use in source and binary forms, with or without modification,
38
+ are permitted provided that the following conditions are met:
39
+
40
+ 1. Redistributions of source code must retain the above copyright notice,
41
+ this list of conditions and the following disclaimer.
42
+
43
+ 2. Redistributions in binary form must reproduce the above copyright notice,
44
+ this list of conditions and the following disclaimer in the documentation
45
+ and/or other materials provided with the distribution.
46
+
47
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
48
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
49
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
50
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
51
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
52
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
53
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
54
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
55
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
56
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2014, Derek Buitenhuis
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any
4
+ purpose with or without fee is hereby granted, provided that the above
5
+ copyright notice and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
@@ -0,0 +1,34 @@
1
+ Acknowledgments:
2
+
3
+ The deflate format used by zlib was defined by Phil Katz. The deflate and
4
+ zlib specifications were written by L. Peter Deutsch. Thanks to all the
5
+ people who reported problems and suggested various improvements in zlib; they
6
+ are too numerous to cite here.
7
+
8
+ Copyright notice:
9
+
10
+ (C) 1995-2013 Jean-loup Gailly and Mark Adler
11
+
12
+ This software is provided 'as-is', without any express or implied
13
+ warranty. In no event will the authors be held liable for any damages
14
+ arising from the use of this software.
15
+
16
+ Permission is granted to anyone to use this software for any purpose,
17
+ including commercial applications, and to alter it and redistribute it
18
+ freely, subject to the following restrictions:
19
+
20
+ 1. The origin of this software must not be misrepresented; you must not
21
+ claim that you wrote the original software. If you use this software
22
+ in a product, an acknowledgment in the product documentation would be
23
+ appreciated but is not required.
24
+ 2. Altered source versions must be plainly marked as such, and must not be
25
+ misrepresented as being the original software.
26
+ 3. This notice may not be removed or altered from any source distribution.
27
+
28
+ Jean-loup Gailly Mark Adler
29
+ jloup@gzip.org madler@alumni.caltech.edu
30
+
31
+ If you use the zlib library in a product, we would appreciate *not* receiving
32
+ lengthy legal documents to sign. The sources are provided for free but without
33
+ warranty of any kind. The library has been entirely written by Jean-loup
34
+ Gailly and Mark Adler; it does not include third-party code.
@@ -0,0 +1,6 @@
1
+ Mark Adler
2
+ Jyrki Alakuijala
3
+ Daniel Reed
4
+ Huzaifa Sidhpurwala
5
+ Péter Szabó
6
+ Lode Vandevenne
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2011 Google Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/boxes/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ /*.box
2
+ /.env
3
+ /iso/
@@ -0,0 +1,13 @@
1
+ inherit_from: ../.rubocop.yml
2
+
3
+ Lint/UnneededSplatExpansion:
4
+ Enabled: false
5
+
6
+ Metrics/LineLength:
7
+ Enabled: false
8
+
9
+ Security/Eval:
10
+ Exclude: [Rakefile]
11
+
12
+ Style/BracesAroundHashParameters:
13
+ Enabled: false
data/boxes/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+
5
+ gem 'veewee', '= 0.4.5.1'
6
+ gem 'dotenv', '~> 2.0'
7
+ gem 'atlas', '~> 1.3'
8
+ gem 'progress', '~> 3.1'
9
+
10
+ gem 'net-scp'
11
+ gem 'progressbar', '~> 0.21.0'
data/boxes/Rakefile ADDED
@@ -0,0 +1,144 @@
1
+ require 'atlas'
2
+ require 'dotenv/tasks'
3
+ require 'pathname'
4
+ require 'progress'
5
+
6
+ # Show progress when file is read by excon used by atlas
7
+ class BodyProgress # :nodoc:
8
+ def initialize(path, &block)
9
+ fail ArgumentError, 'block required' unless block
10
+ @io = File.open(path)
11
+ Progress.start(path, File.size(path)) do
12
+ yield self
13
+ end
14
+ end
15
+
16
+ def size
17
+ @io.size
18
+ end
19
+
20
+ def read(length)
21
+ data = @io.read(length)
22
+ Progress.step data.length if data
23
+ data
24
+ end
25
+ end
26
+
27
+ class Box # :nodoc:
28
+ attr_reader :definition_path, :definition_dir, :name, :path
29
+
30
+ def initialize(definition_path)
31
+ @definition_path = Pathname(definition_path)
32
+ @definition_dir = @definition_path.dirname
33
+ @name = @definition_dir.basename.to_s
34
+ @path = Pathname("#{@name}.box")
35
+ end
36
+
37
+ def dependencies
38
+ postinstall_file_paths = Array(definition[:postinstall_files]).map do |path|
39
+ definition_dir + path
40
+ end
41
+ [definition_path] + postinstall_file_paths
42
+ end
43
+
44
+ def build
45
+ sh(*%W[veewee vbox build --auto --checksum --force --nogui #{name}])
46
+ sh(*%w[sleep 30])
47
+ sh(*%W[veewee vbox export --force #{name}])
48
+ sh(*%W[veewee vbox destroy #{name}])
49
+ end
50
+
51
+ def add
52
+ assert_box_created
53
+
54
+ sh(*%W[vagrant box add --force --name boxes/#{path} #{path}])
55
+ end
56
+
57
+ def upload(version)
58
+ assert_box_created
59
+
60
+ box = Atlas::Box.create({
61
+ :username => 'image_optim_pack',
62
+ :name => name,
63
+ :short_description => "minimal #{name} (bash, wget) from #{definition[:iso_file]}",
64
+ })
65
+
66
+ version = box.create_version(:version => version)
67
+
68
+ provider = version.create_provider(:name => 'virtualbox')
69
+
70
+ BodyProgress.new(path) do |f|
71
+ provider.upload(f)
72
+ end
73
+
74
+ version.release
75
+ end
76
+
77
+ private
78
+
79
+ def definition
80
+ @definition ||= begin
81
+ eval definition_path.read.sub('Veewee::Session.declare', '{}.merge')
82
+ end
83
+ end
84
+
85
+ def assert_box_created
86
+ abort "#{path} doesn't exist" unless path.size?
87
+ end
88
+
89
+ def sh(*args)
90
+ abort unless system(*args)
91
+ end
92
+ end
93
+
94
+ task :atlas => :dotenv do
95
+ token = ENV['ATLAS_TOKEN'].to_s
96
+ fail 'ATLAS_TOKEN missing' if token.empty?
97
+ Atlas.configure do |config|
98
+ config.access_token = token
99
+ end
100
+ end
101
+
102
+ desc 'build all boxes'
103
+ task :build
104
+
105
+ desc 'add all boxes to vagrant'
106
+ task :add
107
+
108
+ desc 'upload all boxes to atlas'
109
+ task :upload
110
+
111
+ version = Time.now.strftime('%Y%m%d.0.0')
112
+ Dir['definitions/*/definition.rb'].each do |definition_path|
113
+ box = Box.new(definition_path)
114
+
115
+ desc "build #{box.path}"
116
+ file box.path => box.dependencies do
117
+ box.build
118
+ end
119
+ task :build => box.path
120
+
121
+ namespace :add do
122
+ desc "add #{box.path}"
123
+ task box.name => box.path do
124
+ box.add
125
+ end
126
+ end
127
+ task :add => "add:#{box.name}"
128
+
129
+ namespace :upload do
130
+ desc "upload #{box.path}"
131
+ task box.name => [:atlas, box.path] do
132
+ box.upload(version)
133
+ end
134
+ end
135
+ task :upload => "upload:#{box.name}"
136
+ end
137
+
138
+ desc 'remove *.box and iso dir'
139
+ task :clean do
140
+ sh 'rm *.box || true'
141
+ sh 'rm -r iso || true'
142
+ end
143
+
144
+ task :default => :build
@@ -0,0 +1,38 @@
1
+ Veewee::Session.declare({
2
+ :cpu_count => '1',
3
+ :memory_size => '512',
4
+ :disk_size => '8192',
5
+ :disk_format => 'VDI',
6
+ :hostiocache => 'off',
7
+ :os_type_id => 'FreeBSD_64',
8
+ :iso_file => 'FreeBSD-10.3-RELEASE-amd64-disc1.iso',
9
+ :iso_src => 'http://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/10.3/FreeBSD-10.3-RELEASE-amd64-disc1.iso',
10
+ :iso_sha256 => 'fef068cf6dea26923ab84b62ba9f21461ca0bdec90a0741c8ffb0e1ca29e410d',
11
+ :iso_download_timeout => '1000',
12
+ :boot_wait => '10',
13
+ :boot_cmd_sequence => [
14
+ '<Esc>',
15
+ 'boot -s',
16
+ '<Enter>',
17
+ '<Wait>' * 10,
18
+ '/bin/sh<Enter>',
19
+ 'mdmfs -s 100m md1 /tmp<Enter>',
20
+ 'dhclient -l /tmp/dhclient.lease.em0 em0<Enter>',
21
+ '<Wait>' * 10,
22
+ 'fetch -o /tmp/install.sh http://%IP%:%PORT%/install.sh && chmod +x /tmp/install.sh && /tmp/install.sh %NAME%<Enter>',
23
+ ],
24
+ :kickstart_port => '7122',
25
+ :kickstart_timeout => '300',
26
+ :kickstart_file => 'install.sh',
27
+ :ssh_login_timeout => '10000',
28
+ :ssh_user => 'root',
29
+ :ssh_password => 'vagrant',
30
+ :ssh_key => '',
31
+ :ssh_host_port => '7222',
32
+ :ssh_guest_port => '22',
33
+ :sudo_cmd => "sh '%f'",
34
+ :shutdown_cmd => 'shutdown -p now',
35
+ :postinstall_files => %w[../freebsd-postinstall.sh],
36
+ :postinstall_timeout => '10000',
37
+ :skip_iso_transfer => true,
38
+ })
@@ -0,0 +1,66 @@
1
+ #!/bin/sh -x
2
+
3
+ # Credit: http://www.aisecure.net/2011/05/01/root-on-zfs-freebsd-current/
4
+
5
+ NAME=$1
6
+
7
+ # create disks
8
+ gpart create -s gpt ada0
9
+ gpart add -t freebsd-boot -l boot -b 40 -s 512K ada0
10
+ gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 ada0
11
+ gpart add -t freebsd-ufs -l root -b 1M -s 2G ada0
12
+ gpart add -t freebsd-swap -l swap -s 512M ada0
13
+ gpart add -t freebsd-ufs -l var -s 1G ada0
14
+ gpart add -t freebsd-ufs -l tmp -s 512M ada0
15
+ gpart add -t freebsd-ufs -l usr -a 1M ada0
16
+
17
+ # create filesystems
18
+ newfs -U /dev/gpt/root
19
+ newfs -U /dev/gpt/var
20
+ newfs -U /dev/gpt/tmp
21
+ newfs -U /dev/gpt/usr
22
+
23
+ # mount the filesystems
24
+ mount /dev/gpt/root /mnt
25
+ mkdir /mnt/var && mount /dev/gpt/var /mnt/var
26
+ mkdir /mnt/tmp && mount /dev/gpt/tmp /mnt/tmp
27
+ mkdir /mnt/usr && mount /dev/gpt/usr /mnt/usr
28
+
29
+ # correct permissions
30
+ chmod 1777 /mnt/tmp
31
+ mkdir /mnt/var/tmp && chmod 1777 /mnt/var/tmp
32
+ cd /mnt && mkdir usr/home && ln -s usr/home home
33
+
34
+ # Install the OS
35
+ cd /usr/freebsd-dist
36
+ cat base.txz | tar --unlink -xpJf - -C /mnt
37
+ cat lib32.txz | tar --unlink -xpJf - -C /mnt
38
+ cat kernel.txz | tar --unlink -xpJf - -C /mnt
39
+ cat src.txz | tar --unlink -xpJf - -C /mnt
40
+
41
+ # Enable required services
42
+ cat >> /mnt/etc/rc.conf << EOT
43
+ hostname="${NAME}"
44
+ ifconfig_em0="dhcp"
45
+ sshd_enable="YES"
46
+ EOT
47
+
48
+ # Enable swap
49
+ cat >> /mnt/etc/fstab << EOT
50
+ /dev/gpt/swap none swap sw 0 0
51
+ /dev/gpt/root / ufs rw 1 1
52
+ /dev/gpt/var /var ufs rw 1 1
53
+ /dev/gpt/tmp /tmp ufs rw 1 1
54
+ /dev/gpt/usr /usr ufs rw 1 1
55
+ EOT
56
+
57
+ # Install a few requirements
58
+ touch /mnt/etc/resolv.conf
59
+ echo 'PermitRootLogin yes' >> /mnt/etc/ssh/sshd_config
60
+
61
+ # Set up user accounts
62
+ mkdir /mnt/usr/home/vagrant && chown 1001:1001 /mnt/home/vagrant
63
+ echo "vagrant" | pw -V /mnt/etc useradd vagrant -h 0 -s csh -G wheel -d /home/vagrant -c "Vagrant User"
64
+ echo "vagrant" | pw -V /mnt/etc usermod root -h 0
65
+
66
+ reboot
@@ -0,0 +1,38 @@
1
+ Veewee::Session.declare({
2
+ :cpu_count => '1',
3
+ :memory_size => '512',
4
+ :disk_size => '8192',
5
+ :disk_format => 'VDI',
6
+ :hostiocache => 'off',
7
+ :os_type_id => 'FreeBSD',
8
+ :iso_file => 'FreeBSD-10.3-RELEASE-i386-disc1.iso',
9
+ :iso_src => 'http://ftp.freebsd.org/pub/FreeBSD/releases/ISO-IMAGES/10.3/FreeBSD-10.3-RELEASE-i386-disc1.iso',
10
+ :iso_sha256 => '8329ee2ca4779892edbb001c303670d74642e4353e97d02f4521895023cacd5d',
11
+ :iso_download_timeout => '1000',
12
+ :boot_wait => '10',
13
+ :boot_cmd_sequence => [
14
+ '<Esc>',
15
+ 'boot -s',
16
+ '<Enter>',
17
+ '<Wait>' * 10,
18
+ '/bin/sh<Enter>',
19
+ 'mdmfs -s 100m md1 /tmp<Enter>',
20
+ 'dhclient -l /tmp/dhclient.lease.em0 em0<Enter>',
21
+ '<Wait>' * 10,
22
+ 'fetch -o /tmp/install.sh http://%IP%:%PORT%/install.sh && chmod +x /tmp/install.sh && /tmp/install.sh %NAME%<Enter>',
23
+ ],
24
+ :kickstart_port => '7122',
25
+ :kickstart_timeout => '300',
26
+ :kickstart_file => 'install.sh',
27
+ :ssh_login_timeout => '10000',
28
+ :ssh_user => 'root',
29
+ :ssh_password => 'vagrant',
30
+ :ssh_key => '',
31
+ :ssh_host_port => '7222',
32
+ :ssh_guest_port => '22',
33
+ :sudo_cmd => "sh '%f'",
34
+ :shutdown_cmd => 'shutdown -p now',
35
+ :postinstall_files => %w[../freebsd-postinstall.sh],
36
+ :postinstall_timeout => '10000',
37
+ :skip_iso_transfer => true,
38
+ })