From 496920cbdd3f79e8a7826c99c8951d0aa9381e91 Mon Sep 17 00:00:00 2001 From: Mathias Date: Wed, 23 Sep 2026 21:49:06 +0200 Subject: [PATCH] refactor --- AGENTS.md | 4 +- Makefile | 20 +-- README.md | 16 +- _install_skripte/install_kreation_pcks.sh | 16 -- .../themes/themes/catppuccin-mocha/hypr.conf | 2 +- .../themes/themes/catppuccin-mocha/kitty.conf | 2 +- basic/.stow-ignore | 4 - basic/setup.sh | 150 ------------------ hypr/.stow-ignore | 2 - hypr/scripts/setup.sh | 92 ----------- {basic => setup/basic}/packages.txt | 2 +- setup/basic/setup.sh | 68 ++++++++ .../buntes-monster-links.sh | 0 {basic/scripts => setup}/fetch-ports.sh | 8 +- {hypr/scripts => setup/hypr}/packages.txt | 2 +- setup/hypr/setup.sh | 43 +++++ setup/kreation/packages.txt | 24 +++ setup/kreation/setup.sh | 24 +++ setup/lib/common.sh | 124 +++++++++++++++ {_install_skripte => setup}/nextcloud.sh | 0 {term/scripts => setup/term}/packages.txt | 2 +- {term/scripts => setup/term}/setup.sh | 76 ++------- {utils => setup/utils}/packages.txt | 2 +- setup/utils/setup.sh | 24 +++ term/{.stow-ignore => .stow-local-ignore} | 2 - test/entrypoint-test.sh | 69 ++++---- test/lint.sh | 38 +++-- test/probe_stow.sh | 2 +- utils/setup.sh | 74 --------- 29 files changed, 399 insertions(+), 493 deletions(-) delete mode 100755 _install_skripte/install_kreation_pcks.sh delete mode 100644 basic/.stow-ignore delete mode 100644 basic/setup.sh delete mode 100644 hypr/.stow-ignore delete mode 100644 hypr/scripts/setup.sh rename {basic => setup/basic}/packages.txt (92%) create mode 100644 setup/basic/setup.sh rename {_install_skripte => setup}/buntes-monster-links.sh (100%) rename {basic/scripts => setup}/fetch-ports.sh (76%) rename {hypr/scripts => setup/hypr}/packages.txt (92%) create mode 100644 setup/hypr/setup.sh create mode 100644 setup/kreation/packages.txt create mode 100644 setup/kreation/setup.sh create mode 100644 setup/lib/common.sh rename {_install_skripte => setup}/nextcloud.sh (100%) rename {term/scripts => setup/term}/packages.txt (93%) rename {term/scripts => setup/term}/setup.sh (59%) mode change 100755 => 100644 rename {utils => setup/utils}/packages.txt (89%) create mode 100644 setup/utils/setup.sh rename term/{.stow-ignore => .stow-local-ignore} (50%) delete mode 100644 utils/setup.sh diff --git a/AGENTS.md b/AGENTS.md index 456c46e..4534ff7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -15,7 +15,7 @@ Only entries that would be missed without explicit help are included. | Task | Command | Why it matters | |------|---------|----------------| -| **Install required programs** | `bash term/setup.sh`
`bash _install_skripte/install_basic_pcks.sh`
`bash hypr/setup.sh`
`bash _install_skripte/install_kreation_pcks.sh` | These scripts install Neovim, hyprland, VST runtime, and other utilities. Edit `term/packages.txt` to add/remove terminal packages. | +| **Install required programs** | `bash setup/term/setup.sh`
`bash setup/basic/setup.sh`
`bash setup/hypr/setup.sh`
`bash setup/kreation/setup.sh` | These scripts install Neovim, hyprland, VST runtime, and other utilities. Edit `setup/term/packages.txt` to add/remove terminal packages. | | **Link configuration directories** | `ln -s ~/.dotfiles/hypr/.config/hypr ~/.config/hypr`
`ln -s ~/.dotfiles/term/.config/nvim ~/.config/nvim` | The repository expects the configs to live in `~/.config`. | | **Add VST plugin** | Copy `kreation/.vst3/MT-PowerDrumKit.vst3` into your DAW’s plugins folder (usually `~/.vst`). | The repo contains a pre‑built VST for use in audio software. | @@ -26,7 +26,7 @@ Only entries that would be missed without explicit help are included. | Item | Detail | |------|--------| -| **Wayland compositor** | Requires `hyprland` (and dependencies like `wlroots`). The script `hypr/setup.sh` installs it from `hypr/packages.txt`. | +| **Wayland compositor** | Requires `hyprland` (and dependencies like `wlroots`). The script `setup/hypr/setup.sh` installs it from `setup/hypr/packages.txt`. | | **MIME defaults** | Run `bash hypr/.config/hypr/scripts/ensure-env.sh` after installing to set environment variables (`$XDG_DATA_HOME`, etc.). | | **Dolphin file associations** | `bash hypr/.config/hypr/scripts/fix_dolphin_file_associations.sh` must be executed once to register the compositor with KDE. | | **Portal host override** | `bash hypr/.config/hypr/scripts/portal-host-override.sh` fixes Wayland portal issues on some distros. | diff --git a/Makefile b/Makefile index a8b71b0..263fd9a 100644 --- a/Makefile +++ b/Makefile @@ -6,27 +6,27 @@ # Zweige abhaengen. Die uebrigen Ziele haengen nur von basic ab und sind # untereinander unabhaengig. basic: - bash basic/setup.sh - stow --ignore='.stow-ignore' --ignore='scripts' --ignore='setup.sh' --ignore='packages.txt' basic + bash setup/basic/setup.sh + stow basic term: basic - bash term/scripts/setup.sh - stow --ignore='.stow-ignore' --ignore='scripts' --ignore='\.config/tmux/plugins' term + bash setup/term/setup.sh + stow term utils: basic - bash utils/setup.sh - bash _install_skripte/nextcloud.sh + bash setup/utils/setup.sh + bash setup/nextcloud.sh hypr: basic - bash hypr/scripts/setup.sh - stow --ignore='.stow-ignore' --ignore='scripts' hypr + bash setup/hypr/setup.sh + stow hypr kreation: basic - bash _install_skripte/install_kreation_pcks.sh + bash setup/kreation/setup.sh stow kreation buntes-monster: hypr kreation - _install_skripte/buntes-monster-links.sh + bash setup/buntes-monster-links.sh # --------------------------------------------------------------------------- # Testing (see README.md "Testing" and test/ for details) diff --git a/README.md b/README.md index b01b001..1b44415 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Personal configuration files for an Arch Linux workstation (Hyprland + Neovim + | `hypr/` | Hyprland compositor config + Noctalia shell config (Catppuccin Mocha) | | `kreation/`| VST plugin (`MT-PowerDrumKit.vst3`) | | `local_ai/`| Local AI / MCP tooling config | -| `_install_skripte/` | Miscellaneous install helper scripts | +| `setup/` | Install/setup scripts + package lists (one subdir per target, shared helpers in `setup/lib/`; not stowed) | | `test/` | Docker test harness (lint + smoke tests) | Each top-level directory is a **stow package**. `stow` symlinks the files from the repository into your home directory (e.g. `term/.config/...` → `~/.config/...`). @@ -43,8 +43,8 @@ Run `make ` from the repository root. Each target first runs the relevan | Target | What it does | |--------|--------------| -| `make term` | Runs `term/setup.sh` (installs terminal packages, sets fish as default shell, clones tmuxifier), then `stow term`. Pulls in `basic`. | -| `make basic` | Runs `basic/setup.sh`: enables multilib, updates the system, installs `yay` if missing, installs the `basic/packages.txt` packages, and sets up Docker (enables/starts the service, adds your user to the `docker` group, verifies the service) | +| `make term` | Runs `setup/term/setup.sh` (installs terminal packages, sets fish as default shell, clones tmuxifier), then `stow term`. Pulls in `basic`. | +| `make basic` | Runs `setup/basic/setup.sh`: enables multilib, updates the system, installs `yay` if missing, installs the `setup/basic/packages.txt` packages, and sets up Docker (enables/starts the service, adds your user to the `docker` group, verifies the service) | | `make hypr` | `make basic`, installs Hyprland packages, stows `hypr`, runs the Hyprland setup scripts (`ensure-env.sh`, `portal-host-override.sh`, `fix_dolphin_file_associations.sh`) | | `make kreation` | `make basic`, installs VST runtime, stows `kreation` | | `make buntes-monster` | Everything (`basic` + `hypr` + `kreation`), then wires up symlinks | @@ -54,7 +54,7 @@ Run `make ` from the repository root. Each target first runs the relevan The terminal package list lives in a single editable file: ``` -term/packages.txt +setup/term/packages.txt ``` Add/remove packages on separate lines. Lines starting with `#` are ignored, and you can switch between package sources with section markers: @@ -65,12 +65,12 @@ Add/remove packages on separate lines. Lines starting with `#` are ignored, and @npm # install via npm -g ``` -The default section is `@pacman`. The AUR helper `yay` is bootstrapped automatically by `basic/setup.sh`. +The default section is `@pacman`. The AUR helper `yay` is bootstrapped automatically by `setup/basic/setup.sh`. ## What the install scripts do -- **`basic/setup.sh`** – enables multilib, updates the system (`pacman -Syu`), ensures `yay` is installed, reads `basic/packages.txt` and installs all packages with `--needed` (skips already-installed ones), and sets up Docker (`sudo systemctl enable --now docker`, adds the current user to the `docker` group, checks the service). Idempotent and safe to re-run. -- **`term/setup.sh`** – reads `term/packages.txt` and installs all packages (pacman/AUR via `yay --needed`, npm via `sudo npm install -g`), sets `fish` as the default shell (`chsh`), clones `tmuxifier`, adds the `git` yazi plugin (skips if already present), and runs `sudo updatedb`. Idempotent and safe to re-run. +- **`setup/basic/setup.sh`** – enables multilib, updates the system (`pacman -Syu`), ensures `yay` is installed, reads `setup/basic/packages.txt` and installs all packages with `--needed` (skips already-installed ones), and sets up Docker (`sudo systemctl enable --now docker`, adds the current user to the `docker` group, checks the service). Idempotent and safe to re-run. +- **`setup/term/setup.sh`** – reads `setup/term/packages.txt` and installs all packages (pacman/AUR via `yay --needed`, npm via `sudo npm install -g`), sets `fish` as the default shell (`chsh`), clones `tmuxifier`, adds the `git` yazi plugin (skips if already present), and runs `sudo updatedb`. Idempotent and safe to re-run. ## Stow: resolving conflicts with existing paths @@ -138,7 +138,7 @@ There are **two tiers**: | Target | What it does | Docker required? | |--------|--------------|------------------| -| `make test-lint` | Fast, offline integrity checks: `bash -n` syntax pass over every script, `shellcheck` (if installed), `packages.txt` marker validation, and Makefile ↔ script/stow-package name consistency. Catches typos like `_install_skripte_install_basic_pcks.sh` (missing `/`). | No | +| `make test-lint` | Fast, offline integrity checks: `bash -n` syntax pass over every script, `shellcheck` (if installed), `packages.txt` marker validation, and Makefile ↔ script/stow-package name consistency. Catches typos like `setup/basic/setuo.sh` (missing `/`). | No | | `make test-stow` | `stow --simulate` for every stow-able package; fails if a package the Makefile stows doesn't exist (e.g. `stow nvim` — nvim lives under `term/`). | No | | `make test-shellcheck` | Runs shellcheck over all tracked scripts (shellcheck must be installed). | No | | `make test-lint-docker` | Builds the `/dev` stage (`archlinux:latest` + shellcheck) and runs `test/lint.sh` inside it. | Yes | diff --git a/_install_skripte/install_kreation_pcks.sh b/_install_skripte/install_kreation_pcks.sh deleted file mode 100755 index 01185a9..0000000 --- a/_install_skripte/install_kreation_pcks.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -sudo pacman -S --needed \ - reaper \ - guitarix \ - kdenlive \ - yabridge \ - yabridgectl \ - obs-studio \ - surge-xt \ - lsp-plugins \ - calf \ - dragonfly-reverb - -yay -S --needed \ - numaplayer diff --git a/basic/.config/themes/themes/catppuccin-mocha/hypr.conf b/basic/.config/themes/themes/catppuccin-mocha/hypr.conf index 900fce9..bda15d4 100644 --- a/basic/.config/themes/themes/catppuccin-mocha/hypr.conf +++ b/basic/.config/themes/themes/catppuccin-mocha/hypr.conf @@ -1,6 +1,6 @@ # Central theme: catppuccin-mocha (Catppuccin Mocha), hyprland $vars. # Part of basic/.config/themes. Managed file: refresh via -# basic/scripts/fetch-ports.sh +# setup/fetch-ports.sh # (upstream: catppuccin/hyprland generated mocha.conf). # Hyprland consumers load it via: source = ~/.config/themes/current/hypr.conf diff --git a/basic/.config/themes/themes/catppuccin-mocha/kitty.conf b/basic/.config/themes/themes/catppuccin-mocha/kitty.conf index 4d37c4e..645ba32 100644 --- a/basic/.config/themes/themes/catppuccin-mocha/kitty.conf +++ b/basic/.config/themes/themes/catppuccin-mocha/kitty.conf @@ -1,6 +1,6 @@ # Central theme: catppuccin-mocha (Catppuccin Mocha), kitty colors. # Part of basic/.config/themes. Managed file: refresh via -# basic/scripts/fetch-ports.sh +# setup/fetch-ports.sh # (upstream: catppuccin/kitty themes/mocha.conf). # vim:ft=kitty diff --git a/basic/.stow-ignore b/basic/.stow-ignore deleted file mode 100644 index 94fffe5..0000000 --- a/basic/.stow-ignore +++ /dev/null @@ -1,4 +0,0 @@ -setup.sh -packages.txt -scripts -.stow-ignore diff --git a/basic/setup.sh b/basic/setup.sh deleted file mode 100644 index 1750d65..0000000 --- a/basic/setup.sh +++ /dev/null @@ -1,150 +0,0 @@ -#!/bin/bash -set -euo pipefail - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PACKAGES_FILE="$SCRIPT_DIR/packages.txt" - -# --------------------------------------------------------------------------- -# Enable multilib in /etc/pacman.conf (with a safety backup) -# --------------------------------------------------------------------------- -enable_multilib() { - sudo sed -i.bak '/^#\[multilib\]/,+1 s/^#//' /etc/pacman.conf -} - -# --------------------------------------------------------------------------- -# Ensure yay (AUR helper) is installed. -# --------------------------------------------------------------------------- -install_yay() { - if pacman -Q yay &>/dev/null; then - echo "yay bereits installiert; fahre fort." - return - fi - if pacman -Si yay &>/dev/null; then - echo "Installiere yay mit pacman ..." - sudo pacman -S --needed yay - return - fi - echo "installiere yay via git ..." - sudo pacman -S --needed base-devel git - local tmp - tmp="$(mktemp -d)" - git clone https://aur.archlinux.org/yay.git "$tmp/yay" - ( - cd "$tmp/yay" - makepkg -si - ) - rm -rf "$tmp" -} - -# --------------------------------------------------------------------------- -# Read packages.txt, split into pacman / aur / npm sections. -# --------------------------------------------------------------------------- -read_packages() { - local section="pacman" - local current - current="" - while IFS= read -r line || [[ -n "$line" ]]; do - current="${line%%#*}" - current="${current##*( )}" - current="${current%%*( )}" - [[ -z "$current" ]] && continue - case "$current" in - @pacman) section="pacman" ;; - @aur) section="aur" ;; - @npm) section="npm" ;; - *) - case "$section" in - pacman) pacman_pkgs+=("$current") ;; - aur) aur_pkgs+=("$current") ;; - npm) npm_pkgs+=("$current") ;; - esac - ;; - esac - done < "$PACKAGES_FILE" -} - -declare -a pacman_pkgs=() aur_pkgs=() npm_pkgs=() - -# --------------------------------------------------------------------------- -# Install sections. -# --------------------------------------------------------------------------- -install_pacman() { - if ((${#pacman_pkgs[@]})); then - echo "==> Installiere Pacman-Pakete: ${pacman_pkgs[*]}" - yay -S --needed "${pacman_pkgs[@]}" - fi -} - -install_aur() { - if ((${#aur_pkgs[@]})); then - echo "==> Installiere AUR-Pakete: ${aur_pkgs[*]}" - yay -S --needed "${aur_pkgs[@]}" - fi -} - -install_npm() { - if ((${#npm_pkgs[@]})); then - echo "==> Installiere globale npm-Pakete: ${npm_pkgs[*]}" - npm install -g "${npm_pkgs[@]}" - fi -} - -# --------------------------------------------------------------------------- -# Docker: Dienst aktivieren/starten, Benutzer in die docker-Gruppe aufnehmen -# und den Dienst verifizieren. (docker selbst wird ueber basic/packages.txt -# als Pacman-Paket installiert.) -# --------------------------------------------------------------------------- -setup_docker() { - if ! command -v docker >/dev/null 2>&1; then - echo "Warnung: docker nicht installiert; ueberspringe Docker-Setup." - return - fi - - echo "==> Aktiviere und starte Docker-Dienst ..." - sudo systemctl enable --now docker - - # Bei Aufruf via `sudo