#!/bin/sh # --- 1. Deine individuellen Datei-URLs --- URL_NVIM_INIT="http://DEIN_GITEA/init.lua" URL_FASTFETCH="http://DEIN_GITEA/fastfetch.jsonc" echo "🔍 Scanne System (POSIX mode)..." # --- 2. System-Erkennung (sh-kompatibel) --- if [ -f /etc/os-release ]; then . /etc/os-release OS_ID=$ID else OS_ID="unknown" fi # --- 3. Voraussetzungen installieren --- # Wir prüfen erst, welcher Manager da ist echo "📦 Installiere Pakete für: $OS_ID..." if command -v sudo >/dev/null 2>&1; then S="sudo"; else S=""; fi if command -v apt-get >/dev/null 2>&1; then $S apt-get update && $S apt-get install -y zsh curl git neovim fastfetch eza elif command -v pacman >/dev/null 2>&1; then $S pacman -Syu --needed --noconfirm zsh curl git neovim fastfetch eza shadow elif command -v apk >/dev/null 2>&1; then $S apk add zsh curl git neovim fastfetch eza shadow ncurses-terminfo-base elif command -v dnf >/dev/null 2>&1; then $S dnf install -y zsh curl git neovim fastfetch eza shadow-utils fi # --- 4. Verzeichnisse & Downloads --- mkdir -p "$HOME/.config/nvim" "$HOME/.config/fastfetch" curl -fsSL "$URL_NVIM_INIT" -o "$HOME/.config/nvim/init.lua" curl -fsSL "$URL_FASTFETCH" -o "$HOME/.config/fastfetch/fastfetch.jsonc" # --- 5. Die dynamische .zshrc Erstellung --- # Wir nutzen hier 'cat' ohne Bash-Variablen-Tricks echo "📝 Generiere .zshrc..." cat < "$HOME/.zshrc" # --- Automatisch generiert am $(date) --- OS_ID="$OS_ID" # Zinit Installation ZINIT_HOME="\$HOME/.local/share/zinit/zinit.git" if [ ! -d "\$ZINIT_HOME" ]; then mkdir -p "\$(dirname "\$ZINIT_HOME")" git clone https://github.com/zdharma-continuum/zinit.git "\$ZINIT_HOME" fi source "\$ZINIT_HOME/zinit.zsh" zinit ice depth=1; zinit light romkatv/powerlevel10k zinit light zsh-users/zsh-syntax-highlighting zinit light zsh-users/zsh-autosuggestions # Fastfetch & Aliases alias l='eza -lagh --icons --group-directories-first' alias c='clear' alias x='exit' (( \$+commands[fastfetch] )) && fastfetch --config \$HOME/.config/fastfetch/fastfetch.jsonc EOF # --- 6. Update-Logik (System-spezifisch) --- if [ "$OS_ID" = "debian" ] || [ "$OS_ID" = "ubuntu" ] || [ "$OS_ID" = "trixie" ]; then echo "update_system() { $S apt-get update && $S apt-get upgrade -y; }" >> "$HOME/.zshrc" elif [ "$OS_ID" = "arch" ] || [ "$OS_ID" = "cachyos" ]; then echo "update_system() { $S pacman -Syu --noconfirm; }" >> "$HOME/.zshrc" elif [ "$OS_ID" = "alpine" ]; then echo "update_system() { $S apk update && $S apk upgrade; }" >> "$HOME/.zshrc" fi echo "alias u='update_system'" >> "$HOME/.zshrc" # --- 7. Finale --- # Prüfen ob ZSH die Default Shell ist (optional) if [ "$SHELL" != "$(command -v zsh)" ] && [ "$OS_ID" != "termux" ]; then $S chsh -s "$(command -v zsh)" "$(whoami)" fi echo "✅ Setup fertig! Starte ZSH..." exec zsh -l