pi_build_modifier 0.4.0.pre.alpha → 0.5.0.pre.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/CODE_OF_CONDUCT.md +1 -1
- data/README.md +55 -20
- data/Rakefile +6 -5
- data/docs/concept.md +0 -18
- data/docs/incubation.md +3 -14
- data/pi_build_modifier/Gemfile.lock +50 -0
- data/pi_build_modifier/lib/pi_build_modifier.rb +4 -7
- data/pi_build_modifier/lib/pi_build_modifier/modify/configs.rb +335 -0
- data/pi_build_modifier/lib/pi_build_modifier/modify/modifiers.rb +281 -0
- data/pi_build_modifier/lib/pi_build_modifier/{locale → modify}/templates/00-debconf.erb +1 -1
- data/pi_build_modifier/lib/pi_build_modifier/{boot-files → modify}/templates/07-resize-init.diff.erb +1 -1
- data/pi_build_modifier/lib/pi_build_modifier/{net-tweaks → modify}/templates/wpa_supplicant.conf.erb +1 -1
- data/pi_build_modifier/lib/pi_build_modifier/{config → utils}/logex.rb +5 -1
- data/pi_build_modifier/lib/pi_build_modifier/version.rb +1 -1
- data/pi_build_modifier/spec/pi_build_modifier/modify/modify_spec.rb +306 -0
- data/pi_build_modifier/spec/pi_build_modifier_spec.rb +3 -3
- data/pi_build_modifier/spec/spec_helper.rb +1 -0
- data/pi_customizer/Gemfile.lock +47 -0
- data/pi_customizer/lib/pi_customizer.rb +15 -9
- data/pi_customizer/lib/pi_customizer/build/builder/build_executor.rb +12 -24
- data/pi_customizer/lib/pi_customizer/build/builder/builder.rb +17 -13
- data/pi_customizer/{spec/pi_customizer/environment/environment_builder_factory_spec.rb → lib/pi_customizer/build/config/build_config.rb} +27 -18
- data/pi_customizer/lib/pi_customizer/build/{workspace → config}/local_workspace.rb +8 -8
- data/pi_customizer/lib/pi_customizer/build/{workspace → config}/remote_workspace.rb +1 -1
- data/pi_customizer/lib/pi_customizer/build/environment/docker/docker.rb +1 -1
- data/pi_customizer/lib/pi_customizer/build/environment/environment.rb +1 -1
- data/pi_customizer/lib/pi_customizer/build/{builder/start_prepare_execute_builder.rb → environment/environment_factory.rb} +27 -16
- data/pi_customizer/lib/pi_customizer/build/environment/vagrant/templates/Vagrantfile.erb +2 -2
- data/pi_customizer/lib/pi_customizer/build/environment/vagrant/vagrant.rb +3 -8
- data/pi_customizer/lib/pi_customizer/build/environment/vagrant/vagrant_file.rb +3 -3
- data/pi_customizer/lib/pi_customizer/version.rb +1 -1
- data/pi_customizer/lib/pi_customizer/write/image_writer.rb +3 -2
- data/pi_customizer/spec/pi_customizer/build/builder/builder_spec.rb +122 -0
- data/pi_customizer/spec/pi_customizer/{environment/aws_spec.rb → build/config/build_config_spec.rb} +20 -25
- data/pi_customizer/spec/pi_customizer/{workspace/local_workspace_spec.rb → build/config/local_workspace_config_spec.rb} +10 -10
- data/pi_customizer/spec/pi_customizer/{workspace → build/config}/remote_workspace_spec.rb +2 -2
- data/pi_customizer/spec/pi_customizer/{environment/vagrant/vagrant_spec.rb → build/environment/environment_builder_factory_spec.rb} +17 -13
- data/pi_customizer/spec/pi_customizer/{environment → build/environment}/environment_spec.rb +1 -1
- data/pi_customizer/spec/pi_customizer/{environment → build/environment}/vagrant/vagrant_file_spec.rb +7 -7
- data/pi_customizer/spec/pi_customizer/build/environment/vagrant/vagrant_spec.rb +80 -0
- data/pi_customizer/spec/pi_customizer_spec.rb +19 -14
- data/pi_customizer/spec/spec_helper.rb +21 -0
- data/version.rb +1 -1
- metadata +23 -42
- data/Vagrantfile +0 -27
- data/pi_build_modifier/.gitignore +0 -12
- data/pi_build_modifier/lib/pi_build_modifier/boot-files/boot.rb +0 -64
- data/pi_build_modifier/lib/pi_build_modifier/locale/locale_debconf.rb +0 -66
- data/pi_build_modifier/lib/pi_build_modifier/modifier/erb_mapper.rb +0 -72
- data/pi_build_modifier/lib/pi_build_modifier/modifier/mapper.rb +0 -49
- data/pi_build_modifier/lib/pi_build_modifier/modifier/pi_modifier.rb +0 -81
- data/pi_build_modifier/lib/pi_build_modifier/modifier_task.rb +0 -79
- data/pi_build_modifier/lib/pi_build_modifier/net-tweaks/wifi_network.rb +0 -124
- data/pi_build_modifier/lib/pi_build_modifier/sys_tweaks/run_modifier.rb +0 -63
- data/pi_build_modifier/lib/pi_build_modifier/sys_tweaks/ssh.rb +0 -61
- data/pi_build_modifier/lib/pi_build_modifier/sys_tweaks/templates/ssh.sh.erb +0 -8
- data/pi_build_modifier/lib/pi_build_modifier/system/system_type.rb +0 -84
- data/pi_build_modifier/spec/pi_build_modifier/boot/boot_spec.rb +0 -103
- data/pi_build_modifier/spec/pi_build_modifier/locale/locale_spec.rb +0 -87
- data/pi_build_modifier/spec/pi_build_modifier/modifier/mapper_spec.rb +0 -105
- data/pi_build_modifier/spec/pi_build_modifier/modifier/modifier_spec.rb +0 -83
- data/pi_build_modifier/spec/pi_build_modifier/modifier_task_spec.rb +0 -63
- data/pi_build_modifier/spec/pi_build_modifier/net-tweaks/wifi_network_spec.rb +0 -91
- data/pi_build_modifier/spec/pi_build_modifier/sys_tweaks/run_modifier_spec.rb +0 -74
- data/pi_build_modifier/spec/pi_build_modifier/sys_tweaks/ssh_spec.rb +0 -73
- data/pi_build_modifier/spec/pi_build_modifier/system/system_spec.rb +0 -66
- data/pi_customizer/lib/pi_customizer/build/builder/prepare_start_execute_builder.rb +0 -43
- data/pi_customizer/lib/pi_customizer/build/environment/aws/aws.rb +0 -76
- data/pi_customizer/lib/pi_customizer/build/environment/environment_builder_factory.rb +0 -81
- data/pi_customizer/spec/pi_customizer/builder/build_executor_spec.rb +0 -64
@@ -0,0 +1,80 @@
|
|
1
|
+
# Copyright (c) 2017-2019 Beate Ottenwälder
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
21
|
+
require_relative '../../../../spec_helper'
|
22
|
+
require 'fileutils'
|
23
|
+
require 'pathname'
|
24
|
+
require 'pi_customizer/build/config/remote_workspace'
|
25
|
+
require 'pi_customizer/build/config/local_workspace'
|
26
|
+
require 'pi_customizer/build/environment/vagrant/vagrant'
|
27
|
+
|
28
|
+
RSpec.describe PiCustomizer::Environment::Vagrant do
|
29
|
+
|
30
|
+
let(:tmp_dir) {'tmp'}
|
31
|
+
let(:vagrant_env) {PiCustomizer::Environment::Vagrant.new(PiCustomizer::Workspace::RemoteWorkspace.new,
|
32
|
+
PiCustomizer::Workspace::LocalWorkspaceConfig.new(
|
33
|
+
workspace_dir = tmp_dir))}
|
34
|
+
|
35
|
+
after(:each) do
|
36
|
+
FileUtils.mkdir_p tmp_dir
|
37
|
+
end
|
38
|
+
|
39
|
+
after(:each) do
|
40
|
+
FileUtils.rm_rf tmp_dir
|
41
|
+
end
|
42
|
+
|
43
|
+
context '#check' do
|
44
|
+
it 'checks for the existence of vagrant' do
|
45
|
+
expect(vagrant_env).to receive(:system).with('vagrant -v').and_return(true)
|
46
|
+
vagrant_env.check
|
47
|
+
end
|
48
|
+
it 'checks for the existence of vagrant' do
|
49
|
+
expect(vagrant_env).to receive(:system).with('vagrant -v').and_return(false)
|
50
|
+
expect {vagrant_env.check}.to raise_error
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
context '#prepare' do
|
55
|
+
it 'updates the vagrant box' do
|
56
|
+
expect(vagrant_env).to receive(:system).with('vagrant box update')
|
57
|
+
vagrant_env.prepare
|
58
|
+
end
|
59
|
+
it 'renders a vagrant file' do
|
60
|
+
allow(vagrant_env).to receive(:system)
|
61
|
+
vagrant_env.prepare
|
62
|
+
expect(Pathname.new(File.join(tmp_dir, 'Vagrantfile'))).to be_file
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context '#build_image' do
|
67
|
+
it 'starts provisioning' do
|
68
|
+
expect(vagrant_env).to receive(:system).with('vagrant provision')
|
69
|
+
vagrant_env.build_image
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context '#stop' do
|
74
|
+
it 'stops and cleans up' do
|
75
|
+
expect(vagrant_env).to receive(:system).with('vagrant destroy -f')
|
76
|
+
vagrant_env.stop
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
@@ -20,53 +20,53 @@
|
|
20
20
|
|
21
21
|
require_relative 'spec_helper'
|
22
22
|
require 'fileutils'
|
23
|
-
require 'rspec'
|
24
23
|
require 'pi_customizer'
|
25
24
|
require 'pi_customizer/utils/logex'
|
26
25
|
require 'pi_customizer/version'
|
27
|
-
require 'pi_customizer/build/
|
26
|
+
require 'pi_customizer/build/config/local_workspace'
|
27
|
+
require 'pi_customizer/build/environment/environment_factory'
|
28
28
|
require 'pi_customizer/utils/logex'
|
29
29
|
|
30
30
|
|
31
31
|
describe PiCustomizer::PiCustomizer do
|
32
32
|
|
33
|
-
context 'build' do
|
33
|
+
context '#build' do
|
34
34
|
it 'starts a build when the command line parameter \'build\' is passed' do
|
35
|
-
|
35
|
+
expect_any_instance_of(PiCustomizer::Builder::PiBuilder).to receive(:build).with(anything, anything)
|
36
36
|
PiCustomizer::PiCustomizer.start(%w(build ECHO -c tst))
|
37
37
|
end
|
38
38
|
it 'reads the modifier_gem_path parameter' do
|
39
|
-
expect(PiCustomizer::Environment).to receive(:
|
39
|
+
expect(PiCustomizer::Environment).to receive(:environment_factory).with(PiCustomizer::Environment::ENV_ECHO, PiCustomizer::Workspace::LocalWorkspaceConfig.new('cfg', '', 'mod'), anything)
|
40
40
|
PiCustomizer::PiCustomizer.start(%w(build ECHO --modifier_gem=mod --config_file=cfg))
|
41
41
|
end
|
42
42
|
it 'reads the local_workspace_dir parameter' do
|
43
|
-
expect(PiCustomizer::Environment).to receive(:
|
43
|
+
expect(PiCustomizer::Environment).to receive(:environment_factory).with(PiCustomizer::Environment::ENV_ECHO, PiCustomizer::Workspace::LocalWorkspaceConfig.new('cfg', 'tmp', ''), anything)
|
44
44
|
PiCustomizer::PiCustomizer.start(%w(build ECHO --local_workspace_dir=tmp --config_file=cfg))
|
45
45
|
end
|
46
46
|
it 'reads the config_path parameter' do
|
47
|
-
expect(PiCustomizer::Environment).to receive(:
|
47
|
+
expect(PiCustomizer::Environment).to receive(:environment_factory).with(PiCustomizer::Environment::ENV_ECHO, PiCustomizer::Workspace::LocalWorkspaceConfig.new('cfg', '', ''), anything)
|
48
48
|
PiCustomizer::PiCustomizer.start(%w(build ECHO --config_file=cfg))
|
49
49
|
end
|
50
50
|
it 'reads the remote_workspace_dir parameter' do
|
51
|
-
expect(PiCustomizer::Environment).to receive(:
|
51
|
+
expect(PiCustomizer::Environment).to receive(:environment_factory).with(PiCustomizer::Environment::ENV_ECHO, anything, PiCustomizer::Workspace::RemoteWorkspace.new('rdir', ''))
|
52
52
|
PiCustomizer::PiCustomizer.start(%w(build ECHO --remote_workspace_dir=rdir -c tst))
|
53
53
|
end
|
54
54
|
it 'reads the build_sources_git_url parameter' do
|
55
|
-
expect(PiCustomizer::Environment).to receive(:
|
55
|
+
expect(PiCustomizer::Environment).to receive(:environment_factory).with(PiCustomizer::Environment::ENV_ECHO, anything, PiCustomizer::Workspace::RemoteWorkspace.new('', 'git'))
|
56
56
|
PiCustomizer::PiCustomizer.start(%w(build ECHO --build_sources_git_url=git -c tst))
|
57
57
|
end
|
58
58
|
it 'logs unexpected errors' do
|
59
|
-
expect($logger).to receive(:error).with(anything
|
60
|
-
allow(PiCustomizer::Environment).to receive(:
|
59
|
+
expect($logger).to receive(:error).with(anything)
|
60
|
+
allow(PiCustomizer::Environment).to receive(:environment_factory).and_throw('test throw')
|
61
61
|
PiCustomizer::PiCustomizer.start(%w(build NONE -c "tst"))
|
62
62
|
end
|
63
63
|
it 'does not start if no config is provided' do
|
64
|
-
expect(STDERR).to receive(:puts).with(anything
|
64
|
+
expect(STDERR).to receive(:puts).with(anything)
|
65
65
|
PiCustomizer::PiCustomizer.start(%w(build ECHO))
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
context '
|
69
|
+
context '#version' do
|
70
70
|
it 'returns the app\'s version' do
|
71
71
|
expect(STDOUT).to receive(:puts).with(PiCustomizer::VERSION)
|
72
72
|
PiCustomizer::PiCustomizer.start(%w(v))
|
@@ -80,7 +80,7 @@ describe PiCustomizer::PiCustomizer do
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
context 'write' do
|
83
|
+
context '#write' do
|
84
84
|
it 'triggers the write of a given image to a given device' do
|
85
85
|
allow(PiCustomizer::ImageWriter).to receive(:dispatch_write)
|
86
86
|
expected_img = 'test.img'
|
@@ -88,6 +88,11 @@ describe PiCustomizer::PiCustomizer do
|
|
88
88
|
expect_any_instance_of(PiCustomizer::ImageWriter).to receive(:write).with(expected_img, expected_dev)
|
89
89
|
PiCustomizer::PiCustomizer.start(['write', "#{expected_img}", "#{expected_dev}"])
|
90
90
|
end
|
91
|
+
it 'logs unexpected errors' do
|
92
|
+
expect($logger).to receive(:error).with(anything)
|
93
|
+
allow(PiCustomizer::ImageWriter).to receive(:write).and_throw('test throw')
|
94
|
+
PiCustomizer::PiCustomizer.start(%w'write img dev')
|
95
|
+
end
|
91
96
|
end
|
92
97
|
|
93
98
|
end
|
@@ -1,4 +1,25 @@
|
|
1
|
+
# Copyright (c) 2017-2019 Beate Ottenwälder
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in all
|
11
|
+
# copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
# SOFTWARE.
|
20
|
+
|
1
21
|
require 'simplecov'
|
22
|
+
require 'rspec'
|
2
23
|
#require 'codecov'
|
3
24
|
|
4
25
|
SimpleCov.start do
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pi_build_modifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0.pre.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Beate Ottenwälder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -134,48 +134,31 @@ files:
|
|
134
134
|
- LICENSE
|
135
135
|
- README.md
|
136
136
|
- Rakefile
|
137
|
-
- Vagrantfile
|
138
137
|
- docs/concept.md
|
139
138
|
- docs/incubation.md
|
140
|
-
- pi_build_modifier/.gitignore
|
141
139
|
- pi_build_modifier/.rspec
|
142
140
|
- pi_build_modifier/Gemfile
|
141
|
+
- pi_build_modifier/Gemfile.lock
|
143
142
|
- pi_build_modifier/LICENSE.txt
|
144
143
|
- pi_build_modifier/README.md
|
145
144
|
- pi_build_modifier/Rakefile
|
146
145
|
- pi_build_modifier/bin/pi_build_modifier
|
147
146
|
- pi_build_modifier/lib/pi_build_modifier.rb
|
148
|
-
- pi_build_modifier/lib/pi_build_modifier/
|
149
|
-
- pi_build_modifier/lib/pi_build_modifier/
|
150
|
-
- pi_build_modifier/lib/pi_build_modifier/
|
151
|
-
- pi_build_modifier/lib/pi_build_modifier/
|
152
|
-
- pi_build_modifier/lib/pi_build_modifier/
|
153
|
-
- pi_build_modifier/lib/pi_build_modifier/
|
154
|
-
- pi_build_modifier/lib/pi_build_modifier/modifier/mapper.rb
|
155
|
-
- pi_build_modifier/lib/pi_build_modifier/modifier/pi_modifier.rb
|
156
|
-
- pi_build_modifier/lib/pi_build_modifier/modifier_task.rb
|
157
|
-
- pi_build_modifier/lib/pi_build_modifier/net-tweaks/templates/wpa_supplicant.conf.erb
|
158
|
-
- pi_build_modifier/lib/pi_build_modifier/net-tweaks/wifi_network.rb
|
159
|
-
- pi_build_modifier/lib/pi_build_modifier/sys_tweaks/run_modifier.rb
|
160
|
-
- pi_build_modifier/lib/pi_build_modifier/sys_tweaks/ssh.rb
|
161
|
-
- pi_build_modifier/lib/pi_build_modifier/sys_tweaks/templates/ssh.sh.erb
|
162
|
-
- pi_build_modifier/lib/pi_build_modifier/system/system_type.rb
|
147
|
+
- pi_build_modifier/lib/pi_build_modifier/modify/configs.rb
|
148
|
+
- pi_build_modifier/lib/pi_build_modifier/modify/modifiers.rb
|
149
|
+
- pi_build_modifier/lib/pi_build_modifier/modify/templates/00-debconf.erb
|
150
|
+
- pi_build_modifier/lib/pi_build_modifier/modify/templates/07-resize-init.diff.erb
|
151
|
+
- pi_build_modifier/lib/pi_build_modifier/modify/templates/wpa_supplicant.conf.erb
|
152
|
+
- pi_build_modifier/lib/pi_build_modifier/utils/logex.rb
|
163
153
|
- pi_build_modifier/lib/pi_build_modifier/version.rb
|
164
154
|
- pi_build_modifier/pi_build_modifier.gemspec
|
165
155
|
- pi_build_modifier/spec/fixtures/config.json
|
166
|
-
- pi_build_modifier/spec/pi_build_modifier/
|
167
|
-
- pi_build_modifier/spec/pi_build_modifier/locale/locale_spec.rb
|
168
|
-
- pi_build_modifier/spec/pi_build_modifier/modifier/mapper_spec.rb
|
169
|
-
- pi_build_modifier/spec/pi_build_modifier/modifier/modifier_spec.rb
|
170
|
-
- pi_build_modifier/spec/pi_build_modifier/modifier_task_spec.rb
|
171
|
-
- pi_build_modifier/spec/pi_build_modifier/net-tweaks/wifi_network_spec.rb
|
172
|
-
- pi_build_modifier/spec/pi_build_modifier/sys_tweaks/run_modifier_spec.rb
|
173
|
-
- pi_build_modifier/spec/pi_build_modifier/sys_tweaks/ssh_spec.rb
|
174
|
-
- pi_build_modifier/spec/pi_build_modifier/system/system_spec.rb
|
156
|
+
- pi_build_modifier/spec/pi_build_modifier/modify/modify_spec.rb
|
175
157
|
- pi_build_modifier/spec/pi_build_modifier_spec.rb
|
176
158
|
- pi_build_modifier/spec/spec_helper.rb
|
177
159
|
- pi_customizer/.rspec
|
178
160
|
- pi_customizer/Gemfile
|
161
|
+
- pi_customizer/Gemfile.lock
|
179
162
|
- pi_customizer/LICENSE
|
180
163
|
- pi_customizer/README.md
|
181
164
|
- pi_customizer/Rakefile
|
@@ -189,17 +172,15 @@ files:
|
|
189
172
|
- pi_customizer/lib/pi_customizer.rb
|
190
173
|
- pi_customizer/lib/pi_customizer/build/builder/build_executor.rb
|
191
174
|
- pi_customizer/lib/pi_customizer/build/builder/builder.rb
|
192
|
-
- pi_customizer/lib/pi_customizer/build/
|
193
|
-
- pi_customizer/lib/pi_customizer/build/
|
194
|
-
- pi_customizer/lib/pi_customizer/build/
|
175
|
+
- pi_customizer/lib/pi_customizer/build/config/build_config.rb
|
176
|
+
- pi_customizer/lib/pi_customizer/build/config/local_workspace.rb
|
177
|
+
- pi_customizer/lib/pi_customizer/build/config/remote_workspace.rb
|
195
178
|
- pi_customizer/lib/pi_customizer/build/environment/docker/docker.rb
|
196
179
|
- pi_customizer/lib/pi_customizer/build/environment/environment.rb
|
197
|
-
- pi_customizer/lib/pi_customizer/build/environment/
|
180
|
+
- pi_customizer/lib/pi_customizer/build/environment/environment_factory.rb
|
198
181
|
- pi_customizer/lib/pi_customizer/build/environment/vagrant/templates/Vagrantfile.erb
|
199
182
|
- pi_customizer/lib/pi_customizer/build/environment/vagrant/vagrant.rb
|
200
183
|
- pi_customizer/lib/pi_customizer/build/environment/vagrant/vagrant_file.rb
|
201
|
-
- pi_customizer/lib/pi_customizer/build/workspace/local_workspace.rb
|
202
|
-
- pi_customizer/lib/pi_customizer/build/workspace/remote_workspace.rb
|
203
184
|
- pi_customizer/lib/pi_customizer/utils/logex.rb
|
204
185
|
- pi_customizer/lib/pi_customizer/version.rb
|
205
186
|
- pi_customizer/lib/pi_customizer/write/image_writer.rb
|
@@ -207,15 +188,15 @@ files:
|
|
207
188
|
- pi_customizer/spec/fixtures/TestVagrantfile
|
208
189
|
- pi_customizer/spec/fixtures/image.img
|
209
190
|
- pi_customizer/spec/fixtures/image.zip
|
210
|
-
- pi_customizer/spec/pi_customizer/builder/
|
211
|
-
- pi_customizer/spec/pi_customizer/
|
212
|
-
- pi_customizer/spec/pi_customizer/
|
213
|
-
- pi_customizer/spec/pi_customizer/
|
214
|
-
- pi_customizer/spec/pi_customizer/environment/
|
215
|
-
- pi_customizer/spec/pi_customizer/environment/
|
191
|
+
- pi_customizer/spec/pi_customizer/build/builder/builder_spec.rb
|
192
|
+
- pi_customizer/spec/pi_customizer/build/config/build_config_spec.rb
|
193
|
+
- pi_customizer/spec/pi_customizer/build/config/local_workspace_config_spec.rb
|
194
|
+
- pi_customizer/spec/pi_customizer/build/config/remote_workspace_spec.rb
|
195
|
+
- pi_customizer/spec/pi_customizer/build/environment/environment_builder_factory_spec.rb
|
196
|
+
- pi_customizer/spec/pi_customizer/build/environment/environment_spec.rb
|
197
|
+
- pi_customizer/spec/pi_customizer/build/environment/vagrant/vagrant_file_spec.rb
|
198
|
+
- pi_customizer/spec/pi_customizer/build/environment/vagrant/vagrant_spec.rb
|
216
199
|
- pi_customizer/spec/pi_customizer/version_spec.rb
|
217
|
-
- pi_customizer/spec/pi_customizer/workspace/local_workspace_spec.rb
|
218
|
-
- pi_customizer/spec/pi_customizer/workspace/remote_workspace_spec.rb
|
219
200
|
- pi_customizer/spec/pi_customizer/write/image_writer_spec.rb
|
220
201
|
- pi_customizer/spec/pi_customizer_spec.rb
|
221
202
|
- pi_customizer/spec/spec_helper.rb
|
data/Vagrantfile
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
# -*- mode: ruby -*-
|
2
|
-
# vi: set ft=ruby :
|
3
|
-
|
4
|
-
# Vagrantbox to execute unit tests in a clean environment
|
5
|
-
|
6
|
-
Vagrant.configure('2') do |config|
|
7
|
-
|
8
|
-
config.vm.box = "ubuntu/xenial64"
|
9
|
-
|
10
|
-
config.vm.provision 'shell', inline: <<-SHELL
|
11
|
-
sudo apt update
|
12
|
-
sudo apt -y upgrade
|
13
|
-
sudo apt -y install build-essential ruby-full
|
14
|
-
|
15
|
-
gem install bundler
|
16
|
-
|
17
|
-
cd /vagrant/pi_customizer
|
18
|
-
bundle install
|
19
|
-
|
20
|
-
cd /vagrant/pi_build_modifier
|
21
|
-
bundle install
|
22
|
-
|
23
|
-
cd /vagrant
|
24
|
-
|
25
|
-
rake spec
|
26
|
-
SHELL
|
27
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
# Copyright (c) 2017-2019 Beate Ottenwälder
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
# of this software and associated documentation files (the "Software"), to deal
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
11
|
-
# copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
-
# SOFTWARE.
|
20
|
-
|
21
|
-
require 'erb'
|
22
|
-
require 'json'
|
23
|
-
|
24
|
-
module PiBuildModifier
|
25
|
-
|
26
|
-
##
|
27
|
-
# The Locale class is used to customize locales
|
28
|
-
|
29
|
-
class Boot
|
30
|
-
|
31
|
-
C_GROUPS = 'cgroups'
|
32
|
-
|
33
|
-
C_GROUP_MEMORY = 'memory'
|
34
|
-
|
35
|
-
attr_accessor :c_groups
|
36
|
-
|
37
|
-
attr_reader :template_path, :relative_output_path
|
38
|
-
|
39
|
-
def initialize(c_groups = [''])
|
40
|
-
@c_groups = c_groups
|
41
|
-
@template_path = File.join(File.dirname(__FILE__), '/templates/07-resize-init.diff.erb').to_s
|
42
|
-
@relative_output_path = 'stage2/01-sys-tweaks/00-patches/07-resize-init.diff'
|
43
|
-
end
|
44
|
-
|
45
|
-
def mapper(workspace)
|
46
|
-
ERBMapper.new(self,workspace)
|
47
|
-
end
|
48
|
-
|
49
|
-
def map(json_data)
|
50
|
-
unless json_data.nil? || !json_data.has_key?(C_GROUPS)
|
51
|
-
if json_data[C_GROUPS].has_key?(C_GROUP_MEMORY) && json_data[C_GROUPS][C_GROUP_MEMORY]
|
52
|
-
@c_groups << 'cgroup_enable=memory cgroup_memory=1 swapaccount=1'
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def get_binding
|
58
|
-
binding
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
|
@@ -1,66 +0,0 @@
|
|
1
|
-
# Copyright (c) 2017-2019 Beate Ottenwälder
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
# of this software and associated documentation files (the "Software"), to deal
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
11
|
-
# copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
-
# SOFTWARE.
|
20
|
-
|
21
|
-
require 'erb'
|
22
|
-
require 'json'
|
23
|
-
|
24
|
-
module PiBuildModifier
|
25
|
-
|
26
|
-
##
|
27
|
-
# The Locale class is used to customize the locales
|
28
|
-
|
29
|
-
class Locale
|
30
|
-
|
31
|
-
LOCALE = 'locale'
|
32
|
-
|
33
|
-
GEN = 'gen'
|
34
|
-
|
35
|
-
SYS = 'sys'
|
36
|
-
|
37
|
-
attr_accessor :gen_locales, :sys_locales, :template
|
38
|
-
|
39
|
-
attr_reader :template_path, :relative_output_path
|
40
|
-
|
41
|
-
def initialize(gen_locales = ['en_GB.UTF-8 UTF-8'], sys_locale = 'en_GB.UTF-8')
|
42
|
-
@gen_locales = gen_locales
|
43
|
-
@sys_locale = sys_locale
|
44
|
-
@template_path = File.join(File.dirname(__FILE__), '/templates/00-debconf.erb').to_s
|
45
|
-
@relative_output_path = 'stage0/01-locale/00-debconf'
|
46
|
-
end
|
47
|
-
|
48
|
-
def mapper(workspace)
|
49
|
-
ERBMapper.new(self,workspace)
|
50
|
-
end
|
51
|
-
|
52
|
-
def map(json_data)
|
53
|
-
unless json_data.nil?
|
54
|
-
@gen_locales = json_data[LOCALE][GEN].map {|gen| gen} if json_data.has_key?(LOCALE) && json_data[LOCALE].has_key?(GEN)
|
55
|
-
@sys_locale = json_data[LOCALE][SYS] if json_data.has_key?(LOCALE) && json_data[LOCALE].has_key?(SYS)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def get_binding
|
60
|
-
binding
|
61
|
-
end
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
end
|
66
|
-
|