install.sh erweitert um error checks und so

This commit is contained in:
2026-02-10 14:03:15 +01:00
parent f4b8934b61
commit aedd6a2258

View File

@@ -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}"