From 997761617886608d98ef25407c7540eece87060a Mon Sep 17 00:00:00 2001 From: Tim Date: Sat, 9 May 2026 16:31:00 +0000 Subject: [PATCH] =?UTF-8?q?setup.sh=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.sh | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 setup.sh diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..b3ea1c6 --- /dev/null +++ b/setup.sh @@ -0,0 +1,103 @@ +#!/bin/bash + +# --- 1. Deine individuellen Datei-URLs --- +URL_NVIM_INIT="http://DEIN_GITEA/init.lua" +URL_FASTFETCH="http://DEIN_GITEA/fastfetch.jsonc" + +echo "🔍 Scanne System für maßgeschneidertes Setup..." + +# --- 2. System-Erkennung --- +if [ -f /etc/os-release ]; then + . /etc/os-release + OS_ID=$ID + OS_LIKE=$ID_LIKE +elif [[ "$OSTYPE" == "darwin"* ]]; then + OS_ID="macos" +else + OS_ID="unknown" +fi + +# --- 3. Intelligente Paket-Installation --- +echo "📦 Installiere Pakete für: $OS_ID..." +SUDO="" +command -v sudo >/dev/null && SUDO="sudo" + +case "$OS_ID" in + arch|cachyos) + $SUDO pacman -Syu --needed --noconfirm zsh curl git neovim fastfetch eza shadow ;; + debian|ubuntu|trixie|kali) + $SUDO apt update && $SUDO apt install -y zsh curl git neovim fastfetch eza ;; + alpine) + $SUDO apk add zsh curl git neovim fastfetch eza shadow ncurses-terminfo-base ;; + *) + echo "⚠️ System $OS_ID nicht explizit unterstützt, versuche Standard-ZSH..." + $SUDO apt install -y zsh curl || echo "Installation fehlgeschlagen." ;; +esac + +# --- 4. Verzeichnisse & Config-Downloads --- +mkdir -p ~/.config/nvim ~/.config/fastfetch +curl -fsSL "$URL_NVIM_INIT" -o ~/.config/nvim/init.lua +curl -fsSL "$URL_FASTFETCH" -o ~/.config/fastfetch/fastfetch.jsonc + +# --- 5. Die dynamische .zshrc Erstellung --- +echo "📝 Generiere optimierte .zshrc für $OS_ID..." + +cat < ~/.zshrc +# --- Automatisch generiert am $(date) --- +OS_ID="$OS_ID" +OS_LIKE="$OS_LIKE" + +# Basis-Plugins & Theme (Zinit) +ZINIT_HOME="\${XDG_DATA_HOME:-\${HOME}/.local/share}/zinit/zinit.git" +[ ! -d "\$ZINIT_HOME" ] && mkdir -p "\$(dirname \$ZINIT_HOME)" && git clone https://github.com/zdharma-continuum/zinit.git "\$ZINIT_HOME" +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 Start +(( \$+commands[fastfetch] )) && fastfetch --config ~/.config/fastfetch/fastfetch.jsonc + +# --- System-spezifische Aliases --- +alias l='eza -lagh --icons --group-directories-first' +alias c='clear' +alias x='exit' + +EOF + +# --- 6. Effiziente Update-Logik einfügen --- +# Hier wird nur der Code eingefügt, den das aktuelle System wirklich braucht! +case "$OS_ID" in + arch|cachyos) + cat <<'EOF' >> ~/.zshrc +update_system() { + echo "--- Arch Update ---" + if (( $+commands[yay] )); then yay -Syu --noconfirm; else sudo pacman -Syu --noconfirm; fi + sudo pacman -Rns $(pacman -Qdtq) --noconfirm 2>/dev/null +} +EOF + ;; + debian|ubuntu|trixie|kali) + cat <<'EOF' >> ~/.zshrc +update_system() { + echo "--- Debian/APT Update ---" + sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y +} +EOF + ;; + alpine) + cat <<'EOF' >> ~/.zshrc +update_system() { + echo "--- Alpine Update ---" + sudo apk update && sudo apk upgrade +} +EOF + ;; +esac + +echo "alias u='update_system'" >> ~/.zshrc + +# --- 7. Finale & Start --- +echo "✅ Setup fertig. Wechsel zu ZSH..." +exec zsh -l \ No newline at end of file