[lxc-devel] [distrobuilder/master] Split source.Suite and source.SameAs
stgraber on Github
lxc-bot at linuxcontainers.org
Fri May 18 02:34:27 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 362 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180518/a5cdeb09/attachment.bin>
-------------- next part --------------
From 2b144e7e96158e821f76920b14bbdb003a4bfe8e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 17 May 2018 22:34:04 -0400
Subject: [PATCH] Split source.Suite and source.SameAs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
shared/definition.go | 1 +
sources/debootstrap.go | 13 +++++++------
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/shared/definition.go b/shared/definition.go
index 78b33ec..6ef9cfa 100644
--- a/shared/definition.go
+++ b/shared/definition.go
@@ -48,6 +48,7 @@ type DefinitionSource struct {
Keyserver string `yaml:"keyserver,omitempty"`
Variant string `yaml:"variant,omitempty"`
Suite string `yaml:"suite,omitempty"`
+ SameAs string `yaml:"same_as,omitempty"`
AptSources string `yaml:"apt_sources,omitempty"`
IgnoreRelease bool `yaml:"ignore_release,omitempty"`
}
diff --git a/sources/debootstrap.go b/sources/debootstrap.go
index a636193..cfc1685 100644
--- a/sources/debootstrap.go
+++ b/sources/debootstrap.go
@@ -7,6 +7,7 @@ import (
"strings"
"github.com/lxc/distrobuilder/shared"
+ lxd "github.com/lxc/lxd/shared"
)
// Debootstrap represents the debootstrap downloader.
@@ -59,16 +60,16 @@ func (s *Debootstrap) Run(definition shared.Definition, rootfsDir string) error
args = append(args, definition.Source.URL)
}
- // If definition.Source.Suite is set, create a symlink in /usr/share/debootstrap/scripts
+ // If definition.Source.SameAs is set, create a symlink in /usr/share/debootstrap/scripts
// pointing release to definition.Source.Suite.
- if definition.Source.Suite != "" {
- link := filepath.Join("/usr/share/debootstrap/scripts",
- definition.Image.Release)
- err := os.Symlink(definition.Source.Suite, link)
+ scriptPath := filepath.Join("/usr/share/debootstrap/scripts", definition.Image.Release)
+ if !lxd.PathExists(scriptPath) && definition.Source.SameAs != "" {
+ err := os.Symlink(definition.Source.SameAs, scriptPath)
if err != nil {
return err
}
- defer os.Remove(link)
+
+ defer os.Remove(scriptPath)
}
err := shared.RunCommand("debootstrap", args...)
More information about the lxc-devel
mailing list