[lxc-devel] [distrobuilder/master] Add EarlyPackages to debootstrap source

stiltr on Github lxc-bot at linuxcontainers.org
Mon Jun 3 21:16:32 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 367 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190603/c80c2048/attachment.bin>
-------------- next part --------------
From 752e6240a6f03b08283ae1eb87c7ac076dbec25e Mon Sep 17 00:00:00 2001
From: Trevor Stiles <tstiles at shel.org>
Date: Mon, 3 Jun 2019 12:52:32 -0700
Subject: [PATCH 1/2] Add early_packages definition and check for debootstrap
 sources.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Some code courtesy of Stéphane Graber.

Signed-off-by: Trevor Stiles <tstiles at shel.org>
---
 shared/definition.go   | 1 +
 sources/debootstrap.go | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/shared/definition.go b/shared/definition.go
index 058a32b..9f666ca 100644
--- a/shared/definition.go
+++ b/shared/definition.go
@@ -85,6 +85,7 @@ type DefinitionSource struct {
 	AptSources       string   `yaml:"apt_sources,omitempty"`
 	IgnoreRelease    bool     `yaml:"ignore_release,omitempty"`
 	SkipVerification bool     `yaml:"skip_verification,omitempty"`
+	EarlyPackages    []string `yaml:"early_packages,omitempty"`
 }
 
 // A DefinitionTargetLXCConfig represents the config part of the metadata.
diff --git a/sources/debootstrap.go b/sources/debootstrap.go
index 8f77f38..51a2a1f 100644
--- a/sources/debootstrap.go
+++ b/sources/debootstrap.go
@@ -5,6 +5,7 @@ import (
 	"path"
 	"path/filepath"
 	"strings"
+	"fmt"
 
 	lxd "github.com/lxc/lxd/shared"
 
@@ -37,6 +38,10 @@ func (s *Debootstrap) Run(definition shared.Definition, rootfsDir string) error
 		args = append(args, "--no-check-gpg")
 	}
 
+	if len(definition.Source.EarlyPackages) > 0 {
+		args = append(args, fmt.Sprintf("--include=%s", strings.Join(definition.Source.EarlyPackages, ",")))
+	}
+
 	if len(definition.Source.Keys) > 0 {
 		keyring, err := shared.CreateGPGKeyring(definition.Source.Keyserver, definition.Source.Keys)
 		if err != nil {

From c7d597b36bb64de887bbc6228b99a180464894db Mon Sep 17 00:00:00 2001
From: Trevor Stiles <tstiles at shel.org>
Date: Mon, 3 Jun 2019 13:00:38 -0700
Subject: [PATCH 2/2] Update Devuan and Kali distros to use the new
 early_packages directive.

Signed-off-by: Trevor Stiles <tstiles at shel.org>
---
 doc/examples/devuan                  | 3 ++-
 doc/examples/kali                    | 3 ++-
 doc/examples/kali-with-core-packages | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/doc/examples/devuan b/doc/examples/devuan
index 5ffdacd..7a6d901 100644
--- a/doc/examples/devuan
+++ b/doc/examples/devuan
@@ -13,6 +13,8 @@ source:
   apt_sources: |-
     deb http://deb.devuan.org/merged {{ image.release }} main
     deb http://deb.devuan.org/merged {{ image.release }}-security main
+  early_packages:
+    - devuan-keyring
 
 targets:
   lxc:
@@ -93,7 +95,6 @@ packages:
     - packages:
         - ca-certificates
         - curl
-        - devuan-keyring
         - dialog
         - dnsutils
         - htop
diff --git a/doc/examples/kali b/doc/examples/kali
index 4d5cc51..f5f6056 100644
--- a/doc/examples/kali
+++ b/doc/examples/kali
@@ -11,6 +11,8 @@ source:
   variant: minbase
   apt_sources: |-
     deb http://http.kali.org/kali {{ image.release }} main non-free contrib
+  early_packages:
+    - kali-archive-keyring
 
 targets:
   lxc:
@@ -85,7 +87,6 @@ packages:
       - openssh-client
       - vim
       - systemd
-      - kali-archive-keyring
       action: install
 
 actions:
diff --git a/doc/examples/kali-with-core-packages b/doc/examples/kali-with-core-packages
index 55dd30c..bdefab2 100644
--- a/doc/examples/kali-with-core-packages
+++ b/doc/examples/kali-with-core-packages
@@ -11,6 +11,8 @@ source:
   variant: minbase
   apt_sources: |-
     deb http://http.kali.org/kali {{ image.release }} main non-free contrib
+  early_packages:
+    - kali-archive-keyring
 
 targets:
   lxc:
@@ -112,7 +114,6 @@ packages:
       - tor
       - tshark
       - whois
-      - kali-archive-keyring
       action: install
 
 actions:


More information about the lxc-devel mailing list