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

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) ===
Here is my attempt at solving the problem. I was unable to create a working image on my system, distrobuilder fails with errors.

I get this output:

```
# /usr/local/bin/distrobuilder build-lxd gentoo.yaml 
+ mv /usr/bin/gpg2 /usr/bin/gpg2.real
+ echo '#!/bin/sh'
+ echo 'exec /usr/bin/gpg2.real --keyserver keyserver.ubuntu.com "$@"'
+ chmod +x /usr/bin/gpg2
+ cp /usr/share/portage/config/repos.conf /usr/share/portage/config/repos.conf.orig
+ sed -i s#hkps://keys.gentoo.org#keyserver.ubuntu.com#g /usr/share/portage/config/repos.conf
+ sed -ri 's#(sync-uri =) .+#\1 rsync://rsync.ca.gentoo.org/gentoo-portage/#' /usr/share/portage/config/repos.conf
+ '[' -e /etc/inittab ']'
+ sed -i 's/^c[0-9]:/#\0/' /etc/inittab
+ sed -i 's/^#\(x1:.*\)/\1/' etc/inittab
+ echo pf:12345:powerwait:/sbin/halt
+ mv /usr/bin/gpg2 /usr/bin/gpg2.real
+ echo '#!/bin/sh'
+ echo 'exec /usr/bin/gpg2.real --keyserver keyserver.ubuntu.com "$@"'
+ chmod +x /usr/bin/gpg2
+ cp /usr/share/portage/config/repos.conf /usr/share/portage/config/repos.conf.orig
+ sed -i s#hkps://keys.gentoo.org#keyserver.ubuntu.com#g /usr/share/portage/config/repos.conf
+ sed -ri 's#(sync-uri =) .+#\1 rsync://rsync.ca.gentoo.org/gentoo-portage/#' /usr/share/portage/config/repos.conf
++ uname -m
+ TARGET=x86_64
+ case "${TARGET}" in
+ TARGET=amd64
+ echo 'ACCEPT_KEYWORDS=~amd64'
+ ln -s net.lo /etc/init.d/net.eth0
+ mkdir -p /etc/runlevels/default
+ rc-update add net.eth0 default
 * service net.eth0 added to runlevel default
+ rm /usr/bin/gpg2
+ mv /usr/bin/gpg2.real /usr/bin/gpg2
+ rm /usr/share/portage/config/repos.conf
+ mv /usr/share/portage/config/repos.conf.orig /usr/share/portage/config/repos.conf
+ rm /usr/bin/gpg2
+ mv /usr/bin/gpg2.real /usr/bin/gpg2
mv: cannot stat '/usr/bin/gpg2.real': No such file or directory
Error: Failed to run post-packages: exit status 1
```

It looks like distrobuilder is executing both post-packages sections:
https://github.com/lxc/lxc-ci/blob/5865c94b68256463d2bceaf32c9437d1cf059aa1/images/gentoo.yaml#L469-L493

If I comment out the second one, I get this output:
```
# /usr/local/bin/distrobuilder build-lxd gentoo.yaml 
+ mv /usr/bin/gpg2 /usr/bin/gpg2.real
+ echo '#!/bin/sh'
+ echo 'exec /usr/bin/gpg2.real --keyserver keyserver.ubuntu.com "$@"'
+ chmod +x /usr/bin/gpg2
+ cp /usr/share/portage/config/repos.conf /usr/share/portage/config/repos.conf.orig
+ sed -i s#hkps://keys.gentoo.org#keyserver.ubuntu.com#g /usr/share/portage/config/repos.conf
+ sed -ri 's#(sync-uri =) .+#\1 rsync://rsync.ca.gentoo.org/gentoo-portage/#' /usr/share/portage/config/repos.conf
+ '[' -e /etc/inittab ']'
+ sed -i 's/^c[0-9]:/#\0/' /etc/inittab
+ sed -i 's/^#\(x1:.*\)/\1/' etc/inittab
+ echo pf:12345:powerwait:/sbin/halt
+ mv /usr/bin/gpg2 /usr/bin/gpg2.real
+ echo '#!/bin/sh'
+ echo 'exec /usr/bin/gpg2.real --keyserver keyserver.ubuntu.com "$@"'
+ chmod +x /usr/bin/gpg2
+ cp /usr/share/portage/config/repos.conf /usr/share/portage/config/repos.conf.orig
+ sed -i s#hkps://keys.gentoo.org#keyserver.ubuntu.com#g /usr/share/portage/config/repos.conf
+ sed -ri 's#(sync-uri =) .+#\1 rsync://rsync.ca.gentoo.org/gentoo-portage/#' /usr/share/portage/config/repos.conf
++ uname -m
+ TARGET=x86_64
+ case "${TARGET}" in
+ TARGET=amd64
+ echo 'ACCEPT_KEYWORDS=~amd64'
+ ln -s net.lo /etc/init.d/net.eth0
+ mkdir -p /etc/runlevels/default
+ rc-update add net.eth0 default
 * service net.eth0 added to runlevel default
+ rm /usr/bin/gpg2
+ mv /usr/bin/gpg2.real /usr/bin/gpg2
+ rm /usr/share/portage/config/repos.conf
+ mv /usr/share/portage/config/repos.conf.orig /usr/share/portage/config/repos.conf
Error: Failed to create overlay: no such device
```

From a28133751a1d4c66439d41f39c2534f6c3d07ddc Mon Sep 17 00:00:00 2001
From: Stephen Bosch <stephen.bo...@gmail.com>
Date: Mon, 3 Aug 2020 01:39:31 +0200
Subject: [PATCH] Add init script to emerge --sync at first boot.

---
 images/gentoo.yaml | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/images/gentoo.yaml b/images/gentoo.yaml
index 1eceadc..dcdd17e 100644
--- a/images/gentoo.yaml
+++ b/images/gentoo.yaml
@@ -343,6 +343,15 @@ files:
     rc_keyword="-stop"
     config_eth0="dhcp"
 
+- path: /etc/local.d/repo_check.start
+  generator: dump
+  mode: 700
+  content: |-
+    #!/bin/bash
+    test -f $(portageq get_repo_path / gentoo)/header.txt || exit 0
+    emerge --sync
+    chmod -x /etc/local.d/repo-check.start
+
 - name: meta-data
   generator: cloud-init
   variants:
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to