3 Commits

5 changed files with 76 additions and 208 deletions

View File

@@ -1,3 +1,8 @@
## [0.1.1] - 2025-12-10
* PKGMGR will now be pulled again
## [0.1.0] - 2025-12-09
* Added Nix support role

View File

@@ -1,132 +1,60 @@
# ------------------------------------------------------------
# Infinito dev container (multi-distro)
# ------------------------------------------------------------
ARG BASE_IMAGE=archlinux:latest
FROM ${BASE_IMAGE}
FROM archlinux:latest
# ------------------------------------------------------------
# Base dependencies per distro
# - git, python, venv tooling
# - docker CLI (best-effort)
# - rsync, build tools, CA certificates
# ------------------------------------------------------------
RUN set -e; \
if [ -f /etc/os-release ]; then \
. /etc/os-release; \
else \
echo "ERROR: /etc/os-release not found, cannot detect distro."; \
exit 1; \
fi; \
echo "[infinito] Detected base distro: ${ID:-unknown}"; \
case "${ID}" in \
arch) \
pacman -Syu --noconfirm \
base-devel \
git \
python \
python-pip \
python-setuptools \
rsync \
alsa-lib \
go \
docker \
curl \
ca-certificates; \
pacman -Scc --noconfirm; \
# Ensure python3 exists (Arch only ships 'python' by default) \
if [ ! -x /usr/bin/python3 ]; then \
ln -sf /usr/bin/python /usr/bin/python3; \
fi; \
# Stub systemctl and yay to avoid side effects in containers \
printf '#!/bin/sh\nexit 0\n' > /usr/bin/systemctl; \
chmod +x /usr/bin/systemctl; \
printf '#!/bin/sh\nexit 0\n' > /usr/bin/yay; \
chmod +x /usr/bin/yay; \
;; \
debian|ubuntu) \
apt-get update; \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
git \
python3 \
python3-venv \
python3-pip \
python3-setuptools \
rsync \
libasound2 \
docker.io \
curl \
ca-certificates; \
rm -rf /var/lib/apt/lists/*; \
;; \
fedora|rhel|centos) \
dnf -y update; \
dnf -y install \
git \
python3 \
python3-pip \
python3-setuptools \
make \
gcc \
rsync \
alsa-lib \
docker \
curl \
ca-certificates \
xz; \
dnf clean all; \
;; \
*) \
echo "ERROR: Unsupported base distro '${ID}'."; \
exit 1; \
;; \
esac
# 1) Pakete inkl. docker (damit docker CLI im Container vorhanden ist)
RUN pacman -Syu --noconfirm \
base-devel \
git \
python \
python-pip \
python-setuptools \
alsa-lib \
go \
rsync \
docker \
&& pacman -Scc --noconfirm
# ------------------------------------------------------------
# pkgmgr via Python venv (distro-agnostic)
# ------------------------------------------------------------
# 2) systemctl & yay stubben
RUN printf '#!/bin/sh\nexit 0\n' > /usr/bin/systemctl \
&& chmod +x /usr/bin/systemctl \
&& printf '#!/bin/sh\nexit 0\n' > /usr/bin/yay \
&& chmod +x /usr/bin/yay
# 3) python-simpleaudio aus AUR
RUN useradd -m aur_builder \
&& su aur_builder -c "git clone https://aur.archlinux.org/python-simpleaudio.git /home/aur_builder/psa && \
cd /home/aur_builder/psa && \
makepkg --noconfirm --skippgpcheck" \
&& pacman -U --noconfirm /home/aur_builder/psa/*.pkg.tar.zst \
&& rm -rf /home/aur_builder/psa
# 4) pkgmgr + venv
ENV PKGMGR_REPO=/opt/package-manager \
PKGMGR_VENV=/root/.venvs/pkgmgr
RUN git clone https://github.com/kevinveenbirkenbach/package-manager.git "$PKGMGR_REPO" \
&& python3 -m venv "$PKGMGR_VENV" \
&& "$PKGMGR_VENV/bin/pip" install --upgrade pip \
&& "$PKGMGR_VENV/bin/pip" install --no-cache-dir \
-r "$PKGMGR_REPO/requirements.txt" \
ansible \
simpleaudio \
RUN git clone https://github.com/kevinveenbirkenbach/package-manager.git $PKGMGR_REPO \
&& python -m venv $PKGMGR_VENV \
&& $PKGMGR_VENV/bin/pip install --upgrade pip \
&& $PKGMGR_VENV/bin/pip install --no-cache-dir -r $PKGMGR_REPO/requirements.txt ansible \
&& printf '#!/bin/sh\n. %s/bin/activate\nexec python %s/main.py "$@"\n' \
"$PKGMGR_VENV" "$PKGMGR_REPO" > /usr/local/bin/pkgmgr \
&& chmod +x /usr/local/bin/pkgmgr
ENV PATH="$PKGMGR_VENV/bin:/root/.local/bin:${PATH}"
# ------------------------------------------------------------
# Copy local Infinito source into the image
# ------------------------------------------------------------
# 6) Infinito.Nexus Quelle rein
COPY . /opt/infinito-src
# ------------------------------------------------------------
# Install Infinito via pkgmgr (shallow clone)
# ------------------------------------------------------------
# 7) Infinito via pkgmgr (shallow)
RUN pkgmgr install infinito --clone-mode shallow
# ------------------------------------------------------------
# Override installed Infinito with local source
# (keeps pkgmgr metadata, but code comes from /opt/infinito-src)
# ------------------------------------------------------------
RUN INFINITO_PATH="$(pkgmgr path infinito)" && \
rm -rf "${INFINITO_PATH:?}"/* && \
rsync -a --delete --exclude='.git' /opt/infinito-src/ "${INFINITO_PATH}/"
# 8) Override mit lokaler Quelle
RUN INFINITO_PATH=$(pkgmgr path infinito) && \
rm -rf "$INFINITO_PATH"/* && \
rsync -a --delete --exclude='.git' /opt/infinito-src/ "$INFINITO_PATH"/
# ------------------------------------------------------------
# Symlink infinito CLI into PATH
# ------------------------------------------------------------
RUN INFINITO_PATH="$(pkgmgr path infinito)" && \
ln -sf "${INFINITO_PATH}/main.py" /usr/local/bin/infinito && \
# 9) Symlink
RUN INFINITO_PATH=$(pkgmgr path infinito) && \
ln -sf "$INFINITO_PATH"/main.py /usr/local/bin/infinito && \
chmod +x /usr/local/bin/infinito
# ------------------------------------------------------------
# Default command: show help and keep container running
# ------------------------------------------------------------
CMD sh -c "infinito --help && exec tail -f /dev/null"

View File

@@ -1,24 +1,3 @@
# ------------------------------------------------------------
# Multi-distro Docker build configuration (similar to pkgmgr)
# ------------------------------------------------------------
DISTROS := arch debian ubuntu fedora centos
BASE_IMAGE_ARCH := archlinux:latest
BASE_IMAGE_DEBIAN := debian:stable-slim
BASE_IMAGE_UBUNTU := ubuntu:latest
BASE_IMAGE_FEDORA := fedora:latest
BASE_IMAGE_CENTOS := quay.io/centos/centos:stream9
# Make them available to scripts (if you later add resolve-base-image.sh, etc.)
export DISTROS
export BASE_IMAGE_ARCH
export BASE_IMAGE_DEBIAN
export BASE_IMAGE_UBUNTU
export BASE_IMAGE_FEDORA
export BASE_IMAGE_CENTOS
# ------------------------------------------------------------
# Infinito roles/config generation
# ------------------------------------------------------------
ROLES_DIR := ./roles
APPLICATIONS_OUT := ./group_vars/all/04_applications.yml
APPLICATIONS_SCRIPT := ./cli/build/defaults/applications.py
@@ -40,36 +19,31 @@ RESERVED_USERNAMES := $(shell \
| paste -sd, - \
)
.PHONY: build install test clean clean-keep-logs list tree mig dockerignore \
messy-build messy-test \
docker-build docker-build-no-cache
.PHONY: build install test
# ------------------------------------------------------------
# Core project targets
# ------------------------------------------------------------
clean-keep-logs:
@echo "🧹 Cleaning ignored files but keeping logs/…"
git clean -fdX -- ':!logs' ':!logs/**'
clean:
@echo "🧹 Removing ignored git files"
@echo "Removing ignored git files"
git clean -fdX
list:
@echo "📦 Generating the roles list…"
@echo Generating the roles list
python3 main.py build roles_list
tree:
@echo "🌳 Generating roles tree…"
@echo Generating Tree
python3 main.py build tree -D 2 --no-signal
mig: list tree
@echo "🔗 Creating meta data for meta infinity graph…"
@echo Creating meta data for meta infinity graph
dockerignore:
@echo "📝 Creating .dockerignore from .gitignore…"
@echo Create dockerignore
cat .gitignore > .dockerignore
echo ".git" >> .dockerignore
echo ".git" >> .dockerignore
messy-build: dockerignore
@echo "🔧 Generating users defaults → $(USERS_OUT)"
@@ -95,7 +69,7 @@ messy-build: dockerignore
echo "$$out"; \
)
messy-test:
messy-test:
@echo "🧪 Running Python tests…"
PYTHONPATH=. python -m unittest discover -s tests
@echo "📑 Checking Ansible syntax…"
@@ -105,60 +79,7 @@ install: build
@echo "⚙️ Install complete."
build: clean messy-build
@echo "Full build (with cleanup) finished."
@echo "Full build with cleanup before was executed."
test: build messy-test
@echo "Full test (with build) finished."
# ------------------------------------------------------------
# Docker: multi-distro dev containers for Infinito
# Uses the multi-distro Dockerfile with ARG BASE_IMAGE
# ------------------------------------------------------------
# Helper to map distro → BASE_IMAGE_* variable
define _infinito_base_image
$(if $(filter $(1),arch),$(BASE_IMAGE_ARCH),\
$(if $(filter $(1),debian),$(BASE_IMAGE_DEBIAN),\
$(if $(filter $(1),ubuntu),$(BASE_IMAGE_UBUNTU),\
$(if $(filter $(1),fedora),$(BASE_IMAGE_FEDORA),\
$(if $(filter $(1),centos),$(BASE_IMAGE_CENTOS),)))))
endef
docker-build:
@echo "============================================================"
@echo ">>> Building Infinito dev containers for: $(DISTROS)"
@echo "============================================================"
@for distro in $(DISTROS); do \
base_image="$(call _infinito_base_image,$$distro)"; \
image_name="infinito-dev-$$distro"; \
echo; \
echo "------------------------------------------------------------"; \
echo ">>> Building $$image_name (BASE_IMAGE=$$base_image)…"; \
echo "------------------------------------------------------------"; \
docker build \
--build-arg BASE_IMAGE="$$base_image" \
-t "$$image_name" \
. || exit $$?; \
done
@echo
@echo "✅ All Infinito dev images built."
docker-build-no-cache:
@echo "============================================================"
@echo ">>> Building Infinito dev containers (NO CACHE) for: $(DISTROS)"
@echo "============================================================"
@for distro in $(DISTROS); do \
base_image="$(call _infinito_base_image,$$distro)"; \
image_name="infinito-dev-$$distro"; \
echo; \
echo "------------------------------------------------------------"; \
echo ">>> Building $$image_name with NO CACHE (BASE_IMAGE=$$base_image)…"; \
echo "------------------------------------------------------------"; \
docker build \
--no-cache \
--build-arg BASE_IMAGE="$$base_image" \
-t "$$image_name" \
. || exit $$?; \
done
@echo
@echo "✅ All Infinito dev images built (no cache)."
@echo "Full test with build before was executed."

View File

@@ -6,7 +6,7 @@
- name: update pkgmgr
shell: |
source ~/.venvs/pkgmgr/bin/activate
pkgmgr update pkgmgr
pkgmgr update pkgmgr --clone-mode shallow
register: pkgmgr_update
changed_when: "'already up to date' not in (pkgmgr_update.stdout | lower)"

View File

@@ -2,9 +2,9 @@
include_role:
name: '{{ item }}'
loop:
- dev-git
- dev-make
- dev-python-yaml
- dev-git
- dev-make
- dev-python-yaml
- name: Ensure OpenSSH client is installed
community.general.pacman:
@@ -27,7 +27,21 @@
mode: '0755'
become: true
- name: Clone Kevin's Package Manager repository
- name: Check if pkgmgr git repo already exists
stat:
path: "{{ PKGMGR_INSTALL_PATH }}/.git"
register: pkgmgr_git_repo
become: true
- name: Remove legacy 'latest' tag from existing pkgmgr repo (if present)
command: git tag -d latest
args:
chdir: "{{ PKGMGR_INSTALL_PATH }}"
when: pkgmgr_git_repo.stat.exists
ignore_errors: true
become: true
- name: Clone Kevin's Package Manager repository (always latest HEAD)
git:
repo: "{{ PKGMGR_REPO_URL }}"
dest: "{{ PKGMGR_INSTALL_PATH }}"
@@ -55,4 +69,4 @@
command: "pkgmgr pull --all"
when: MODE_UPDATE | bool
- include_tasks: utils/once/flag.yml
- include_tasks: utils/once/flag.yml