From 84db84b5427ea578895a34aeb5aa6799057c989e Mon Sep 17 00:00:00 2001 From: Mathias Scheider Date: Sat, 5 Sep 2026 21:30:54 +0200 Subject: [PATCH] basic and utils: overhaul set-up --- Makefile | 30 ++++-- _install_skripte/install_basic_pcks.sh | 41 ------- basic/packages.txt | 23 ++++ basic/setup.sh | 142 +++++++++++++++++++++++++ term/setup.sh | 43 +------- test/entrypoint-test.sh | 37 ++++--- test/lint.sh | 36 ++++--- utils/packages.txt | 22 ++++ utils/setup.sh | 74 +++++++++++++ 9 files changed, 324 insertions(+), 124 deletions(-) delete mode 100755 _install_skripte/install_basic_pcks.sh create mode 100644 basic/packages.txt create mode 100644 basic/setup.sh create mode 100644 utils/packages.txt create mode 100644 utils/setup.sh diff --git a/Makefile b/Makefile index 8fa7674..e34bef3 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,34 @@ -# setup ist ein Kommando-Target (keine Datei) und soll immer ausgeführt werden. -.PHONY: basic +# Alle Targets sind Kommando-Targets (keine Dateien) und werden immer ausgeführt. +.PHONY: basic term utils hypr kreation buntes-monster -term: +# basic wird immer zuerst eingerichtet: es legt die Basis-Systemumgebung an +# (multilib, yay, Display-Manager, Audio-Stack), von der alle anderen +# Zweige abhaengen. Die uebrigen Ziele haengen nur von basic ab und sind +# untereinander unabhaengig. +basic: + bash basic/setup.sh + +term: basic bash term/setup.sh stow term -basic: term - bash _install_skripte_install_basic_pcks.sh - stow nvim + +utils: basic + bash utils/setup.sh bash _install_skripte/nextcloud.sh + hypr: basic - bash _install_skripte_install_hypr_pcks.sh + bash _install_skripte/install_hypr_pcks.sh stow hypr bash hypr/.config/hypr/scripts/ensure-env.sh bash hypr/.config/hypr/scripts/portal-host-override.sh bash hypr/.config/hypr/scripts/fix_dolphin_file_associations.sh + kreation: basic - bash _install_skripte_install_kreation_pcks.sh + bash _install_skripte/install_kreation_pcks.sh stow kreation -bunters-monster: basic hypr kreation - _install_skripte/buntes-monster-links.sh + +buntes-monster: hypr kreation + _install_skripte/buntes-monster-links.sh # --------------------------------------------------------------------------- # Testing (see README.md "Testing" and test/ for details) diff --git a/_install_skripte/install_basic_pcks.sh b/_install_skripte/install_basic_pcks.sh deleted file mode 100755 index 18f83e4..0000000 --- a/_install_skripte/install_basic_pcks.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -sudo pacman -S --needed \ - firefox \ - nextcloud-client \ - cups \ - wine \ - wine-mono \ - wine-gecko \ - winetricks \ - thunderbird \ - ktouch \ - ktorrent \ - pipewire \ - pipewire-session-manager \ - qpwgraph \ - cifs-utils \ - rbw \ - sddm - -yay -S \ - catppuccin-sddm-theme-mocha - -echo " -[General] -Numlock=on - -[Theme] -ThemeDir=/usr/share/sddm/themes # Standardverzeichnis für Designvorlagen -Current=catppuccin-mocha-blue # Standardthema -CursorTheme=breeze_cursors # Mausthema -FacesDir=/usr/share/sddm/faces # Verzeichnis für Avatarbilder - -[Users] -MaximumUID=1100 -HideUsers=mathieu -" | sudo tee /etc/sddm.conf - -sudo systemctl disable gdm -sudo systemctl enable sddm - diff --git a/basic/packages.txt b/basic/packages.txt new file mode 100644 index 0000000..23a1e17 --- /dev/null +++ b/basic/packages.txt @@ -0,0 +1,23 @@ +# --------------------------------------------------------------------------- +# System package list for basic/setup.sh +# +# Every other dotfile branch depends on these foundational packages +# (base system, display manager, audio stack, AUR helper). +# `basic` is always set up first in the Makefile. +# +# - Lines starting with '#' and blank lines are ignored. +# - Use "@pacman", "@aur" or "@npm" markers to switch section. +# - The default section is @pacman. +# --------------------------------------------------------------------------- + +@pacman +sddm +firefox +cups +pipewire +pipewire-session-manager +qpwgraph +cifs-utils + +@aur +catppuccin-sddm-theme-mocha diff --git a/basic/setup.sh b/basic/setup.sh new file mode 100644 index 0000000..c50d92f --- /dev/null +++ b/basic/setup.sh @@ -0,0 +1,142 @@ +#!/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 +} + +# --------------------------------------------------------------------------- +# Write SDDM configuration and switch display manager from gdm to sddm. +# --------------------------------------------------------------------------- +configure_sddm() { + echo "==> Schreibe /etc/sddm.conf ..." + echo " +[General] +Numlock=on + +[Theme] +ThemeDir=/usr/share/sddm/themes # Standardverzeichnis für Designvorlagen +Current=catppuccin-mocha-blue # Standardthema +CursorTheme=breeze_cursors # Mausthema +FacesDir=/usr/share/sddm/faces # Verzeichnis für Avatarbilder + +[Users] +MaximumUID=1100 +HideUsers=mathieu +" | sudo tee /etc/sddm.conf >/dev/null + + echo "==> Deaktiviere gdm, aktiviere sddm ..." + sudo systemctl disable gdm + sudo systemctl enable sddm +} + +# --------------------------------------------------------------------------- +# Main +# --------------------------------------------------------------------------- +main() { + echo "==> Aktiviere multilib ..." + enable_multilib + + echo "==> System aktualisieren ..." + sudo pacman -Syu + + echo "==> Sicherstelle yay ..." + install_yay + + echo "==> Lese Paketliste: $PACKAGES_FILE" + read_packages + + install_pacman + install_aur + install_npm + + configure_sddm + + echo "Fertig. Die Basis-Systemumgebung ist eingerichtet." +} + +main diff --git a/term/setup.sh b/term/setup.sh index b491dad..6a3cd4d 100755 --- a/term/setup.sh +++ b/term/setup.sh @@ -4,38 +4,6 @@ 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. # --------------------------------------------------------------------------- @@ -125,15 +93,8 @@ add_yazi_git_plugin() { # Main # --------------------------------------------------------------------------- main() { - echo "==> Aktiviere multilib ..." - enable_multilib - - echo "==> System aktualisieren ..." - sudo pacman -Syu - - echo "==> Sicherstelle yay ..." - install_yay - + # Hinweis: multilib, yay und das System-Update werden von + # basic/setup.sh uebernommen (laeuft vor term im Makefile). echo "==> Lese Paketliste: $PACKAGES_FILE" read_packages diff --git a/test/entrypoint-test.sh b/test/entrypoint-test.sh index 86d89ac..2511ba9 100755 --- a/test/entrypoint-test.sh +++ b/test/entrypoint-test.sh @@ -129,23 +129,26 @@ NOOP chmod +x "$HOME/bin/"* export PATH="$HOME/bin:$PATH" - # 2c. term/setup.sh package parsing sanity (mirrors read_packages). - if ( cd "$REPO" && bash -n term/setup.sh ); then - say_ok "term/setup.sh syntax OK" - else - say_fail "term/setup.sh syntax error" - fi - pacman_count=$(awk ' - /^@pacman/{s="pacman"} - /^@aur/{s="aur"} - /^@npm/{s="npm"} - /^[[:space:]]*#/{next} - /^[[:space:]]*$/{next} - s=="pacman"{pc++} s=="aur"{ac++} s=="npm"{nc++} - END{printf "%d %d %d", pc,ac,nc} - ' $REPO/term/packages.txt) - read -r PC AC NC <<< "$pacman_count" - say_ok "packages.txt -> ${PC} pacman, ${AC} aur, ${NC} npm entries" + # 2c. setup.sh package parsing sanity (mirrors read_packages) for each + # package dir: basic/term/utils. + for d in basic term utils; do + if ( cd "$REPO" && bash -n "$d/setup.sh" ); then + say_ok "$d/setup.sh syntax OK" + else + say_fail "$d/setup.sh syntax error" + fi + pacman_count=$(awk ' + /^@pacman/{s="pacman"} + /^@aur/{s="aur"} + /^@npm/{s="npm"} + /^[[:space:]]*#/{next} + /^[[:space:]]*$/{next} + s=="pacman"{pc++} s=="aur"{ac++} s=="npm"{nc++} + END{printf "%d %d %d", pc,ac,nc} + ' "$REPO/$d/packages.txt") + read -r PC AC NC <<< "$pacman_count" + say_ok "$d/packages.txt -> ${PC} pacman, ${AC} aur, ${NC} npm entries" + done # 2d. If network allowed and not skipped, actually install the pacman # section of term/setup.sh (mirrors `make term` without AUR/npm). diff --git a/test/lint.sh b/test/lint.sh index f713d00..4a11bc0 100755 --- a/test/lint.sh +++ b/test/lint.sh @@ -70,23 +70,29 @@ else fi # --------------------------------------------------------------------------- -# 4. packages.txt parsing sanity (mirrors term/setup.sh read_packages). +# 4. packages.txt parsing sanity (mirrors each setup.sh read_packages). # --------------------------------------------------------------------------- -echo "== Checking term/packages.txt markers ==" -if grep -q '^@pacman' term/packages.txt; then - say_pass "packages.txt declares @pacman section" -else - say_fail "packages.txt missing @pacman marker" -fi -# every @aur/@npm marker must be matched by a real consumer in setup.sh -for marker in '@aur' '@npm'; do - if grep -q "^$marker" term/packages.txt; then - grep -q "$marker" term/setup.sh \ - && say_pass "packages.txt $marker handled by term/setup.sh" \ - || say_fail "packages.txt uses $marker but term/setup.sh does not handle it" - else - say_pass "packages.txt has no $marker section" +echo "== Checking packages.txt markers ==" +for pkgdir in term basic utils; do + if ! [[ -f "$pkgdir/packages.txt" ]]; then + say_fail "$pkgdir/packages.txt missing" + continue fi + if grep -q '^@pacman' "$pkgdir/packages.txt"; then + say_pass "$pkgdir/packages.txt declares @pacman section" + else + say_fail "$pkgdir/packages.txt missing @pacman marker" + fi + # every @aur/@npm marker must be matched by a real consumer in setup.sh + for marker in '@aur' '@npm'; do + if grep -q "^$marker" "$pkgdir/packages.txt"; then + grep -q "$marker" "$pkgdir/setup.sh" \ + && say_pass "$pkgdir/packages.txt $marker handled by $pkgdir/setup.sh" \ + || say_fail "$pkgdir/packages.txt uses $marker but $pkgdir/setup.sh does not handle it" + else + say_pass "$pkgdir/packages.txt has no $marker section" + fi + done done # --------------------------------------------------------------------------- diff --git a/utils/packages.txt b/utils/packages.txt new file mode 100644 index 0000000..4f07ff1 --- /dev/null +++ b/utils/packages.txt @@ -0,0 +1,22 @@ +# --------------------------------------------------------------------------- +# Standalone desktop utility package list for utils/setup.sh +# +# Programs that are not core to every branch, but are expected on a full +# desktop: office / web / mail / native-app replacements (Wine), the +# Nextcloud sync client, etc. +# +# - Lines starting with '#' and blank lines are ignored. +# - Use "@pacman", "@aur" or "@npm" markers to switch section. +# - The default section is @pacman. +# --------------------------------------------------------------------------- + +@pacman +nextcloud-client +thunderbird +ktouch +ktorrent +wine +wine-mono +wine-gecko +winetricks +rbw diff --git a/utils/setup.sh b/utils/setup.sh new file mode 100644 index 0000000..5fe780b --- /dev/null +++ b/utils/setup.sh @@ -0,0 +1,74 @@ +#!/bin/bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PACKAGES_FILE="$SCRIPT_DIR/packages.txt" + +# --------------------------------------------------------------------------- +# 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 +} + +# --------------------------------------------------------------------------- +# Main +# --------------------------------------------------------------------------- +main() { + echo "==> Lese Paketliste: $PACKAGES_FILE" + read_packages + + install_pacman + install_aur + install_npm + + echo "Fertig. Standalone Utilities sind eingerichtet." +} + +main