basic and utils: overhaul set-up

This commit is contained in:
2026-09-05 21:30:54 +02:00
parent aaecbd8472
commit 84db84b542
9 changed files with 324 additions and 124 deletions
+74
View File
@@ -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