#!/usr/bin/env bash # Farben für die Ausgabe GREEN='\033[0;32m' BLUE='\033[0;34m' YELLOW='\033[1;33m' NC='\033[0m' # No Color echo -e "${BLUE}🚀 Starte Dotfiles Installation...${NC}" # 1. Prüfen auf Basistools echo -e "${BLUE}Prüfe Abhängigkeiten...${NC}" for tool in bw jq git zsh; do if ! command -v $tool &> /dev/null; then echo -e "${YELLOW}⚠️ $tool ist nicht installiert. Bitte installiere es zuerst.${NC}" fi done # 2. Oh-My-Zsh installieren, falls nicht vorhanden if [ ! -d "$HOME/.oh-my-zsh" ]; then echo -e "${BLUE}Installiere Oh-My-Zsh...${NC}" sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended else echo -e "${GREEN}✅ Oh-My-Zsh ist bereits installiert.${NC}" fi # 3. ZSH Plugins installieren ZSH_CUSTOM=${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom} mkdir -p "$ZSH_CUSTOM/plugins" plugins=( "zsh-autosuggestions|https://github.com/zsh-users/zsh-autosuggestions" "zsh-syntax-highlighting|https://github.com/zsh-users/zsh-syntax-highlighting" "zsh-completions|https://github.com/zsh-users/zsh-completions" ) for p in "${plugins[@]}"; do name="${p%%|*}" url="${p#*|}" if [ ! -d "$ZSH_CUSTOM/plugins/$name" ]; then echo -e "${BLUE}Installiere Plugin: $name...${NC}" git clone "$url" "$ZSH_CUSTOM/plugins/$name" else echo -e "${GREEN}✅ Plugin $name ist bereits da.${NC}" fi done # 4. Symlinks setzen echo -e "${BLUE}Setze Symlinks...${NC}" # .zshrc Vorlage (wir überschreiben die Standard-.zshrc) ln -sf ~/dotfiles/zshrc_template ~/.zshrc # Funktionen Ordner ln -sfn ~/dotfiles/zsh_func_d ~/.zsh_func_d # Git-Helper mkdir -p ~/.local/bin ln -sf ~/dotfiles/bin/git-bw-helper ~/.local/bin/git-bw-helper chmod +x ~/dotfiles/bin/git-bw-helper # 5. Git Konfiguration für Gitea echo -e "${BLUE}Konfiguriere Git-Helper für Gitea...${NC}" git config --global --unset-all credential.https://gitea.iten.pro.helper git config --global --add credential.https://gitea.iten.pro.helper '!git-bw-helper' echo -e "${GREEN}✨ Installation abgeschlossen! ✨${NC}" echo -e "${YELLOW}Bitte führe 'source ~/.zshrc' aus oder starte das Terminal neu.${NC}"