From aedd6a22588d9203c498b1b6acf10c9f596b5a6a Mon Sep 17 00:00:00 2001 From: Eduard Iten Date: Tue, 10 Feb 2026 14:03:15 +0100 Subject: [PATCH] install.sh erweitert um error checks und so --- install.sh | 68 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 11 deletions(-) diff --git a/install.sh b/install.sh index fc7d5fa..c1d2f61 100644 --- a/install.sh +++ b/install.sh @@ -1,21 +1,67 @@ #!/usr/bin/env bash -# 1. Plugins installieren (falls nicht vorhanden) -ZSH_CUSTOM=${ZSH_CUSTOM:-~/.oh-my-zsh/custom} -mkdir -p "$ZSH_CUSTOM/plugins" +# Farben für die Ausgabe +GREEN='\033[0;32m' +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color -plugins=(zsh-autosuggestions zsh-syntax-highlighting zsh-completions) -for p in "${plugins[@]}"; do - if [ ! -d "$ZSH_CUSTOM/plugins/$p" ]; then - echo "Installiere $p..." - git clone "https://github.com/zsh-users/$p" "$ZSH_CUSTOM/plugins/$p" +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. Symlinks setzen -ln -sf ~/dotfiles/zsh_func_d ~/.zsh_func_d +# 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 -echo "✅ Installation abgeschlossen! Bitte 'source ~/.zshrc' ausführen." +# 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}"