linecook-gem 0.5.6 → 0.5.7
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/lib/linecook/builder/lxc.rb +10 -4
- data/lib/linecook/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cce2615879f794147894aa74975081c3d398563c
|
4
|
+
data.tar.gz: 7fcc50dbe5e86411bae22b27d97fac338dad972b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d820b2680bc55310f63828501c612766c4d98f59a9ca18696bf44fdde16ce44f81b766797d77fae52198598a1b5fe8b81305cccffe4ddd8d27089b9a40d431bd
|
7
|
+
data.tar.gz: c0582af148803041adcbaee5396706868c883b9f66bf9ffa11180cb417e9272fa005b90e6c5ad427b2cb6015d2c65afc75e47c1fb3b4863fbcc469087e8a2861
|
data/lib/linecook/builder/lxc.rb
CHANGED
@@ -160,13 +160,15 @@ module Linecook
|
|
160
160
|
|
161
161
|
def unmount(clean: false)
|
162
162
|
@socket_dirs.each { |sock| execute("umount #{sock}") }
|
163
|
-
source = capture("mount | grep #{@lower_dir} | awk '{print $1}'") if clean
|
163
|
+
source = capture("mount | grep #{@lower_dir} | grep squashfs | awk '{print $1}'") if clean
|
164
164
|
execute("umount #{@root}")
|
165
165
|
execute("umount #{@upper_base}")
|
166
166
|
execute("umount #{@lower_dir}")
|
167
167
|
execute("rmdir #{@lower_dir}")
|
168
168
|
execute("rmdir #{@upper_base}")
|
169
|
-
|
169
|
+
|
170
|
+
# Clean up the source image, but only if it's not mounted elsewhre
|
171
|
+
FileUtils.rm_f(source) if clean && capture("mount | grep #{source} || true").strip.empty?
|
170
172
|
end
|
171
173
|
|
172
174
|
def bridge_network
|
@@ -198,9 +200,13 @@ eos
|
|
198
200
|
def setup_image
|
199
201
|
@source_path = Linecook::ImageManager.fetch(@source_image, profile: :public)
|
200
202
|
if @remote
|
201
|
-
|
203
|
+
name = File.basename(@source_path)
|
204
|
+
dest = "/u/linecook/images/#{name}"
|
202
205
|
unless test("[ -f #{dest} ]") && capture("shasum #{dest}").split.first == `shasum #{@source_path}`.split.first
|
203
|
-
|
206
|
+
tmp = "/tmp/#{name}-#{SecureRandom.hex(4)}"
|
207
|
+
@remote.run("sudo mkdir -p #{File.dirname(dest)}")
|
208
|
+
@remote.upload(@source_path, tmp)
|
209
|
+
@remote.run("sudo mv #{tmp} #{dest}")
|
204
210
|
end
|
205
211
|
@image_path = dest
|
206
212
|
else
|
data/lib/linecook/version.rb
CHANGED