Files
simtrace-analyser/sniff-start.bat
T
catarrh 65c8ab215b README: two explicit install paths; Windows launchers pass --db and quote paths
- the Install section now leads with the release artifacts (the wheel via
  pipx/pip, the direct release URL, `gh release download` for the
  version-agnostic case, and the source archive) and keeps the git clone as
  the development path.  It finally names the launchers (./start.sh,
  start.bat): a clone needs no install, but the README never said how to start
  it while the Running section only showed the console script that an install
  provides.
- Windows: the USB section now says the .bat launchers mirror the shell ones
  and call the `python` command (Python 3 must be on PATH); the Install section
  carries the same note.
- start.bat: --db/DB was parsed and then never passed to the server; it is
  passed now, and --gsmtap-port is sent only for gsmtap capture (as start.sh
  already did).  Both .bat files passed values unquoted and stripped the
  quotes of pass-through options, so paths with spaces broke
  (--db "C:\My Data\...", --web-dir, --pcap, --output); values are quoted now
  and pass-through keeps the original quoting (argument assembly through
  delayed expansion).
- the launcher usage comments include the `disabled` capture mode.
- verified the argument assembly with Wine cmd.exe and an echo harness: the
  quoted paths survive, --db arrives, --gsmtap-port appears only for gsmtap;
  547 Python + 80 Node tests.
2026-10-20 23:15:54 +03:00

78 lines
1.6 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
:: simtrace2-pysniff startup script for Windows
::
:: Usage: sniff-start.bat [--format FORMAT] [--gsmtap HOST[:PORT]] [--pcap FILE] [--output FILE] [--inactivity-timeout SECONDS]
::
:: Options set via environment variables act as defaults; CLI flags override them.
set "GSMTAP=%GSMTAP%"
set "PCAP=%PCAP%"
set "OUTPUT=%OUTPUT%"
set "FORMAT=%FORMAT%"
set "INACTIVITY_TIMEOUT=%INACTIVITY_TIMEOUT%"
if "%INACTIVITY_TIMEOUT%"=="" set "INACTIVITY_TIMEOUT=0"
set "EXTRA_ARGS="
:parse_args
if "%~1"=="" goto :run
if "%~1"=="--gsmtap" (
set "GSMTAP=%~2"
shift
shift
goto :parse_args
)
if "%~1"=="--pcap" (
set "PCAP=%~2"
shift
shift
goto :parse_args
)
if "%~1"=="--output" (
set "OUTPUT=%~2"
shift
shift
goto :parse_args
)
if "%~1"=="-o" (
set "OUTPUT=%~2"
shift
shift
goto :parse_args
)
if "%~1"=="--format" (
set "FORMAT=%~2"
shift
shift
goto :parse_args
)
if "%~1"=="-f" (
set "FORMAT=%~2"
shift
shift
goto :parse_args
)
if "%~1"=="--inactivity-timeout" (
set "INACTIVITY_TIMEOUT=%~2"
shift
shift
goto :parse_args
)
set "EXTRA_ARGS=!EXTRA_ARGS! %1"
shift
goto :parse_args
:run
echo Starting simtrace2-pysniff...
set "ARGS="
if not "%GSMTAP%"=="" set "ARGS=!ARGS! --gsmtap "%GSMTAP%""
if not "%PCAP%"=="" set "ARGS=!ARGS! --pcap "%PCAP%""
if not "%OUTPUT%"=="" set "ARGS=!ARGS! --output "%OUTPUT%""
if not "%FORMAT%"=="" set "ARGS=!ARGS! --format "%FORMAT%""
if not "%INACTIVITY_TIMEOUT%"=="0" set "ARGS=!ARGS! --inactivity-timeout "%INACTIVITY_TIMEOUT%""
set "PYTHONPATH=%~dp0"
python -m simtrace2_pysniff !ARGS! !EXTRA_ARGS!