refactor(management): replace curses TUIs with API-backed ncp subcommands; panel/autostart/install integration
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+55
-14
@@ -1,27 +1,50 @@
|
||||
#!/bin/bash
|
||||
|
||||
NEXUS_ROOT="$HOME/nexus-core"
|
||||
SRC="router:/tmp/mnt/Wingdrive2/nexus-core/"
|
||||
mode="$1"
|
||||
|
||||
# Shared exclude list — used by the real restore AND the -c/--claude dry-run, so
|
||||
# the check accurately previews what a real restore would do.
|
||||
EXCLUDES=(
|
||||
--exclude='.git/'
|
||||
--exclude='Promethean/'
|
||||
--exclude='models/blobs/'
|
||||
--exclude='ollama/'
|
||||
--exclude='interface/web/node_modules/'
|
||||
--exclude='interface/web/dist/'
|
||||
--exclude='runtime/'
|
||||
--exclude='__pycache__/'
|
||||
--exclude='*.pyc'
|
||||
)
|
||||
|
||||
detect_requirements() {
|
||||
if command -v nvidia-smi &>/dev/null || lspci 2>/dev/null | grep -qi nvidia; then
|
||||
echo "nvidia_requirements.txt"
|
||||
echo "requirements-nvidia.txt"
|
||||
else
|
||||
echo "amd_requirements.txt"
|
||||
echo "requirements-amd.txt"
|
||||
fi
|
||||
}
|
||||
|
||||
echo "Restoring Nexus from router..."
|
||||
rsync -avz --delete \
|
||||
--exclude='Promethean/' \
|
||||
--exclude='models/blobs/' \
|
||||
--exclude='ollama/' \
|
||||
--exclude='interface/web/node_modules/' \
|
||||
--exclude='interface/web/dist/' \
|
||||
--exclude='runtime/' \
|
||||
--exclude='__pycache__/' \
|
||||
--exclude='*.pyc' \
|
||||
-e ssh \
|
||||
"router:/tmp/mnt/Wingdrive2/nexus-backup/" "$NEXUS_ROOT/"
|
||||
# Check mode (-c|--claude|check): content-level dry-run. Lists exactly what a
|
||||
# real restore would pull from the router and delete locally — nothing changes
|
||||
# and the env/theme rebuild is skipped. --checksum compares by content (not
|
||||
# size/mtime), so only genuine differences show. Meant for deciding whether a
|
||||
# real restore is actually needed before paying for the rebuild.
|
||||
if [ "$mode" = "-c" ] || [ "$mode" = "--claude" ] || [ "$mode" = "check" ]; then
|
||||
echo "Checking restore diff vs router (dry-run, content-level, no changes)..."
|
||||
rsync -rlni --checksum --delete "${EXCLUDES[@]}" -e ssh "$SRC" "$NEXUS_ROOT/"
|
||||
echo ""
|
||||
echo "(dry-run only — nothing changed. Apply with: restore -f)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$mode" = "full" ] || [ "$mode" = "-f" ]; then
|
||||
echo "Restoring full Nexus backup from router..."
|
||||
else
|
||||
echo "Restoring Nexus from router..."
|
||||
fi
|
||||
rsync -avz --no-owner --no-group --delete "${EXCLUDES[@]}" -e ssh "$SRC" "$NEXUS_ROOT/"
|
||||
|
||||
echo ""
|
||||
echo "Rebuilding Python environment..."
|
||||
@@ -47,5 +70,23 @@ else
|
||||
echo "Warning: $theme_installer not found — skipping theme restore."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Installing Promethean Terminal launcher..."
|
||||
term_installer="$NEXUS_ROOT/bin/promethean/install.sh"
|
||||
if [ -x "$term_installer" ]; then
|
||||
"$term_installer"
|
||||
else
|
||||
echo "Warning: $term_installer not found — skipping."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Installing panel applet..."
|
||||
panel_installer="$NEXUS_ROOT/bin/panel/install.sh"
|
||||
if [ -x "$panel_installer" ]; then
|
||||
"$panel_installer"
|
||||
else
|
||||
echo "Warning: $panel_installer not found — skipping panel install."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Restore complete. Nexus is ready to start."
|
||||
|
||||
Reference in New Issue
Block a user