mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-12-13 12:44:38 +00:00
Compare commits
3 Commits
feature/mu
...
v0.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
| a3ba40edb6 | |||
| f9825ac4fc | |||
| 9d66910120 |
@@ -1,3 +1,8 @@
|
|||||||
|
## [0.1.1] - 2025-12-10
|
||||||
|
|
||||||
|
* PKGMGR will now be pulled again
|
||||||
|
|
||||||
|
|
||||||
## [0.1.0] - 2025-12-09
|
## [0.1.0] - 2025-12-09
|
||||||
|
|
||||||
* Added Nix support role
|
* Added Nix support role
|
||||||
|
|||||||
154
Dockerfile
154
Dockerfile
@@ -1,132 +1,60 @@
|
|||||||
# ------------------------------------------------------------
|
FROM archlinux:latest
|
||||||
# Infinito dev container (multi-distro)
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
ARG BASE_IMAGE=archlinux:latest
|
|
||||||
FROM ${BASE_IMAGE}
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# 1) Pakete inkl. docker (damit docker CLI im Container vorhanden ist)
|
||||||
# Base dependencies per distro
|
RUN pacman -Syu --noconfirm \
|
||||||
# - git, python, venv tooling
|
base-devel \
|
||||||
# - docker CLI (best-effort)
|
git \
|
||||||
# - rsync, build tools, CA certificates
|
python \
|
||||||
# ------------------------------------------------------------
|
python-pip \
|
||||||
RUN set -e; \
|
python-setuptools \
|
||||||
if [ -f /etc/os-release ]; then \
|
alsa-lib \
|
||||||
. /etc/os-release; \
|
go \
|
||||||
else \
|
rsync \
|
||||||
echo "ERROR: /etc/os-release not found, cannot detect distro."; \
|
docker \
|
||||||
exit 1; \
|
&& pacman -Scc --noconfirm
|
||||||
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
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# 2) systemctl & yay stubben
|
||||||
# pkgmgr via Python venv (distro-agnostic)
|
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 \
|
ENV PKGMGR_REPO=/opt/package-manager \
|
||||||
PKGMGR_VENV=/root/.venvs/pkgmgr
|
PKGMGR_VENV=/root/.venvs/pkgmgr
|
||||||
|
|
||||||
RUN git clone https://github.com/kevinveenbirkenbach/package-manager.git "$PKGMGR_REPO" \
|
RUN git clone https://github.com/kevinveenbirkenbach/package-manager.git $PKGMGR_REPO \
|
||||||
&& python3 -m venv "$PKGMGR_VENV" \
|
&& python -m venv $PKGMGR_VENV \
|
||||||
&& "$PKGMGR_VENV/bin/pip" install --upgrade pip \
|
&& $PKGMGR_VENV/bin/pip install --upgrade pip \
|
||||||
&& "$PKGMGR_VENV/bin/pip" install --no-cache-dir \
|
&& $PKGMGR_VENV/bin/pip install --no-cache-dir -r $PKGMGR_REPO/requirements.txt ansible \
|
||||||
-r "$PKGMGR_REPO/requirements.txt" \
|
|
||||||
ansible \
|
|
||||||
simpleaudio \
|
|
||||||
&& printf '#!/bin/sh\n. %s/bin/activate\nexec python %s/main.py "$@"\n' \
|
&& printf '#!/bin/sh\n. %s/bin/activate\nexec python %s/main.py "$@"\n' \
|
||||||
"$PKGMGR_VENV" "$PKGMGR_REPO" > /usr/local/bin/pkgmgr \
|
"$PKGMGR_VENV" "$PKGMGR_REPO" > /usr/local/bin/pkgmgr \
|
||||||
&& chmod +x /usr/local/bin/pkgmgr
|
&& chmod +x /usr/local/bin/pkgmgr
|
||||||
|
|
||||||
ENV PATH="$PKGMGR_VENV/bin:/root/.local/bin:${PATH}"
|
ENV PATH="$PKGMGR_VENV/bin:/root/.local/bin:${PATH}"
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# 6) Infinito.Nexus Quelle rein
|
||||||
# Copy local Infinito source into the image
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
COPY . /opt/infinito-src
|
COPY . /opt/infinito-src
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# 7) Infinito via pkgmgr (shallow)
|
||||||
# Install Infinito via pkgmgr (shallow clone)
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
RUN pkgmgr install infinito --clone-mode shallow
|
RUN pkgmgr install infinito --clone-mode shallow
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# 8) Override mit lokaler Quelle
|
||||||
# Override installed Infinito with local source
|
RUN INFINITO_PATH=$(pkgmgr path infinito) && \
|
||||||
# (keeps pkgmgr metadata, but code comes from /opt/infinito-src)
|
rm -rf "$INFINITO_PATH"/* && \
|
||||||
# ------------------------------------------------------------
|
rsync -a --delete --exclude='.git' /opt/infinito-src/ "$INFINITO_PATH"/
|
||||||
RUN INFINITO_PATH="$(pkgmgr path infinito)" && \
|
|
||||||
rm -rf "${INFINITO_PATH:?}"/* && \
|
|
||||||
rsync -a --delete --exclude='.git' /opt/infinito-src/ "${INFINITO_PATH}/"
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# 9) Symlink
|
||||||
# Symlink infinito CLI into PATH
|
RUN INFINITO_PATH=$(pkgmgr path infinito) && \
|
||||||
# ------------------------------------------------------------
|
ln -sf "$INFINITO_PATH"/main.py /usr/local/bin/infinito && \
|
||||||
RUN INFINITO_PATH="$(pkgmgr path infinito)" && \
|
|
||||||
ln -sf "${INFINITO_PATH}/main.py" /usr/local/bin/infinito && \
|
|
||||||
chmod +x /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"
|
CMD sh -c "infinito --help && exec tail -f /dev/null"
|
||||||
|
|||||||
99
Makefile
99
Makefile
@@ -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
|
ROLES_DIR := ./roles
|
||||||
APPLICATIONS_OUT := ./group_vars/all/04_applications.yml
|
APPLICATIONS_OUT := ./group_vars/all/04_applications.yml
|
||||||
APPLICATIONS_SCRIPT := ./cli/build/defaults/applications.py
|
APPLICATIONS_SCRIPT := ./cli/build/defaults/applications.py
|
||||||
@@ -40,36 +19,31 @@ RESERVED_USERNAMES := $(shell \
|
|||||||
| paste -sd, - \
|
| paste -sd, - \
|
||||||
)
|
)
|
||||||
|
|
||||||
.PHONY: build install test clean clean-keep-logs list tree mig dockerignore \
|
.PHONY: build install test
|
||||||
messy-build messy-test \
|
|
||||||
docker-build docker-build-no-cache
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# Core project targets
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
clean-keep-logs:
|
clean-keep-logs:
|
||||||
@echo "🧹 Cleaning ignored files but keeping logs/…"
|
@echo "🧹 Cleaning ignored files but keeping logs/…"
|
||||||
git clean -fdX -- ':!logs' ':!logs/**'
|
git clean -fdX -- ':!logs' ':!logs/**'
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo "🧹 Removing ignored git files…"
|
@echo "Removing ignored git files"
|
||||||
git clean -fdX
|
git clean -fdX
|
||||||
|
|
||||||
list:
|
list:
|
||||||
@echo "📦 Generating the roles list…"
|
@echo Generating the roles list
|
||||||
python3 main.py build roles_list
|
python3 main.py build roles_list
|
||||||
|
|
||||||
tree:
|
tree:
|
||||||
@echo "🌳 Generating roles tree…"
|
@echo Generating Tree
|
||||||
python3 main.py build tree -D 2 --no-signal
|
python3 main.py build tree -D 2 --no-signal
|
||||||
|
|
||||||
mig: list tree
|
mig: list tree
|
||||||
@echo "🔗 Creating meta data for meta infinity graph…"
|
@echo Creating meta data for meta infinity graph
|
||||||
|
|
||||||
dockerignore:
|
dockerignore:
|
||||||
@echo "📝 Creating .dockerignore from .gitignore…"
|
@echo Create dockerignore
|
||||||
cat .gitignore > .dockerignore
|
cat .gitignore > .dockerignore
|
||||||
echo ".git" >> .dockerignore
|
echo ".git" >> .dockerignore
|
||||||
|
|
||||||
messy-build: dockerignore
|
messy-build: dockerignore
|
||||||
@echo "🔧 Generating users defaults → $(USERS_OUT)…"
|
@echo "🔧 Generating users defaults → $(USERS_OUT)…"
|
||||||
@@ -95,7 +69,7 @@ messy-build: dockerignore
|
|||||||
echo " ✅ $$out"; \
|
echo " ✅ $$out"; \
|
||||||
)
|
)
|
||||||
|
|
||||||
messy-test:
|
messy-test:
|
||||||
@echo "🧪 Running Python tests…"
|
@echo "🧪 Running Python tests…"
|
||||||
PYTHONPATH=. python -m unittest discover -s tests
|
PYTHONPATH=. python -m unittest discover -s tests
|
||||||
@echo "📑 Checking Ansible syntax…"
|
@echo "📑 Checking Ansible syntax…"
|
||||||
@@ -105,60 +79,7 @@ install: build
|
|||||||
@echo "⚙️ Install complete."
|
@echo "⚙️ Install complete."
|
||||||
|
|
||||||
build: clean messy-build
|
build: clean messy-build
|
||||||
@echo "✅ Full build (with cleanup) finished."
|
@echo "Full build with cleanup before was executed."
|
||||||
|
|
||||||
test: build messy-test
|
test: build messy-test
|
||||||
@echo "✅ Full test (with build) finished."
|
@echo "Full test with build before was executed."
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
|
||||||
# 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)."
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
- name: update pkgmgr
|
- name: update pkgmgr
|
||||||
shell: |
|
shell: |
|
||||||
source ~/.venvs/pkgmgr/bin/activate
|
source ~/.venvs/pkgmgr/bin/activate
|
||||||
pkgmgr update pkgmgr
|
pkgmgr update pkgmgr --clone-mode shallow
|
||||||
register: pkgmgr_update
|
register: pkgmgr_update
|
||||||
changed_when: "'already up to date' not in (pkgmgr_update.stdout | lower)"
|
changed_when: "'already up to date' not in (pkgmgr_update.stdout | lower)"
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
include_role:
|
include_role:
|
||||||
name: '{{ item }}'
|
name: '{{ item }}'
|
||||||
loop:
|
loop:
|
||||||
- dev-git
|
- dev-git
|
||||||
- dev-make
|
- dev-make
|
||||||
- dev-python-yaml
|
- dev-python-yaml
|
||||||
|
|
||||||
- name: Ensure OpenSSH client is installed
|
- name: Ensure OpenSSH client is installed
|
||||||
community.general.pacman:
|
community.general.pacman:
|
||||||
@@ -27,7 +27,21 @@
|
|||||||
mode: '0755'
|
mode: '0755'
|
||||||
become: true
|
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:
|
git:
|
||||||
repo: "{{ PKGMGR_REPO_URL }}"
|
repo: "{{ PKGMGR_REPO_URL }}"
|
||||||
dest: "{{ PKGMGR_INSTALL_PATH }}"
|
dest: "{{ PKGMGR_INSTALL_PATH }}"
|
||||||
@@ -55,4 +69,4 @@
|
|||||||
command: "pkgmgr pull --all"
|
command: "pkgmgr pull --all"
|
||||||
when: MODE_UPDATE | bool
|
when: MODE_UPDATE | bool
|
||||||
|
|
||||||
- include_tasks: utils/once/flag.yml
|
- include_tasks: utils/once/flag.yml
|
||||||
|
|||||||
Reference in New Issue
Block a user