The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/distrobuilder/pull/95

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Signed-off-by: St├ęphane Graber <stgra...@ubuntu.com>
From 2b144e7e96158e821f76920b14bbdb003a4bfe8e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@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 <stgra...@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...)
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to