pi_customizer 0.3.0.pre.alpha → 0.3.1.pre.alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +24 -0
- data/.travis.yml +28 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/LICENSE +1 -1
- data/README.md +208 -2
- data/Rakefile +134 -6
- data/Vagrantfile +13 -2
- data/docs/concept.md +27 -0
- data/docs/incubation.md +38 -0
- data/pi_build_modifier/.gitignore +12 -0
- data/{.rspec → pi_build_modifier/.rspec} +0 -0
- data/pi_build_modifier/Gemfile +6 -0
- data/pi_build_modifier/LICENSE.txt +21 -0
- data/pi_build_modifier/README.md +3 -0
- data/pi_build_modifier/Rakefile +13 -0
- data/pi_build_modifier/bin/pi_build_modifier +25 -0
- data/pi_build_modifier/lib/pi_build_modifier.rb +53 -0
- data/pi_build_modifier/lib/pi_build_modifier/boot-files/boot.rb +64 -0
- data/pi_build_modifier/lib/pi_build_modifier/boot-files/templates/07-resize-init.diff.erb +5 -0
- data/pi_build_modifier/lib/pi_build_modifier/config/logex.rb +25 -0
- data/pi_build_modifier/lib/pi_build_modifier/locale/locale_debconf.rb +66 -0
- data/pi_build_modifier/lib/pi_build_modifier/locale/templates/00-debconf.erb +6 -0
- data/pi_build_modifier/lib/pi_build_modifier/modifier/erb_mapper.rb +72 -0
- data/pi_build_modifier/lib/pi_build_modifier/modifier/mapper.rb +49 -0
- data/pi_build_modifier/lib/pi_build_modifier/modifier/pi_modifier.rb +81 -0
- data/pi_build_modifier/lib/pi_build_modifier/modifier_task.rb +79 -0
- data/pi_build_modifier/lib/pi_build_modifier/net-tweaks/templates/wpa_supplicant.conf.erb +5 -0
- data/pi_build_modifier/lib/pi_build_modifier/net-tweaks/wifi_network.rb +124 -0
- data/pi_build_modifier/lib/pi_build_modifier/sys_tweaks/run_modifier.rb +63 -0
- data/pi_build_modifier/lib/pi_build_modifier/sys_tweaks/ssh.rb +61 -0
- data/pi_build_modifier/lib/pi_build_modifier/sys_tweaks/templates/ssh.sh.erb +8 -0
- data/pi_build_modifier/lib/pi_build_modifier/system/system_type.rb +84 -0
- data/pi_build_modifier/lib/pi_build_modifier/version.rb +23 -0
- data/pi_build_modifier/pi_build_modifier.gemspec +32 -0
- data/pi_build_modifier/spec/fixtures/config.json +26 -0
- data/pi_build_modifier/spec/pi_build_modifier/boot/boot_spec.rb +103 -0
- data/pi_build_modifier/spec/pi_build_modifier/locale/locale_spec.rb +87 -0
- data/pi_build_modifier/spec/pi_build_modifier/modifier/mapper_spec.rb +105 -0
- data/pi_build_modifier/spec/pi_build_modifier/modifier/modifier_spec.rb +83 -0
- data/pi_build_modifier/spec/pi_build_modifier/modifier_task_spec.rb +63 -0
- data/pi_build_modifier/spec/pi_build_modifier/net-tweaks/wifi_network_spec.rb +91 -0
- data/pi_build_modifier/spec/pi_build_modifier/sys_tweaks/run_modifier_spec.rb +74 -0
- data/pi_build_modifier/spec/pi_build_modifier/sys_tweaks/ssh_spec.rb +73 -0
- data/pi_build_modifier/spec/pi_build_modifier/system/system_spec.rb +66 -0
- data/pi_build_modifier/spec/pi_build_modifier_spec.rb +73 -0
- data/pi_build_modifier/spec/spec_helper.rb +10 -0
- data/pi_customizer/.rspec +2 -0
- data/{Gemfile → pi_customizer/Gemfile} +0 -0
- data/pi_customizer/LICENSE +21 -0
- data/pi_customizer/README.md +3 -0
- data/pi_customizer/Rakefile +13 -0
- data/pi_customizer/Vagrantfile +16 -0
- data/{bin → pi_customizer/bin}/pi_customizer +1 -1
- data/{envs → pi_customizer/envs}/aws/outputs.tf +0 -0
- data/{envs → pi_customizer/envs}/aws/pi-build-env.tf +0 -0
- data/{envs → pi_customizer/envs}/aws/variables.tf +0 -0
- data/{envs → pi_customizer/envs}/docker/Dockerfile +0 -0
- data/{envs → pi_customizer/envs}/sh/build-pi-img.sh +0 -0
- data/{lib → pi_customizer/lib}/pi_customizer.rb +7 -6
- data/{lib → pi_customizer/lib}/pi_customizer/build/builder/build_executor.rb +31 -2
- data/{lib → pi_customizer/lib}/pi_customizer/build/builder/builder.rb +4 -2
- data/{lib → pi_customizer/lib}/pi_customizer/build/builder/prepare_start_execute_builder.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/build/builder/start_prepare_execute_builder.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/build/environment/aws/aws.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/build/environment/docker/docker.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/build/environment/environment.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/build/environment/environment_builder_factory.rb +9 -3
- data/{lib → pi_customizer/lib}/pi_customizer/build/environment/vagrant/templates/Vagrantfile.erb +3 -7
- data/{lib → pi_customizer/lib}/pi_customizer/build/environment/vagrant/vagrant.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/build/environment/vagrant/vagrant_file.rb +2 -2
- data/{lib → pi_customizer/lib}/pi_customizer/build/workspace/local_workspace.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/build/workspace/remote_workspace.rb +14 -4
- data/{lib → pi_customizer/lib}/pi_customizer/utils/logex.rb +1 -1
- data/{lib → pi_customizer/lib}/pi_customizer/version.rb +2 -2
- data/{lib → pi_customizer/lib}/pi_customizer/write/image_writer.rb +1 -1
- data/{pi_customizer.gemspec → pi_customizer/pi_customizer.gemspec} +5 -5
- data/pi_customizer/spec/fixtures/TestVagrantfile +61 -0
- data/pi_customizer/spec/fixtures/image.img +1 -0
- data/pi_customizer/spec/fixtures/image.zip +0 -0
- data/pi_customizer/spec/pi_customizer/builder/build_executor_spec.rb +64 -0
- data/pi_customizer/spec/pi_customizer/environment/aws_spec.rb +57 -0
- data/pi_customizer/spec/pi_customizer/environment/environment_builder_factory_spec.rb +48 -0
- data/pi_customizer/spec/pi_customizer/environment/environment_spec.rb +75 -0
- data/pi_customizer/spec/pi_customizer/environment/vagrant/vagrant_file_spec.rb +63 -0
- data/pi_customizer/spec/pi_customizer/environment/vagrant/vagrant_spec.rb +41 -0
- data/pi_customizer/spec/pi_customizer/version_spec.rb +29 -0
- data/pi_customizer/spec/pi_customizer/workspace/local_workspace_spec.rb +74 -0
- data/pi_customizer/spec/pi_customizer/workspace/remote_workspace_spec.rb +51 -0
- data/pi_customizer/spec/pi_customizer/write/image_writer_spec.rb +59 -0
- data/pi_customizer/spec/pi_customizer_spec.rb +93 -0
- data/pi_customizer/spec/spec_helper.rb +10 -0
- data/version.rb +21 -0
- metadata +102 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f6d39d92c9687e995afff15c67c0052350c762117c6228bb69e56fb31b3806d
|
4
|
+
data.tar.gz: 2471722c474661111d0b1cc2ccc2fe8a5780fec56f7d0b47cc271c0c09744f93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40de09bc5b2855e944fd93adb50f26039a5c590261a8ddfcf5f7d18193ca5fff3d643b0f5c07af0df698bf009597689b36854910a35b5ce2d3975802157cf3ae
|
7
|
+
data.tar.gz: d9b3deb83f0f517419ec16a0656ce1e23b5d2d64df6c131c5d1f06917d82b5eb09e689ae07f5e09bee2459c6b543ced5861f5c98b3011e08ba54d7db805e2e97
|
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# Compiled files
|
2
|
+
*.tfstate
|
3
|
+
*.tfstate.backup
|
4
|
+
*.tfvars
|
5
|
+
|
6
|
+
# Module directory
|
7
|
+
.terraform/
|
8
|
+
.idea/
|
9
|
+
|
10
|
+
# Project files and direcotires
|
11
|
+
*iml
|
12
|
+
ssh/
|
13
|
+
|
14
|
+
*.conf
|
15
|
+
wpa_supplicant.json
|
16
|
+
.vagrant/
|
17
|
+
Gemfile.lock
|
18
|
+
*gem
|
19
|
+
|
20
|
+
cid
|
21
|
+
coverage/
|
22
|
+
tmp/
|
23
|
+
*.log
|
24
|
+
doc/
|
data/.travis.yml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.6.3
|
4
|
+
- 2.5.5
|
5
|
+
- 2.4.6
|
6
|
+
before_script:
|
7
|
+
- gem install bundler
|
8
|
+
- cd pi_customizer/ && bundle install && cd ..
|
9
|
+
- cd pi_build_modifier/ && bundle install && cd ..
|
10
|
+
script:
|
11
|
+
- rake spec
|
12
|
+
deploy:
|
13
|
+
- provider: rubygems
|
14
|
+
gem: pi_customizer
|
15
|
+
gemspec: pi_customizer/pi_customizer.gemspec
|
16
|
+
on:
|
17
|
+
branch: development
|
18
|
+
ruby: 2.6.3
|
19
|
+
api_key:
|
20
|
+
secure: V2bkBW+4UT/8Pt+MK6XZwDL5dPF3bkTL1RevI3UCIGmHSoKPPT918DpXhfVg6cRdOhMyYTbTjkQIyP9LEW5Uy8Nozp15kKa2nZbWIuDIIhUPopuymSW1x+g7c7VBU7nU7KL2XsYKwY2+PGp5WUycsWrKyM0U/4tn5wKK4u8lHz6fjmsIldl2/6nEsN23voat2LoftFzG3bng07v/mREjkiLtMzXnZ/sQ/uvC+4W5h3xJUf+KQ86JwoaBrisms5ETkOt3ox3/J56VFcTHi3QbpSW6MXnuKkiohTRkz1CI7V5jLyNKxJn/ZUSZmmKkCvOC2g9J9KzaTey36Iy+eKo2mYBNj59qrUzxChwpcU2peFhpIYfVx+9vQ2ki6h3FtAuTDQ7civ+s/BLAwTPdA64JoLjkYdIhOzsSN61rxsEQOXOz/mih21cPDADWiPOawvC8w6fW3Vf6Pg9etux9pzTpFr41F45e54ZOg074KpUCwk3vMMfZnyF0UbAR/wW5YjAEMA3VYffyT34uisrsmhHjbk3EhpuHIZeJy5ukOeKC2SDmOY6fIbi+rKGLwExj/okIpxVhhBp/bl59Qk4fNvBM81WbxqiuOGafTNWty5Hz1pLqO/1xllDU9eFEpd0jVcBTAAFvSmzYllBg/7R3BXDJyawmhVQZDFAkqtCQ6VOnOl0=
|
21
|
+
- provider: rubygems
|
22
|
+
gem: pi_build_modifier
|
23
|
+
gemspec: pi_build_modifier/pi_build_modifier.gemspec
|
24
|
+
on:
|
25
|
+
branch: development
|
26
|
+
ruby: 2.6.3
|
27
|
+
api_key:
|
28
|
+
secure: V2bkBW+4UT/8Pt+MK6XZwDL5dPF3bkTL1RevI3UCIGmHSoKPPT918DpXhfVg6cRdOhMyYTbTjkQIyP9LEW5Uy8Nozp15kKa2nZbWIuDIIhUPopuymSW1x+g7c7VBU7nU7KL2XsYKwY2+PGp5WUycsWrKyM0U/4tn5wKK4u8lHz6fjmsIldl2/6nEsN23voat2LoftFzG3bng07v/mREjkiLtMzXnZ/sQ/uvC+4W5h3xJUf+KQ86JwoaBrisms5ETkOt3ox3/J56VFcTHi3QbpSW6MXnuKkiohTRkz1CI7V5jLyNKxJn/ZUSZmmKkCvOC2g9J9KzaTey36Iy+eKo2mYBNj59qrUzxChwpcU2peFhpIYfVx+9vQ2ki6h3FtAuTDQ7civ+s/BLAwTPdA64JoLjkYdIhOzsSN61rxsEQOXOz/mih21cPDADWiPOawvC8w6fW3Vf6Pg9etux9pzTpFr41F45e54ZOg074KpUCwk3vMMfZnyF0UbAR/wW5YjAEMA3VYffyT34uisrsmhHjbk3EhpuHIZeJy5ukOeKC2SDmOY6fIbi+rKGLwExj/okIpxVhhBp/bl59Qk4fNvBM81WbxqiuOGafTNWty5Hz1pLqO/1xllDU9eFEpd0jVcBTAAFvSmzYllBg/7R3BXDJyawmhVQZDFAkqtCQ6VOnOl0=
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at b.ottenwaelder@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,209 @@
|
|
1
|
-
# pi-
|
1
|
+
# pi-customizer
|
2
2
|
|
3
|
-
|
3
|
+
[](https://travis-ci.org/ottenwbe/pi-gen-environment)
|
4
|
+
|
5
|
+
|Gem |Badge |
|
6
|
+
|:-:|:-:|
|
7
|
+
| pi_customizer | [](https://badge.fury.io/rb/pi_customizer) |
|
8
|
+
| pi_build_modifier | [](https://badge.fury.io/rb/pi_build_modifier) |
|
9
|
+
|
10
|
+
|
11
|
+
The _pi_customizer_ allows you to adapt Raspbian images to your needs.
|
12
|
+
To this end, the Raspbian image is be built from [scratch](https://github.com/ottenwbe/pi-gen.git)
|
13
|
+
with all customizations baked into the image.
|
14
|
+
|
15
|
+
The image is built in an isolated [build environment](#environments), e.g.,
|
16
|
+
a vagrant box, which is orchestrated by the pi_customizer.
|
17
|
+
The customization is performed by a Ruby Gem (_pi_build_modifier_) in the build environment by adapting the [pi-gen](https://github.com/RPi-Distro/pi-gen) build scripts.
|
18
|
+
|
19
|
+
|
20
|
+
# WIP Notice
|
21
|
+
|
22
|
+
This project is still under construction and in a pre release phase.
|
23
|
+
|
24
|
+
# Install
|
25
|
+
|
26
|
+
## Prerequisites
|
27
|
+
|
28
|
+
To customize the build process the following prerequisites are expected:
|
29
|
+
* The _pi_customizer_ gem is installed (see the [__Deploy Gem__](#deploy_gem) section for details)
|
30
|
+
* One of the supported build environments is accessible (see the [__Environments__](#environments) section):
|
31
|
+
* Vagrant
|
32
|
+
* Docker (feature is still in development)
|
33
|
+
|
34
|
+
<a name="deploy_gem"></a>
|
35
|
+
## Deploy Gem
|
36
|
+
|
37
|
+
To customize your Raspbian image the pi_customizer gem must be installed on the machine that coordinates the build process.
|
38
|
+
This is typically your local machine.
|
39
|
+
|
40
|
+
1. Install the latest (pre) release. For all prerequisites see the corresponding section.
|
41
|
+
|
42
|
+
```bash
|
43
|
+
gem install pi_customizer --pre
|
44
|
+
```
|
45
|
+
|
46
|
+
1. Verify the installation
|
47
|
+
|
48
|
+
```bash
|
49
|
+
pi_customizer version
|
50
|
+
```
|
51
|
+
<a name="environments"></a>
|
52
|
+
## Environments
|
53
|
+
|
54
|
+
You may choose to build your pi image in a Vagrant box.
|
55
|
+
In the future Docker containers will also be supported.
|
56
|
+
|
57
|
+
### Vagrant
|
58
|
+
|
59
|
+
1. Install Vagrant. For instance, on Fedora:
|
60
|
+
|
61
|
+
```bash
|
62
|
+
sudo dnf install vagrant
|
63
|
+
```
|
64
|
+
|
65
|
+
1. Verify that vagrant is installed
|
66
|
+
|
67
|
+
```
|
68
|
+
vagrant -v
|
69
|
+
```
|
70
|
+
|
71
|
+
1. Install the `vagrant-disksize` plugin
|
72
|
+
|
73
|
+
```
|
74
|
+
vagrant plugin install vagrant-disksize
|
75
|
+
```
|
76
|
+
|
77
|
+
### Docker
|
78
|
+
|
79
|
+
Note: feature still in development
|
80
|
+
|
81
|
+
Docker uses a temporary folder as volume to build the image.
|
82
|
+
The folder location can be changed with the build option __tmp-folder__, which is set to "${PWD}/tmp" by default.
|
83
|
+
|
84
|
+
Note: the type of the tmp directory needs to be changed on SELinux
|
85
|
+
|
86
|
+
chcon -Rt svirt_sandbox_file_t "${PWD}/tmp"
|
87
|
+
|
88
|
+
After the image is built, undo the changes.
|
89
|
+
|
90
|
+
restorecon -v "${PWD}/tmp"
|
91
|
+
|
92
|
+
|
93
|
+
# Usage
|
94
|
+
|
95
|
+
To build a default image in a Vagrant box, simply execute on the command line
|
96
|
+
|
97
|
+
pi_customizer build VAGRANT -c <your-config-file>
|
98
|
+
|
99
|
+
|
100
|
+
To customize your build:
|
101
|
+
1. All customizations have to be specified in a json configuration file (see the [__Config File__](#config_file) section for details).
|
102
|
+
1. The build process itself is then configured with command line options (see `pi_customizer help build` for details)
|
103
|
+
|
104
|
+
|
105
|
+
<a name="config_file"></a>
|
106
|
+
## Config File
|
107
|
+
|
108
|
+
An example of the json config file with all current configuration options
|
109
|
+
|
110
|
+
{
|
111
|
+
"system": {
|
112
|
+
"name" : "custompi",
|
113
|
+
"type" : "lite"
|
114
|
+
},
|
115
|
+
"ssh" : {
|
116
|
+
"enabled" : true
|
117
|
+
},
|
118
|
+
"locale": {
|
119
|
+
"gen" : ["en_GB.UTF-8 UTF-8", "de_DE.UTF-8 UTF-8"],
|
120
|
+
"sys" : "en_GB.UTF-8"
|
121
|
+
},
|
122
|
+
"cgroups": {
|
123
|
+
"memory": true
|
124
|
+
},
|
125
|
+
"wifi": {
|
126
|
+
"networks": [
|
127
|
+
{
|
128
|
+
"ssid": "your_ssid",
|
129
|
+
"passphrase": "your_secret_psk" // Alternative: "wpa_passphrase": "your_wpa_passpharse"
|
130
|
+
}
|
131
|
+
],
|
132
|
+
"wpa_country": "DE"
|
133
|
+
}
|
134
|
+
}
|
135
|
+
|
136
|
+
### The system section
|
137
|
+
|
138
|
+
* To choose a custom name for your pi image, specify the __name__ value. The default is _custompi_.
|
139
|
+
|
140
|
+
* To build a lite version of the pi image, specify the __type__ as lite, otherwise specify it as full. The default is _full_.
|
141
|
+
|
142
|
+
### The ssh section
|
143
|
+
|
144
|
+
* To disable ssh by default, set __enabled__ to false.
|
145
|
+
|
146
|
+
### The locale section
|
147
|
+
|
148
|
+
* Select one or more locales to be generated: e.g., "en_GB.UTF-8 UTF-8", "de_DE.UTF-8 UTF-8", ...
|
149
|
+
* Select the default locale, typically en_GB.UTF-8, which is the default.
|
150
|
+
|
151
|
+
### The cgroups section
|
152
|
+
|
153
|
+
* To enable the cgroup memory, enable __memory__, otherwise leave it out.
|
154
|
+
|
155
|
+
### The wifi section
|
156
|
+
|
157
|
+
* The wifi section allows you to specify networks and passphrase __OR__ wpa_passpharse as well as the wpa_country.
|
158
|
+
|
159
|
+
# Development
|
160
|
+
|
161
|
+
### Prerequisites
|
162
|
+
|
163
|
+
* Make sure Ruby is installed (and dependencies to build native extensions). See, https://github.com/rbenv/rbenv and https://github.com/rbenv/ruby-build.
|
164
|
+
|
165
|
+
* On Fedora with zsh, this means sth. along the lines of:
|
166
|
+
|
167
|
+
```
|
168
|
+
sudo dnf group install "C Development Tools and Libraries"
|
169
|
+
sudo dnf install redhat-rpm-config git openssl-devel readline-devel
|
170
|
+
|
171
|
+
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
|
172
|
+
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
|
173
|
+
~/.rbenv/bin/rbenv init
|
174
|
+
exec $SHELL
|
175
|
+
|
176
|
+
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
|
177
|
+
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.zshrc
|
178
|
+
exec $SHELL
|
179
|
+
|
180
|
+
rbenv install 2.5.5
|
181
|
+
rbenv global 2.5.5
|
182
|
+
```
|
183
|
+
|
184
|
+
|
185
|
+
* Install Gems
|
186
|
+
|
187
|
+
```
|
188
|
+
gem install bundler rake rspec rdoc
|
189
|
+
```
|
190
|
+
|
191
|
+
## Test
|
192
|
+
|
193
|
+
RSpec tests can be executed for all modules by calling the following rake command in the project root.
|
194
|
+
|
195
|
+
rake spec
|
196
|
+
|
197
|
+
## Structure
|
198
|
+
|
199
|
+
For now, the sources of both gems (pi_customizer and pi_build_modifier) are versioned in one repository.
|
200
|
+
This might change if their versions run out of sync.
|
201
|
+
|
202
|
+
## Contributing
|
203
|
+
|
204
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ottenwbe/pi-gen-environment. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
205
|
+
|
206
|
+
## License
|
207
|
+
|
208
|
+
The gems are available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
209
|
+
|
data/Rakefile
CHANGED
@@ -1,13 +1,141 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
PI_CUSTOMIZER = 'pi_customizer'
|
2
|
+
PI_BUILD_MODIFIER = 'pi_build_modifier'
|
3
|
+
|
4
|
+
build_projects = [PI_BUILD_MODIFIER]
|
5
|
+
install_projects = [PI_CUSTOMIZER]
|
6
|
+
all_gems = (build_projects + install_projects).uniq
|
7
|
+
files = %w(pi_build_modifier/lib/**/*.rb pi_customizer/lib/**/*.rb)
|
8
|
+
|
9
|
+
##
|
10
|
+
# The spec task executes rspec tests for all gems of the pi_customizer project.
|
11
|
+
# This task is executed by default when 'rake' is called on the command line
|
3
12
|
|
4
13
|
begin
|
5
|
-
require 'bundler/gem_tasks'
|
6
14
|
require 'rspec/core/rake_task'
|
7
15
|
|
8
|
-
RSpec::Core::RakeTask.new(:spec)
|
9
|
-
|
16
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
17
|
+
# find all spec files (for all gems)
|
18
|
+
pattern = ''
|
19
|
+
all_gems.each do |gem|
|
20
|
+
if pattern == ''
|
21
|
+
pattern = "#{gem}/spec/**{,/*/**}/*_spec.rb"
|
22
|
+
else
|
23
|
+
pattern = pattern + ',' + "#{gem}/spec/**{,/*/**}/*_spec.rb"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
# tell rspec to execute tests on all spec files
|
27
|
+
t.pattern = pattern
|
28
|
+
end
|
29
|
+
rescue LoadError
|
30
|
+
puts 'RSpec is not installed. This means rake is not able to execute tests! '
|
31
|
+
puts '* Try: gem install rspec'
|
32
|
+
end
|
33
|
+
|
34
|
+
task :default => :spec
|
35
|
+
|
36
|
+
|
37
|
+
# release task
|
38
|
+
|
39
|
+
desc 'Release and upload to Rubygems.org'
|
40
|
+
task :release do
|
41
|
+
all_gems.each do |p|
|
42
|
+
Dir.chdir p do
|
43
|
+
system 'rake release'
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# doc tasks
|
49
|
+
|
50
|
+
begin
|
51
|
+
require 'rdoc/task'
|
10
52
|
|
53
|
+
RDoc::Task.new do |rdoc|
|
54
|
+
rdoc.rdoc_dir = File.join(File.dirname(__FILE__), '/doc')
|
55
|
+
rdoc.rdoc_files.include(files)
|
56
|
+
end
|
11
57
|
rescue LoadError
|
12
|
-
puts 'RSpec
|
58
|
+
puts 'RSpec is not installed. This means rake is not able to build the documentation!'
|
59
|
+
puts '* Try: gem install rdoc'
|
13
60
|
end
|
61
|
+
|
62
|
+
# version tasks
|
63
|
+
|
64
|
+
desc "Show the gem's versions"
|
65
|
+
task :versions do
|
66
|
+
require_relative "#{PI_CUSTOMIZER}/lib/#{PI_CUSTOMIZER}/version"
|
67
|
+
puts "#{PI_CUSTOMIZER} Versions"
|
68
|
+
puts ' '
|
69
|
+
puts '*** Dev VERSION ***'
|
70
|
+
puts ' '
|
71
|
+
puts "#{PI_CUSTOMIZER}: #{PiCustomizer::VERSION} "
|
72
|
+
system "gem list #{PI_CUSTOMIZER} --pre --remote"
|
73
|
+
puts ' '
|
74
|
+
require_relative "#{PI_BUILD_MODIFIER}/lib/#{PI_BUILD_MODIFIER}/version"
|
75
|
+
puts "#{PI_BUILD_MODIFIER} Versions"
|
76
|
+
puts ' '
|
77
|
+
puts '*** Dev VERSION ***'
|
78
|
+
puts ' '
|
79
|
+
puts "#{PI_BUILD_MODIFIER}: #{PiBuildModifier::VERSION}"
|
80
|
+
system "gem list #{PI_BUILD_MODIFIER} --pre --remote"
|
81
|
+
end
|
82
|
+
|
83
|
+
# build tasks
|
84
|
+
|
85
|
+
desc "Build all gems (i.e., #{PI_BUILD_MODIFIER} and #{PI_CUSTOMIZER})"
|
86
|
+
task :build do
|
87
|
+
all_gems.each do |p|
|
88
|
+
Dir.chdir p do
|
89
|
+
system 'rake build'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
namespace :uninstall do
|
95
|
+
desc 'remove the locally required gems'
|
96
|
+
task :local do
|
97
|
+
install_projects.each do |p|
|
98
|
+
Dir.chdir p do
|
99
|
+
system "gem uninstall #{p} -a -x"
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
namespace :install do
|
106
|
+
|
107
|
+
require 'fileutils'
|
108
|
+
|
109
|
+
desc 'install the locally required gems'
|
110
|
+
task :local do
|
111
|
+
build_projects.each do |p|
|
112
|
+
Dir.chdir p do
|
113
|
+
system 'rake build'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
install_projects.each do |p|
|
117
|
+
Dir.chdir p do
|
118
|
+
system 'rake install:local'
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
task :local => [:spec, :rdoc, 'uninstall:local']
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
# run the pi_customizer from source
|
128
|
+
|
129
|
+
namespace :run do
|
130
|
+
|
131
|
+
desc 'run the pi_customizer and build the pi image in a vagrant box'
|
132
|
+
task :vagrant, [:resources] do |t, args|
|
133
|
+
system ("ruby pi_customizer/bin/pi_customizer build VAGRANT #{args[:resources]}")
|
134
|
+
end
|
135
|
+
|
136
|
+
desc 'run the pi_customizer and build the pi image in a docker container'
|
137
|
+
task :docker, [:resources] do |t, args|
|
138
|
+
system ("ruby pi_customizer/bin/pi_customizer build DOCKER #{args[:resources]}")
|
139
|
+
end
|
140
|
+
|
141
|
+
end
|