Refactor install script for better dependency management

Updated install.sh to improve dependency installation and virtual environment setup.
This commit is contained in:
M0VUB 2025-12-13 19:11:38 +00:00 committed by GitHub
parent 4b7f08838e
commit 181d928969
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,7 +1,36 @@
#! /bin/bash
#!/bin/bash
set -e
# Install the required support programs
# Check if apt-get is available
if ! command -v apt-get >/dev/null; then
echo "apt-get not found. Please install dependencies manually for your OS."
exit 1
fi
# Ensure requirements.txt exists to prevent running in wrong directory
if [ ! -f requirements.txt ]; then
echo "requirements.txt not found! Run this script from the repository root."
exit 1
fi
# Install system dependencies
apt-get update
apt-get install python3 python3-pip python3-dev libffi-dev libssl-dev cargo sed -y
pip3 install --upgrade setuptools wheel --break-system-packages
pip3 install -r requirements.txt --break-system-packages
apt-get install -y python3 python3-pip python3-venv python3-dev libffi-dev libssl-dev cargo sed
# Set up Python virtual environment if not exists
if [ ! -d ".venv" ]; then
python3 -m venv .venv
fi
# Upgrade pip and tools, then install requirements in venv
. .venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install --no-cache-dir -r requirements.txt
echo ""
echo "=============================================="
echo "Setup complete! To activate, run:"
echo " source .venv/bin/activate"
echo ""
echo "Then run your app as usual (e.g., python monitor.py/bridge.py)"
echo "=============================================="