diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index 956f8a7..6b503d5 --- a/install.sh +++ b/install.sh @@ -19,15 +19,20 @@ if mountpoint -q "$HOME/pCloudDrive" 2>/dev/null; then mkdir -p "$PCLOUD_TARGET" fi -# Install dependencies -echo "Installing dependencies..." -if ! pip install --user requests requests-mock pytest 2>&1 | tail -5; then - echo "ERROR: pip install --user failed (PEP 668 externally-managed environment?)." - echo "To install in a virtualenv instead, run:" - echo " python3 -m venv ~/tools/coe-mirror/.venv" - echo " source ~/tools/coe-mirror/.venv/bin/activate" - echo " pip install requests requests-mock pytest" - exit 1 +# Install runtime dependency (requests) if missing. Dev deps (pytest, requests-mock) +# are only needed by the test suite — install them separately in a venv if you plan to test. +if python3 -c "import requests" 2>/dev/null; then + echo "Runtime dep 'requests' already importable system-wide; skipping pip install." +else + echo "Installing runtime dependency: requests" + if ! pip install --user requests 2>&1 | tail -5; then + echo "ERROR: pip install --user failed (PEP 668 externally-managed environment?)." + echo "To install in a virtualenv instead:" + echo " python3 -m venv $TOOL_DIR/.venv" + echo " $TOOL_DIR/.venv/bin/pip install requests" + echo " # then edit systemd/coe-mirror.service ExecStart to point at the venv python" + exit 1 + fi fi # Copy unit files