feat: Add v1 detection to installer

- Detect v1 installation (folder, cron, systemd service)
- Warn user that upgrade is not supported
- Explain removal steps clearly
- Allow continue-at-own-risk option
- Exit if user declines
This commit is contained in:
root
2026-02-24 21:20:37 -06:00
parent 86efd0c955
commit ae36275153

View File

@@ -269,6 +269,73 @@ def write_config():
return config_path return config_path
def detect_v1():
"""Detect if TrueRecall v1 is installed and warn user."""
v1_indicators = []
# Check for v1 folder
v1_paths = [
Path.home() / ".openclaw" / "workspace" / ".projects" / "true-recall",
Path.home() / ".openclaw" / "workspace" / ".projects" / "true-recall" / "tr-daily",
]
for p in v1_paths:
if p.exists():
v1_indicators.append(f"Found v1 folder: {p}")
# Check for v1 cron jobs
cron_file = Path.home() / ".openclaw" / "tr-daily" / "crontab.txt"
if cron_file.exists():
v1_indicators.append(f"Found v1 cron file: {cron_file}")
# Check for v1 systemd service
v1_service_paths = [
Path("/etc/systemd/system/memories-qdrant.service"),
Path.home() / ".config" / "systemd" / "user" / "memories-qdrant.service",
]
for s in v1_service_paths:
if s.exists():
v1_indicators.append(f"Found v1 service: {s}")
if not v1_indicators:
return False
print("\n" + "=" * 60)
print("⚠️ TRUE-RECALL V1 DETECTED")
print("=" * 60)
print("\nTrueRecall v1 is already installed on this system:")
for indicator in v1_indicators:
print(f"{indicator}")
print("\n⚠️ UPGRADE NOT SUPPORTED")
print("-" * 60)
print("TrueRecall v2 cannot upgrade from v1 automatically.")
print("You MUST remove v1 completely before installing v2.")
print("\nTo remove v1:")
print(" 1. Stop v1 services: sudo systemctl stop memories-qdrant")
print(" 2. Remove v1 cron jobs from crontab")
print(" 3. Archive or delete v1 folder: ~/.openclaw/workspace/.projects/true-recall/")
print(" 4. v1 data in Qdrant 'memories' collection will remain (separate from v2)")
print("\n" + "-" * 60)
print("If you continue WITHOUT removing v1:")
print(" • Both v1 and v2 may run simultaneously")
print(" • Duplicate cron jobs may cause conflicts")
print(" • System resource usage will be doubled")
print(" • Data integrity is NOT guaranteed")
print("=" * 60)
while True:
choice = input("\nContinue installation at your own risk? [y/N]: ").strip().lower()
if choice in ("y", "yes"):
print("\n⚠️ Proceeding with installation — v1 conflicts possible.")
return True
elif choice in ("n", "no", ""):
print("\n❌ Installation cancelled.")
print("Please remove v1 first, then run this installer again.")
return False
else:
print("Invalid choice. Enter 'y' to continue or 'n' to abort.")
def show_summary(): def show_summary():
"""Display configuration summary.""" """Display configuration summary."""
print("\n" + "=" * 60) print("\n" + "=" * 60)
@@ -300,6 +367,10 @@ def main():
print("TrueRecall v2 - Interactive Installation") print("TrueRecall v2 - Interactive Installation")
print("=" * 60) print("=" * 60)
# Check for v1
if not detect_v1():
sys.exit(1)
# Mode selection # Mode selection
while True: while True:
print("\nSelect installation mode:") print("\nSelect installation mode:")