Merge pysim-otaman-server into otaman (monorepo, v1.7.0)
- Move PWA into frontend/; server package at pysim_otaman_server/ - Server now serves the PWA (same origin -> no CORS/PNA): static file handler + --web-dir flag + injects window.PYSIM_EMBEDDED marker into index.html - Frontend defaults to relative API base when embedded (pysimBase = '') - Version 1.7.0 aligned: server.py VERSION, pyproject.toml, PWA header - SW cache bump otaman-v7 -> otaman-v8 - Docs: combined README + docs/api.md endpoint reference; update links - Fix stale package.json repository URL
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# pysim-otaman-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.8+ 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-otaman-server
|
||||
echo ""
|
||||
echo "=== Installing pysim-otaman-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."
|
||||
Reference in New Issue
Block a user