d478d8079a
M11: _venv_install() helper nutzt uv pip (Hermes v0.18.0+) mit Fallback-Kette: uv pip > pip > python -m pip, für venv/ und .venv/. Ersetzt alle 3 numpy/faiss-Installationsblöcke (perform_update, perform_update_only, main install path). M12: bootstrap.sh als One-Command-Entrypoint: ssh-keyscan → git clone (SSH→HTTP fallback) → exec install.sh. _bootstrap_repo() erkennt jetzt broken clones (.git ja, plugin/ nein) und löscht + cloned neu statt fatal abzubrechen.
64 lines
2.3 KiB
Bash
Executable File
64 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Hermes Rocket.Chat Plugin — Bootstrap (One-Command Installer)
|
|
# https://gitea.thomander.de/andreas/Hermes_rocket.chat_Plugin
|
|
#
|
|
# Usage (fresh VM, no repo cloned yet):
|
|
# curl -sSL https://192.168.180.47/Andreas/Hermes_rocket.chat_Plugin/raw/branch/main/bootstrap.sh | bash
|
|
#
|
|
# Or locally:
|
|
# ./bootstrap.sh [install.sh arguments...]
|
|
#
|
|
# What this does:
|
|
# 1. ssh-keyscan: ensures Gitea host key is in known_hosts (M12 fix)
|
|
# 2. git clone: clones the plugin repo (SSH → HTTP fallback)
|
|
# 3. exec: hands off to install.sh with all arguments preserved
|
|
#
|
|
set -euo pipefail
|
|
|
|
GITEA_HOST="192.168.180.47"
|
|
GITEA_PORT="222"
|
|
REPO_PATH="Andreas/Hermes_rocket.chat_Plugin"
|
|
CLONE_TARGET="$HOME/Hermes_rocket.chat_Plugin"
|
|
|
|
# ── Step 1: ssh-keyscan (M12 — muss VOR git clone laufen) ──
|
|
echo "🔑 Ensuring Gitea host key is in known_hosts..."
|
|
mkdir -p "$HOME/.ssh"
|
|
chmod 700 "$HOME/.ssh"
|
|
if ! grep -q "${GITEA_HOST}" "$HOME/.ssh/known_hosts" 2>/dev/null; then
|
|
ssh-keyscan -p "${GITEA_PORT}" "${GITEA_HOST}" >> "$HOME/.ssh/known_hosts" 2>/dev/null || {
|
|
echo "⚠️ ssh-keyscan failed — git clone via SSH may fail, HTTP fallback will be used"
|
|
}
|
|
echo " Host key added."
|
|
else
|
|
echo " Host key already present."
|
|
fi
|
|
|
|
# ── Step 2: Clone repo (falls nicht vorhanden) ──
|
|
if [ -d "$CLONE_TARGET/.git" ] && [ -d "$CLONE_TARGET/plugin" ]; then
|
|
echo "✅ Repo already present at $CLONE_TARGET"
|
|
elif [ -d "$CLONE_TARGET/.git" ]; then
|
|
echo "⚠️ Broken clone detected — removing and re-cloning..."
|
|
rm -rf "$CLONE_TARGET"
|
|
fi
|
|
|
|
if [ ! -d "$CLONE_TARGET/.git" ]; then
|
|
echo "📦 Cloning plugin repo..."
|
|
SSH_URL="git@${GITEA_HOST}:${REPO_PATH}.git"
|
|
HTTP_URL="https://${GITEA_HOST}/${REPO_PATH}.git"
|
|
|
|
if git clone "$SSH_URL" "$CLONE_TARGET" 2>/dev/null; then
|
|
echo "✅ Clone via SSH successful"
|
|
elif git clone "$HTTP_URL" "$CLONE_TARGET" 2>/dev/null; then
|
|
echo "✅ Clone via HTTP (fallback) successful"
|
|
else
|
|
echo "❌ Clone failed — SSH key for Gitea (${GITEA_HOST}:${GITEA_PORT}) or HTTP access required"
|
|
echo " Manual: git clone $SSH_URL $CLONE_TARGET"
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# ── Step 3: Hand off to install.sh ──
|
|
echo "🚀 Starting install.sh..."
|
|
exec "$CLONE_TARGET/install.sh" "$@"
|