-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·56 lines (48 loc) · 2.02 KB
/
Copy pathupdate.sh
File metadata and controls
executable file
·56 lines (48 loc) · 2.02 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
#!/usr/bin/env bash
# update.sh — pull latest MeshEliza code and reinstall
#
# Usage:
# bash update.sh
#
# Run from the MeshEliza repo directory as your normal user.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
VENV_DIR="$HOME/.venv/mesheliza"
echo "=== MeshEliza Updater ==="
# ------------------------------------------------------------------ #
# 1. Pull latest code #
# ------------------------------------------------------------------ #
echo ">>> Pulling latest changes from origin..."
git -C "$SCRIPT_DIR" pull origin main
# ------------------------------------------------------------------ #
# 2. Clear Python bytecode caches #
# ------------------------------------------------------------------ #
echo ">>> Flushing Python bytecode caches..."
find "$SCRIPT_DIR" -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find "$SCRIPT_DIR" -name "*.pyc" -delete 2>/dev/null || true
# ------------------------------------------------------------------ #
# 3. Reinstall into the virtualenv #
# ------------------------------------------------------------------ #
if [[ ! -f "$VENV_DIR/bin/activate" ]]; then
echo ""
echo "ERROR: virtualenv not found at $VENV_DIR"
echo "Please run install.sh first."
exit 1
fi
echo ">>> Reinstalling package and dependencies into virtualenv..."
source "$VENV_DIR/bin/activate"
pip install -r "$SCRIPT_DIR/requirements.txt" --no-cache-dir --quiet
pip install -e "$SCRIPT_DIR" --no-cache-dir --quiet
# ------------------------------------------------------------------ #
# 4. Confirm what is now installed #
# ------------------------------------------------------------------ #
echo ""
echo "=== Update complete ==="
echo ""
echo "Installed commit:"
git -C "$SCRIPT_DIR" log --oneline -1
echo ""
echo "Package version:"
pip show mesheliza | grep -E "^(Name|Version|Location):"
echo ""
echo "To launch: ./mesheliza.sh"