[lxc-devel] [distrobuilder/master] centos: Fix AltArch

stgraber on Github lxc-bot at linuxcontainers.org
Fri Jan 18 11:57:49 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 363 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190118/356dde79/attachment.bin>
-------------- next part --------------
From 77783490898dd5ea499dccbe970dafc6122f00fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 18 Jan 2019 13:25:04 +0200
Subject: [PATCH] centos: Fix AltArch
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>
---
 sources/centos-http.go | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/sources/centos-http.go b/sources/centos-http.go
index 7bef586..06e7288 100644
--- a/sources/centos-http.go
+++ b/sources/centos-http.go
@@ -153,7 +153,14 @@ func (s CentOSHTTP) unpack(filePath, rootfsDir string) error {
 	}
 
 	// Copy the keys to the cdrom
+	gpgKeysPath := ""
 	for _, key := range gpgKeys {
+		fmt.Printf("key=%v\n", key)
+		if len(gpgKeysPath) > 0 {
+			gpgKeysPath += " "
+		}
+		gpgKeysPath += fmt.Sprintf("file:///mnt/cdrom/%s", filepath.Base(key))
+
 		err = shared.RunCommand("rsync", "-qa", key,
 			filepath.Join(tempRootDir, "mnt", "cdrom"))
 		if err != nil {
@@ -169,6 +176,9 @@ func (s CentOSHTTP) unpack(filePath, rootfsDir string) error {
 
 	err = shared.RunScript(fmt.Sprintf(`
 #!/bin/sh
+set -eux
+
+GPG_KEYS="%s"
 
 # Create required files
 touch /etc/mtab /etc/fstab
@@ -188,7 +198,7 @@ enabled=0
 gpgcheck=1
 EOF
 
-echo gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-%s >> /etc/yum.repos.d/cdrom.repo
+echo gpgkey=${GPG_KEYS} >> /etc/yum.repos.d/cdrom.repo
 
 yum --disablerepo=* --enablerepo=cdrom -y reinstall yum
 
@@ -196,7 +206,7 @@ yum --disablerepo=* --enablerepo=cdrom -y reinstall yum
 mkdir /rootfs
 yum --installroot=/rootfs --disablerepo=* --enablerepo=cdrom -y --releasever=%s install basesystem centos-release yum
 rm -rf /rootfs/var/cache/yum
-`, s.majorVersion, s.majorVersion))
+`, gpgKeysPath, s.majorVersion))
 	if err != nil {
 		exitChroot()
 		return err


More information about the lxc-devel mailing list