Files
simple/setup.sh
T
catarrh 8f2d9732d6
release / release (push) Waiting to run
v3.31.1: the Linux PC/SC headers (pyscard builds from source)
The first release run failed installing the test dependencies:
pyscard 2.3.1 publishes macOS and Windows wheels only (no manylinux),
so on Linux it always builds from source and needs the PC/SC headers -
the job stopped at "winscard.h: No such file or directory".

- The release workflow installs libpcsclite-dev before the dependencies.
- The READMEs and setup.sh name the header package next to pcscd/ccid:
  libpcsclite-dev (Debian/Ubuntu), pcsc-lite-devel (Fedora), included
  in Arch's pcsclite.  This affects every Linux user running setup, not
  just CI.
- Version strings + the PWA cache bumped together (simple-v456).

No runtime change: 997 Python + 953 frontend green; the release package
test builds with the new version.
2026-10-20 23:34:15 +03:00

57 lines
1.9 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 (plus the PC/SC headers that the"
echo "pyscard build needs on Linux):"
echo " Debian/Ubuntu: sudo apt install pcscd pcsc-tools libpcsclite-dev"
echo " Arch Linux: sudo pacman -S pcsc-lite ccid (headers included)"
echo " Fedora: sudo dnf install pcsc-lite pcsc-lite-ccid pcsc-lite-devel"
fi
echo ""
echo "=== Setup complete ==="
echo "Run ./start.sh to start the server."