Files
simple/setup.sh
T
catarrh 5cea89cc66 docs: both install paths (release package / clone) + Windows notes refreshed
The READMEs told users to clone the repository even though most just
want to run the app.  The Quick start now leads with the release
package (a snapshot of the tagged source: no git history, no
development files) and keeps the clone path for development or
unreleased changes; git is still required because setup installs pysim
from its upstream repository.

Windows notes refreshed against the actual tooling and PyPI:
- pyscard 2.3.1 ships cp39-cp313 wheels (no cp314) and requires
  Python >= 3.9, so the pip/pyproject floor is 3.9 now (3.8 could
  never install the dependency) and the "3.9 builds from source" note
  is gone - only 3.14 does.
- The reader sentence now describes what actually happens: start.sh
  asks for the first PC/SC reader when pcscd runs, the server
  auto-detects a PC/SC reader itself, and with none present pysim
  falls back to its serial default /dev/ttyUSB0 (use -d for a
  serial/FTDI reader).
- The manual-install block is marked Linux/macOS: on Windows pysim is
  installed via requirements-pysim.txt + --no-deps (setup.bat), since
  the plain pip route pulls the SMPP bridge and its MSVC chain.

Docs/metadata only: 953 frontend + 989 Python green.
2026-10-20 23:23:31 +03:00

56 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
# pysim-simple-server setup script
# Creates a venv and installs pysim and its dependencies.
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
VENV_DIR="$SCRIPT_DIR/.venv"
# Check prerequisites
command -v python3 >/dev/null 2>&1 || { echo "Error: Python 3 is required but not found. Install Python 3.9+ from https://python.org"; exit 1; }
command -v git >/dev/null 2>&1 || { echo "Error: Git is required but not found. Install Git from https://git-scm.com"; exit 1; }
PY_VER=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
echo "Found Python $PY_VER"
# Create venv
if [ ! -d "$VENV_DIR" ]; then
echo "Creating virtual environment..."
python3 -m venv "$VENV_DIR"
fi
source "$VENV_DIR/bin/activate"
PIP="$VENV_DIR/bin/pip"
# Upgrade pip
$PIP install --upgrade pip -q
# Install pysim from the Osmocom repository
echo ""
echo "=== Installing pysim ==="
$PIP install git+https://github.com/osmocom/pysim.git
# Install pysim-simple-server
echo ""
echo "=== Installing pysim-simple-server ==="
$PIP install -e "$SCRIPT_DIR"
# Check for PC/SC
echo ""
if command -v pcscd >/dev/null 2>&1; then
echo "=== PC/SC daemon found ==="
if ! pgrep -x pcscd >/dev/null; then
echo "Starting pcscd..."
sudo pcscd || echo "Warning: could not start pcscd. Start it manually: sudo systemctl start pcscd"
fi
else
echo "Note: PC/SC daemon not found. If you use a USB smart card reader,"
echo "install pcsc-lite and ccid:"
echo " Debian/Ubuntu: sudo apt install pcscd pcsc-tools"
echo " Arch Linux: sudo pacman -S pcsc-lite ccid"
echo " Fedora: sudo dnf install pcsc-lite pcsc-lite-ccid"
fi
echo ""
echo "=== Setup complete ==="
echo "Run ./start.sh to start the server."