1
0
Fork 0
gnu-plus-dotfiles/run_once_10-add-gentoo-overlays.sh.tmpl
rain 36e9d3e0ce Add Gentoo support with GURU overlay requirement
Tadbit (tadbit-gentoo, x86_64, gcc 15.2.1, TKG kernel) joins the
homelab as the 7th machine — the first gentoo box. Adds Gentoo
support to the bootstrap alongside arch and debian.

New scripts:
- run_once_10-add-gentoo-overlays.sh.tmpl: enables GURU overlay
  via 'eselect repository enable guru' + 'emaint sync -r guru'.
  Idempotent — skips if GURU is already at /var/db/repos/guru.
  GURU is required because eza, lazygit, topgrade, and most modern
  CLI tools only live in GURU (not main).
- run_once_20-install-user-packages-gentoo.sh.tmpl: emerge-based
  user package set. Writes USE flags to package.use/ BEFORE
  emerging so foot/wofi/waybar get the right features. Detects
  missing packages via 'command -v <basename>'. Falls back to
  the official curl installer for bun (no gentoo package).
- run_once_40-install-sway-gentoo.sh.tmpl: sway stack via emerge
  with USE flags for X+wayland+tray+upower+wireplumber.

Updated scripts:
- .chezmoi.yaml.tmpl: os_family detection now also matches 'gentoo'.
  Critical fix: Gentoo's /etc/os-release uses single-quoted values
  ('gentoo' not 'gentoo' or "gentoo"), and chezmoi's parser doesn't
  strip them. Without trimAll "'", .chezmoi.osRelease.id returns
  the literal string 'gentoo' with quotes, and the eq test fails.
  Symptom: os_family silently becomes 'unknown'.
- run_once_00-install-bootstrap-tools.sh.tmpl: added gentoo branch
  that uses emerge --sync + emerge (skipping if tree is < 1 day old).
- run_onchange_30-ensure-cargo.sh.tmpl: added gentoo branch for
  bat (already installed by emerge, just verify), topgrade (GURU),
  cargo-update (dev-util/cargo-update in main).

README: documented Gentoo-specific quirks (USE flags, GURU,
single-quote parsing, no binary packages).
2026-06-23 15:55:28 -04:00

56 lines
No EOL
2.3 KiB
Bash

#!/usr/bin/env bash
# =============================================================================
# run_once_05-add-gentoo-overlays.sh.tmpl (gentoo-only)
# Add the GURU overlay to the portage repository list. GURU is the
# community overlay (like AUR for arch) where packages like bun, eza,
# sway, etc. live when they're not in the main tree.
#
# Idempotent: skips if GURU is already enabled.
# Run-order: 00 (bootstrap) → 05-overlays (here) → 10-add-{chaotic,debian}
# → 20-install-packages → 40-install-sway
# =============================================================================
set -euo pipefail
log() { printf '\033[1;34m[overlays]\033[0m %s\n' "$*"; }
die() { printf '\033[1;31m[overlays ERROR]\033[0m %s\n' "$*" >&2; exit 1; }
# This script is gentoo-only. Guarded by the chezmoi template engine;
# on arch/debian it never renders (only this single file path).
if [[ ! -d /var/db/repos/gentoo ]]; then
die "/var/db/repos/gentoo missing — this doesn't look like a gentoo system"
fi
# --- 1. GURU overlay ---
# User explicitly requires GURU. Per the bootstrap-runbook skill: gentoo
# boxes without GURU can't install most of the user packages (eza, fzf,
# fd-find on stable, lazygit, topgrade, etc.) because they only ship in
# the main tree as ~amd64 or only live in GURU.
if [[ -d /var/db/repos/guru ]]; then
log "GURU overlay already enabled at /var/db/repos/guru — skipping"
else
log "enabling GURU overlay via eselect repository"
# `eselect repository` needs the overlays.xml index; sync first if missing
if ! sudo eselect repository list 2>&1 | grep -qi guru; then
log "fetching overlays.xml index"
sudo emaint sync --auto
fi
sudo eselect repository enable guru
# Sync just the new repo so we don't re-pull the entire gentoo tree
log "syncing GURU overlay"
sudo emaint sync -r guru
log "GURU overlay enabled and synced"
fi
# --- 2. Verify ---
log "enabled overlays:"
eselect repository list 2>&1 | sed 's/^/ /'
# Verify the GURU repo is readable
if [[ ! -f /var/db/repos/guru/profiles/repo_name ]]; then
die "/var/db/repos/guru/profiles/repo_name missing — overlay didn't sync cleanly"
fi
GURU_NAME=$(cat /var/db/repos/guru/profiles/repo_name)
log "GURU repo verified: $GURU_NAME"
log "overlays ready"