dock0 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/bin/dock0 +1 -1
- data/dock0.gemspec +4 -1
- data/lib/dock0.rb +44 -7
- metadata +44 -3
- data/Gemfile.lock +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2f57a1a3b08ff1f59b94635eaeebe86039b4058
|
4
|
+
data.tar.gz: cfc32381992549151e151df216fffefd2ff30ea9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99559e3271444984bfc633f002c62d65f89fead820e14840ad74b3406ea0d8ed4d13dda25b3df11199287ea4770d834a60aa1b7c0ca7dbf5ee660c5b031bfb5b
|
7
|
+
data.tar.gz: b5d1a12d8a1773dd1744a9e3099e9ccf85ec068f1f6d4fadfba06963dc2b64d70bbbeb343797bd07a44e41e91681125d2874914faaf13faa6b97c9be9a69b952
|
data/.gitignore
CHANGED
data/bin/dock0
CHANGED
data/dock0.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'dock0'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.2'
|
4
4
|
s.date = Time.now.strftime("%Y-%m-%d")
|
5
5
|
|
6
6
|
s.summary = 'Builds a read-only Arch host for Docker'
|
@@ -17,4 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.add_development_dependency 'rubocop'
|
18
18
|
s.add_development_dependency 'travis-lint'
|
19
19
|
s.add_development_dependency 'rake'
|
20
|
+
s.add_development_dependency 'coveralls'
|
21
|
+
s.add_development_dependency 'rspec'
|
22
|
+
s.add_development_dependency 'fuubar'
|
20
23
|
end
|
data/lib/dock0.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'fileutils'
|
3
|
+
require 'english'
|
3
4
|
|
4
5
|
##
|
5
6
|
# Dock0 provides an interface for building Arch images
|
@@ -29,44 +30,80 @@ module Dock0
|
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
33
|
+
def run(cmd)
|
34
|
+
results = `#{cmd} 2>&1`
|
35
|
+
return results if $CHILD_STATUS.success?
|
36
|
+
fail "Failed running #{cmd}:\n#{results}"
|
37
|
+
end
|
38
|
+
|
32
39
|
def prepare_device
|
33
|
-
|
34
|
-
|
40
|
+
puts "Making new filesystem on #{@config['paths']['device']}"
|
41
|
+
run "mkfs.ext2 #{@config['paths']['device']}"
|
42
|
+
puts "Mounting filesystem on #{@config['paths']['mount']}"
|
43
|
+
FileUtils.mkdir_p @config['paths']['mount']
|
44
|
+
run "mount #{@config['paths']['device']} #{@config['paths']['mount']}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def prepare_root
|
48
|
+
puts "Making build FS at #{@config['paths']['build_file']}"
|
49
|
+
run "dd if=/dev/zero of=#{@config['paths']['build_file']} \
|
50
|
+
bs=1M count=#{@config['root_size']}"
|
51
|
+
run "mkfs.ext2 -F #{@config['paths']['build_file']}"
|
52
|
+
puts "Mounting FS at #{@config['paths']['build']}"
|
53
|
+
FileUtils.mkdir_p @config['paths']['build']
|
54
|
+
run "mount #{@config['paths']['build_file']} \
|
55
|
+
#{@config['paths']['build']}"
|
35
56
|
end
|
36
57
|
|
37
58
|
def install_packages
|
38
59
|
File.read(@config['paths']['package_list']).split("\n").each do |package|
|
39
|
-
|
60
|
+
puts "Installing #{package}"
|
61
|
+
run "pacstrap -G -M #{@config['paths']['build']} #{package}"
|
40
62
|
end
|
41
63
|
end
|
42
64
|
|
43
65
|
def apply_overlay
|
66
|
+
puts "Applying overlay from #{@config['paths']['overlay']}"
|
44
67
|
overlay_path = @config['paths']['overlay'] + '/.'
|
45
|
-
FileUtils.cp_r overlay_path, @config['paths']['
|
68
|
+
FileUtils.cp_r overlay_path, @config['paths']['build']
|
46
69
|
end
|
47
70
|
|
48
71
|
def run_scripts
|
49
72
|
Dir.glob(@config['paths']['scripts'] + '/*.rb').each do |script|
|
50
|
-
|
73
|
+
puts "Running #{script}"
|
74
|
+
instance_eval File.read(script), script, 0
|
51
75
|
end
|
52
76
|
end
|
53
77
|
|
54
78
|
def run_commands
|
55
79
|
cmds = @config['commands']
|
56
80
|
cmds.fetch('chroot', []).each do |cmd|
|
57
|
-
|
81
|
+
puts "Running #{cmd} in chroot"
|
82
|
+
run "arch-chroot #{@config['paths']['build']} #{cmd}"
|
58
83
|
end
|
59
84
|
cmds.fetch('host', []).each do |cmd|
|
60
|
-
|
85
|
+
puts "Running #{cmd} on host"
|
86
|
+
run cmd
|
61
87
|
end
|
62
88
|
end
|
63
89
|
|
90
|
+
def finalize
|
91
|
+
puts 'Packing up root FS'
|
92
|
+
run "umount #{@config['paths']['build']}"
|
93
|
+
run "mksquashfs #{@config['paths']['build_file']} \
|
94
|
+
#{@config['paths']['mount']}/root.fs.sfs"
|
95
|
+
puts 'Unmounting target device'
|
96
|
+
run "umount #{@config['paths']['mount']}"
|
97
|
+
end
|
98
|
+
|
64
99
|
def easy_mode
|
65
100
|
prepare_device
|
101
|
+
prepare_root
|
66
102
|
install_packages
|
67
103
|
apply_overlay
|
68
104
|
run_scripts
|
69
105
|
run_commands
|
106
|
+
finalize
|
70
107
|
end
|
71
108
|
end
|
72
109
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dock0
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Les Aker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -52,6 +52,48 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: fuubar
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
55
97
|
description: Generates a read-only Arch host for running Docker containers
|
56
98
|
email: me@lesaker.org
|
57
99
|
executables:
|
@@ -64,7 +106,6 @@ files:
|
|
64
106
|
- ".rubocop.yml"
|
65
107
|
- ".travis.yml"
|
66
108
|
- Gemfile
|
67
|
-
- Gemfile.lock
|
68
109
|
- LICENSE
|
69
110
|
- README.md
|
70
111
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
dock0 (0.0.1)
|
5
|
-
|
6
|
-
GEM
|
7
|
-
remote: https://rubygems.org/
|
8
|
-
specs:
|
9
|
-
ast (1.1.0)
|
10
|
-
hashr (0.0.22)
|
11
|
-
json (1.8.1)
|
12
|
-
parser (2.1.4)
|
13
|
-
ast (~> 1.1)
|
14
|
-
slop (~> 3.4, >= 3.4.5)
|
15
|
-
powerpack (0.0.9)
|
16
|
-
rainbow (1.99.2)
|
17
|
-
rake (10.1.1)
|
18
|
-
rubocop (0.17.0)
|
19
|
-
json (~> 1.8)
|
20
|
-
parser (~> 2.1.3)
|
21
|
-
powerpack (~> 0.0.6)
|
22
|
-
rainbow (~> 1.99.1)
|
23
|
-
slop (3.4.7)
|
24
|
-
travis-lint (1.7.0)
|
25
|
-
hashr (~> 0.0.22)
|
26
|
-
|
27
|
-
PLATFORMS
|
28
|
-
ruby
|
29
|
-
|
30
|
-
DEPENDENCIES
|
31
|
-
dock0!
|
32
|
-
rake
|
33
|
-
rubocop
|
34
|
-
travis-lint
|