-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_linux.sh
More file actions
executable file
·70 lines (64 loc) · 2.59 KB
/
Copy pathinstall_linux.sh
File metadata and controls
executable file
·70 lines (64 loc) · 2.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env bash
set -euo pipefail
INSTALL_DIR="${TRINITY_HOME:-$HOME/Trinity_Assistant}"
REPOSITORY="https://github.com/ProfEngel/TrinityLectureAssisitant.git"
command -v python3 >/dev/null || { echo "Python 3 fehlt."; exit 1; }
python3 - <<'PY'
import sys
if not ((3, 10) <= sys.version_info[:2] < (3, 15)):
raise SystemExit("Trinity benoetigt Python 3.10 bis 3.14.")
PY
BACKUP="${INSTALL_DIR}_backup_$(date +%Y%m%d_%H%M%S)"
IS_UPDATE=false
if [ -d "$INSTALL_DIR" ]; then
IS_UPDATE=true
mkdir -p "$BACKUP"
for item in core/config.json core/Soul.md core/User.md memory RAG gen_images; do
[ -e "$INSTALL_DIR/$item" ] && cp -a "$INSTALL_DIR/$item" "$BACKUP/"
done
rm -rf "$INSTALL_DIR"
fi
if command -v git >/dev/null; then
git clone --branch main --single-branch "$REPOSITORY" "$INSTALL_DIR"
else
echo "Bitte git installieren oder das Repository manuell nach $INSTALL_DIR klonen."
exit 1
fi
if [ -d "$BACKUP" ]; then
for item in config.json Soul.md User.md; do
[ -f "$BACKUP/core/$item" ] && cp "$BACKUP/core/$item" "$INSTALL_DIR/core/$item"
done
for item in memory RAG gen_images; do
[ -d "$BACKUP/$item" ] && mkdir -p "$INSTALL_DIR/$item" && cp -a "$BACKUP/$item/." "$INSTALL_DIR/$item/"
done
rm -rf "$BACKUP"
fi
python3 -m venv "$INSTALL_DIR/venv"
"$INSTALL_DIR/venv/bin/python" -m pip install --upgrade pip
"$INSTALL_DIR/venv/bin/python" -m pip install --no-compile ".[linux]"
mkdir -p "$HOME/.local/bin"
cat > "$HOME/.local/bin/trinity" <<EOF
#!/bin/sh
exec "$INSTALL_DIR/venv/bin/python" "$INSTALL_DIR/trinity_cli.py" "\$@"
EOF
chmod +x "$HOME/.local/bin/trinity"
run_vault_setup() {
if [ ! -r /dev/tty ]; then
echo "Die Vault-Ersteinrichtung benötigt ein interaktives Terminal."
echo "Starte danach manuell: $HOME/.local/bin/trinity vault setup"
return 1
fi
"$INSTALL_DIR/venv/bin/python" "$INSTALL_DIR/trinity_cli.py" --home "$INSTALL_DIR" vault setup </dev/tty
}
if [ "$IS_UPDATE" = true ]; then
echo "Pruefe den bereits konfigurierten Inhalts-Vault ..."
"$INSTALL_DIR/venv/bin/python" "$INSTALL_DIR/trinity_cli.py" --home "$INSTALL_DIR" vault init || \
run_vault_setup
else
echo "Richte den Inhalts-Vault fuer diese Neuinstallation ein ..."
echo "Du bestimmst selbst, wo der Vault liegen soll."
run_vault_setup
fi
"$INSTALL_DIR/venv/bin/python" "$INSTALL_DIR/trinity_cli.py" --home "$INSTALL_DIR" control-plane init >/dev/null || true
echo "Installation fertig. Starte mit: $HOME/.local/bin/trinity onboarding"
echo "Danach: $HOME/.local/bin/trinity server --host 127.0.0.1 --port 8765"