Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable custom overlays for Gentoo element #37

Closed
wants to merge 1 commit into from

Conversation

reavessm
Copy link

@reavessm reavessm commented Mar 5, 2025

This enables adding custom overlays at build time when creating Gentoo VM images. This is done by specifying a space separated list of tuples in the GENTOO_CUSTOM_OVERLAYS variable. Each tuple is split by the first colon where the left side is the repo name and the right side is the sync-uri. All custom overlays must be of the git type, similar to base overlays.

This also cleans up a few other issues:

  1. Setting GENTOO_PORTAGE_CLEANUP="True", which is the default, now removes the repos via eselect-repository instead of layman. Repos are added via eselect-repository so it makes sense to keep this symmetric, especially since layman isn't installed by default anymore.
  2. This also syncs base and custom overlays after adding them so you can actually install packages from these overlays
  3. The dist-kernel USE flag is added to the defaults. dist-kernel-bin is a default package so we should probably tell packages to actually use it.
  4. Added a way to specify ACCEPT_KEYWORDS

One question I have though is how do you set GENTOO_EMERGE_ENV? There doesn't seem to be a good way (that I could find) to export an entire bash array so everything I tried got overwritten by the defaults...

This was tested with the following script

#!/usr/bin/env bash
#  *   CONFIG_DM_MULTIPATH:        is not set when it should be.

set -e 

cwd=$(pwd)

pushd ~/Src/DiskImageBuilder

python -m venv venv

source venv/bin/activate

pip install -r requirements.txt

pip install -e .

# Default since 3.37
# export GENTOO_PROFILE="default/linux/amd64/23.0"

export GENTOO_OVERLAYS="steam-overlay supertux88 librewolf guru"
export GENTOO_CUSTOM_OVERLAYS="reavessm:https://gitlab.com/reavessm/gentoo-overlay"
export GENTOO_PORTAGE_CLEANUP="False"
export GENTOO_EMERGE_DEFAULT_OPTS="--binpkg-respect-use --rebuilt-binaries=y --usepkg=y --with-bdeps=y --binpkg-changed-deps=y --quiet" # --jobs=2 --autounmask=n"
export GENTOO_EMERGE_DEFAULT_OPTS="${GENTOO_EMERGE_DEFAULT_OPTS} -j8 --autounmask=y --autounmask-write --autounmask-continue"

declare -a profiles
profiles+=("default/linux/amd64/23.0/systemd")
profiles+=("default/linux/amd64/23.0/hardened/systemd")
# This fails for some reason...
# profiles+=("default/linux/amd64/23.0/hardened/selinux/systemd")

for prof in ${profiles[@]}
do
  echo "Building ${prof}"
  mkdir -pv "${cwd}/${prof}"
  export GENTOO_PROFILE="${prof}"

  export GENTOO_ACCEPT_KEYWORDS="~amd64"
  ./venv/bin/disk-image-create -o "${cwd}/${prof}/gentoo.qcow2" vm growroot gentoo -p app-editors/neovim
  ./venv/bin/disk-image-create -o "${cwd}/${prof}/gentoo-reavessm.qcow2" vm growroot gentoo -p acct-user/reavessm

  export GENTOO_ACCEPT_KEYWORDS=""
  ./venv/bin/disk-image-create -o "${cwd}/${prof}/gentoo-reavessm-zfs.qcow2" vm growroot gentoo -p acct-user/reavessm -p "\"sys-fs/zfs[rootfs]\"" -p "\"sys-fs/zfs-kmod[dist-kernel-cap\,rootfs]\""
done

popd

Signed-off-by: Stephen Reaves <reaves735@gmail.com>
@jayofdoom
Copy link
Contributor

Generally submissions to this repo are handled through gerrit submissions (the robot will be telling you that at some point, I suspect). These are mostly good ideas and I'd love to see them in. Reach out to JayF on IRC (including Gentoo IRC) if you need help getting it over there.

@jayofdoom
Copy link
Contributor

@reavessm
Copy link
Author

reavessm commented Mar 5, 2025

Sweet, thanks! I think I submitted it right? https://review.opendev.org/c/openstack/diskimage-builder/+/943500 . Either way, I'll close this and work on gerrit

@reavessm reavessm closed this Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants