[lxc-devel] [distrobuilder/master] sources: Fix copying libs in Ubuntu Core
monstermunchkin on Github
lxc-bot at linuxcontainers.org
Mon Aug 19 09:59:06 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190819/db43e92e/attachment.bin>
-------------- next part --------------
From ddbad8a6b656e3c7860ba2c9d126e78b41295da3 Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Mon, 19 Aug 2019 11:58:16 +0200
Subject: [PATCH] sources: Fix copying libs in Ubuntu Core
Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
sources/ubuntu-http.go | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/sources/ubuntu-http.go b/sources/ubuntu-http.go
index a4e172b..2b6ff6d 100644
--- a/sources/ubuntu-http.go
+++ b/sources/ubuntu-http.go
@@ -285,14 +285,24 @@ func (s *UbuntuHTTP) runCoreVariant(definition shared.Definition, rootfsDir stri
continue
}
- target := filepath.Join(rootfsDir, "lib", filepath.Base(matches[0]))
+ dest := filepath.Join(rootfsDir, "lib", filepath.Base(matches[0]))
- err = lxd.FileCopy(matches[0], target)
+ source, err := os.Readlink(matches[0])
if err != nil {
return err
}
- err = os.Chmod(target, 0755)
+ // Build absolute path
+ if !strings.HasPrefix(source, "/") {
+ source = filepath.Join(filepath.Dir(matches[0]), source)
+ }
+
+ err = lxd.FileCopy(source, dest)
+ if err != nil {
+ return err
+ }
+
+ err = os.Chmod(dest, 0755)
if err != nil {
return err
}
More information about the lxc-devel
mailing list