setup.sh aktualisiert
This commit is contained in:
93
setup.sh
93
setup.sh
@@ -3,90 +3,79 @@
|
||||
REPO_URL="https://git.pi-farm.de/pi-farm/PiDoBot.git"
|
||||
|
||||
echo "=========================================="
|
||||
echo ">>> Starte Setup für J.A.R.V.I.S. - AI <<<"
|
||||
echo ">>> J.A.R.V.I.S. - Professional Setup <<<"
|
||||
echo "=========================================="
|
||||
|
||||
# 0. Installationsverzeichnis abfragen
|
||||
read -p "Installationsverzeichnis (Standard: jarvis-ai): " input_dir
|
||||
INSTALL_DIR=${input_dir:-jarvis-ai}
|
||||
# WICHTIG: Nutze einen Unterordner, nicht direkt /home/pi/
|
||||
read -p "Installationsverzeichnis (Standard: /home/pi/jarvis-ai): " input_dir </dev/tty
|
||||
INSTALL_DIR=${input_dir:-/home/pi/jarvis-ai}
|
||||
|
||||
# Mache den Pfad absolut, falls er relativ angegeben wurde
|
||||
if [[ ! "$INSTALL_DIR" = /* ]]; then
|
||||
INSTALL_DIR="$(pwd)/$INSTALL_DIR"
|
||||
fi
|
||||
# Pfad normalisieren (entfernt doppelte Slashes und Tilde)
|
||||
INSTALL_DIR=$(realpath -m "$INSTALL_DIR")
|
||||
|
||||
echo -e "\nZielverzeichnis: $INSTALL_DIR"
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
cd "$INSTALL_DIR" || exit
|
||||
|
||||
# 1. System-Abhängigkeiten installieren
|
||||
echo -e "\n--- 1. Prüfe und installiere System-Pakete..."
|
||||
# 1. System-Abhängigkeiten
|
||||
echo -e "\n--- 1. System-Pakete..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y git wget sshpass python3-pip python3-venv iproute2
|
||||
|
||||
# 2. Repository klonen / updaten
|
||||
echo -e "\n--- 2. Hole Quellcode..."
|
||||
if [ ! -d "$INSTALL_DIR" ]; then
|
||||
git clone --branch dev --single-branch "$REPO_URL" "$INSTALL_DIR"
|
||||
# 2. Repository klonen
|
||||
echo -e "\n--- 2. Quellcode..."
|
||||
if [ ! -d ".git" ]; then
|
||||
git clone --branch dev --single-branch "$REPO_URL" .
|
||||
else
|
||||
echo "Verzeichnis existiert bereits. Überspringe Klonen."
|
||||
# Optional: git pull hier einbauen, falls du immer die neueste Version willst
|
||||
echo "Repo bereits vorhanden, aktualisiere..."
|
||||
git pull
|
||||
fi
|
||||
|
||||
cd "$INSTALL_DIR" || exit
|
||||
|
||||
# 3. Virtual Environment einrichten
|
||||
echo -e "\n--- 3. Richte Python-Umgebung ein..."
|
||||
# 3. Virtual Environment (Hier lag der Fehler!)
|
||||
echo -e "\n--- 3. Python-Umgebung..."
|
||||
if [ ! -d "venv" ]; then
|
||||
python3 -m venv venv
|
||||
fi
|
||||
source venv/bin/activate
|
||||
|
||||
echo "Installiere Abhängigkeiten..."
|
||||
pip install --upgrade pip
|
||||
# Nutze den direkten Pfad zum Pip im Venv (sicherer als 'source')
|
||||
./venv/bin/pip install --upgrade pip
|
||||
if [ -f "source/requirements.txt" ]; then
|
||||
pip install -r source/requirements.txt
|
||||
./venv/bin/pip install -r source/requirements.txt
|
||||
else
|
||||
echo "FEHLER: requirements.txt nicht in $INSTALL_DIR/source gefunden!"
|
||||
echo "❌ FEHLER: requirements.txt nicht gefunden!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 4. SSH-Key prüfen/erstellen
|
||||
echo -e "\n--- 4. Prüfe SSH-Schlüssel für Node-Kommunikation..."
|
||||
if [ ! -f "$HOME/.ssh/id_rsa" ]; then
|
||||
echo "Generiere SSH-Key..."
|
||||
ssh-keygen -t rsa -N "" -f "$HOME/.ssh/id_rsa"
|
||||
else
|
||||
echo "SSH-Key existiert bereits."
|
||||
fi
|
||||
# 4. SSH-Key
|
||||
echo -e "\n--- 4. SSH-Key..."
|
||||
[ ! -f "$HOME/.ssh/id_rsa" ] && ssh-keygen -t rsa -N "" -f "$HOME/.ssh/id_rsa"
|
||||
|
||||
# 5. Static Ordner anlegen und Dateien herunterladen
|
||||
echo -e "\n--- 5. Lade Frontend-Bibliotheken herunter..."
|
||||
if [ ! -d "source/static" ]; then
|
||||
mkdir -p source/static
|
||||
cd source/static
|
||||
wget -q https://cdn.jsdelivr.net/npm/gridstack@7.2.3/dist/gridstack.min.css
|
||||
wget -q https://cdn.jsdelivr.net/npm/gridstack@7.2.3/dist/gridstack-all.js
|
||||
wget -q https://cdn.jsdelivr.net/npm/xterm@5.1.0/css/xterm.css
|
||||
wget -q https://cdn.jsdelivr.net/npm/xterm@5.1.0/lib/xterm.js
|
||||
wget -q https://cdn.jsdelivr.net/npm/xterm-addon-fit@0.7.0/lib/xterm-addon-fit.js
|
||||
wget -q https://cdn.jsdelivr.net/npm/marked/marked.min.js
|
||||
cd ../../
|
||||
else
|
||||
echo "Static-Dateien existieren bereits."
|
||||
fi
|
||||
# 5. Static Dateien (Der Grund für deine 404s)
|
||||
echo -e "\n--- 5. Static-Bibliotheken..."
|
||||
mkdir -p source/static
|
||||
cd source/static
|
||||
# Lade Dateien nur, wenn sie fehlen
|
||||
wget -nc -q https://cdn.jsdelivr.net/npm/gridstack@7.2.3/dist/gridstack.min.css
|
||||
wget -nc -q https://cdn.jsdelivr.net/npm/gridstack@7.2.3/dist/gridstack-all.js
|
||||
wget -nc -q https://cdn.jsdelivr.net/npm/xterm@5.1.0/css/xterm.css
|
||||
wget -nc -q https://cdn.jsdelivr.net/npm/xterm@5.1.0/lib/xterm.js
|
||||
wget -nc -q https://cdn.jsdelivr.net/npm/xterm-addon-fit@0.7.0/lib/xterm-addon-fit.js
|
||||
wget -nc -q https://cdn.jsdelivr.net/npm/marked/marked.min.js
|
||||
cd "$INSTALL_DIR"
|
||||
|
||||
# 6. Interaktives Setup für die .env Datei
|
||||
echo -e "\n--- 6. Konfiguration (.env) einrichten..."
|
||||
# 6. .env Setup (wie besprochen)
|
||||
echo -e "\n--- 6. Konfiguration..."
|
||||
mkdir -p config
|
||||
ENV_FILE="config/.env"
|
||||
|
||||
# Standardwerte definieren
|
||||
web_user="Tony"
|
||||
web_user="Admin"
|
||||
ai_prov="google"
|
||||
google_key=""
|
||||
openai_key=""
|
||||
nvidia_key=""
|
||||
ollama_url="http://127.0.0.1:11434/v1"
|
||||
google_mod="gemini-2.5-flash"
|
||||
google_mod="gemini-2.0-flash"
|
||||
openai_mod="gpt-4o"
|
||||
tg_token=""
|
||||
tg_id=""
|
||||
|
||||
Reference in New Issue
Block a user