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