[lxc-devel] [lxd/master] Fix most other compression algorithms
stgraber on Github
lxc-bot at linuxcontainers.org
Thu Apr 7 00:57:53 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160407/84346526/attachment.bin>
-------------- next part --------------
From 554842bbda648dae60c2eb9015dd85c8acae6a4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 6 Apr 2016 20:57:14 -0400
Subject: [PATCH] Fix most other compression algorithms
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #1862
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/images.go | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lxd/images.go b/lxd/images.go
index dfe22f3..da3163c 100644
--- a/lxd/images.go
+++ b/lxd/images.go
@@ -124,7 +124,14 @@ func untarImage(imagefname string, destpath string) error {
}
func compressFile(path string, compress string) (string, error) {
- cmd := exec.Command(compress, path, "-c", "-n")
+ reproducible := []string{"gzip"}
+
+ args := []string{path, "-c"}
+ if shared.StringInSlice(compress, reproducible) {
+ args = append(args, "-n")
+ }
+
+ cmd := exec.Command(compress, args...)
outfile, err := os.Create(path + ".compressed")
if err != nil {
More information about the lxc-devel
mailing list