From c206e3886803dae308a4e07c0462bde6ff8bedbf Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Thu, 25 Jul 2024 13:42:32 +0300 Subject: [PATCH 1/2] images/gentoo: Remove GPG workaround This workaround no more needed. Signed-off-by: Azamat H. Hackimov (cherry picked from commit 55f7b09c838a2c6b60591a66bf0981bddbec6184) Signed-off-by: Din Music License: Apache-2.0 --- images/gentoo.yaml | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/images/gentoo.yaml b/images/gentoo.yaml index 6575d800b..bc383915a 100644 --- a/images/gentoo.yaml +++ b/images/gentoo.yaml @@ -493,14 +493,7 @@ actions: #!/bin/sh set -eux - # Workaround GPG issues - mv /usr/bin/gpg2 /usr/bin/gpg2.real - echo "#!/bin/sh" > /usr/bin/gpg2 - echo "exec /usr/bin/gpg2.real --keyserver keyserver.ubuntu.com \"\$@\"" >> /usr/bin/gpg2 - 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_MIRROR}#" /usr/share/portage/config/repos.conf # Patch up /etc/inittab @@ -521,14 +514,7 @@ actions: #!/bin/sh set -eux - # Workaround GPG issues - mv /usr/bin/gpg2 /usr/bin/gpg2.real - echo "#!/bin/sh" > /usr/bin/gpg2 - echo "exec /usr/bin/gpg2.real --keyserver keyserver.ubuntu.com \"\$@\"" >> /usr/bin/gpg2 - 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_MIRROR}#" /usr/share/portage/config/repos.conf TARGET="$(uname -m)" @@ -615,8 +601,6 @@ actions: mkdir -p /etc/runlevels/default rc-update add net.eth0 default || true - 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 @@ -625,11 +609,6 @@ actions: #!/bin/sh set -eux - if [ -f /usr/bin/gpg2.real ]; then - rm /usr/bin/gpg2 - mv /usr/bin/gpg2.real /usr/bin/gpg2 - fi - if [ -f /usr/share/portage/config/repos.conf.orig ]; then rm /usr/share/portage/config/repos.conf mv /usr/share/portage/config/repos.conf.orig /usr/share/portage/config/repos.conf From ac8d11f4609b54e43a4042e30c9130229ac7a5e8 Mon Sep 17 00:00:00 2001 From: "Azamat H. Hackimov" Date: Thu, 25 Jul 2024 15:37:33 +0300 Subject: [PATCH 2/2] images/gentoo: Update package installation usage Remove changing RSYNC_MIRROR commands as effectively noop. Add ability to use binary packages when possible. Remove rendundant portage files after installation (source files, binary packages, portage tree). Signed-off-by: Azamat H. Hackimov (cherry picked from commit 2454f14d329097d1d9bf6b6384d973ffd51298d2) Signed-off-by: Din Music License: Apache-2.0 --- images/gentoo.yaml | 62 +++++++++++----------------------------------- 1 file changed, 15 insertions(+), 47 deletions(-) diff --git a/images/gentoo.yaml b/images/gentoo.yaml index bc383915a..9cbb67ca8 100644 --- a/images/gentoo.yaml +++ b/images/gentoo.yaml @@ -393,14 +393,6 @@ files: - path: /var/lib/dbus/machine-id generator: remove -- path: /etc/local.d/repo_check.start - generator: dump - mode: 700 - content: |- - #!/bin/bash - filename="header.txt" - test -f $(portageq get_repo_path / gentoo)/$filename || emerge --sync; chmod -x /etc/local.d/repo_check.start - - name: meta-data generator: cloud-init variants: @@ -453,7 +445,7 @@ packages: sets: - packages: - net-misc/dhcpcd - - sudo + - app-admin/sudo action: install - packages: @@ -463,14 +455,14 @@ packages: - cloud - packages: - - syslog-ng - sys-power/acpid action: install types: - vm - packages: - - grub + - app-admin/syslog-ng + - sys-boot/grub action: install types: - vm @@ -493,9 +485,6 @@ actions: #!/bin/sh set -eux - cp /usr/share/portage/config/repos.conf /usr/share/portage/config/repos.conf.orig - sed -ri "s#(sync-uri =) .+#\1 ${RSYNC_MIRROR}#" /usr/share/portage/config/repos.conf - # Patch up /etc/inittab if [ -e /etc/inittab ]; then sed -i 's/^c[0-9]:/#\0/' /etc/inittab @@ -514,9 +503,6 @@ actions: #!/bin/sh set -eux - cp /usr/share/portage/config/repos.conf /usr/share/portage/config/repos.conf.orig - sed -ri "s#(sync-uri =) .+#\1 ${RSYNC_MIRROR}#" /usr/share/portage/config/repos.conf - TARGET="$(uname -m)" case "${TARGET}" in @@ -540,14 +526,9 @@ actions: action: |- #!/bin/sh set -eux - - # Remove this directory, as it should actually be a file - rm -rf /etc/portage/package.use - - # Fix cloud-init requirement - echo '*/* PYTHON_TARGETS: python3_7 python3_8' > /etc/portage/package.use - variants: - - cloud + # Use binary packages if available + echo 'FEATURES="getbinpkg"' >> /etc/portage/make.conf + getuto - trigger: post-unpack action: |- @@ -598,25 +579,8 @@ actions: #!/bin/sh set -eux ln -s net.lo /etc/init.d/net.eth0 - mkdir -p /etc/runlevels/default rc-update add net.eth0 default || true - rm /usr/share/portage/config/repos.conf - mv /usr/share/portage/config/repos.conf.orig /usr/share/portage/config/repos.conf - -- trigger: post-packages - action: |- - #!/bin/sh - set -eux - - if [ -f /usr/share/portage/config/repos.conf.orig ]; then - rm /usr/share/portage/config/repos.conf - mv /usr/share/portage/config/repos.conf.orig /usr/share/portage/config/repos.conf - fi - types: - - container - - vm - - trigger: post-packages action: |- #!/bin/sh @@ -658,6 +622,15 @@ actions: variants: - openrc +- trigger: post-files + action: |- + #!/bin/sh + set -eux + # Uninstall build dependency packages + emerge --depclean + # Remove portage files + rm -fr /var/db/repos/gentoo/* /var/cache/distfiles/* /var/cache/binpkgs/* + - trigger: post-packages action: |- #!/bin/sh @@ -671,10 +644,5 @@ actions: variants: - systemd -environment: - variables: - - key: RSYNC_MIRROR - value: rsync://rsync.ca.gentoo.org/gentoo-portage/ - mappings: architecture_map: gentoo