Rework radar system
This commit is contained in:
@@ -219,34 +219,33 @@ ensure_system_dependencies() {
|
||||
done
|
||||
fi
|
||||
|
||||
if command -v pkg-config >/dev/null 2>&1 && pkg-config --exists libusb-1.0 \
|
||||
&& ((qt_gui_packages_missing == 0)) \
|
||||
&& python3 -c 'import ctypes; ctypes.CDLL("libatomic.so.1")' >/dev/null 2>&1; then
|
||||
local runtime_check='import ctypes, ctypes.util; name = ctypes.util.find_library("usb-1.0"); assert name; ctypes.CDLL(name); ctypes.CDLL("libatomic.so.1")'
|
||||
if ((qt_gui_packages_missing == 0)) && python3 -c "${runtime_check}" >/dev/null 2>&1; then
|
||||
return
|
||||
fi
|
||||
|
||||
echo "[start.sh] Installing system dependencies: libusb headers, libatomic and Qt xcb libraries..."
|
||||
echo "[start.sh] Installing system dependencies: libusb runtime, libatomic and Qt xcb libraries..."
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
run_privileged apt-get update
|
||||
run_privileged apt-get install -y pkg-config libusb-1.0-0-dev libatomic1 libxcb-cursor0 libxkbcommon-x11-0
|
||||
run_privileged apt-get install -y libusb-1.0-0 libatomic1 libxcb-cursor0 libxkbcommon-x11-0
|
||||
elif command -v dnf >/dev/null 2>&1; then
|
||||
run_privileged dnf install -y pkgconf-pkg-config libusb1-devel libatomic
|
||||
run_privileged dnf install -y libusb1 libatomic
|
||||
elif command -v yum >/dev/null 2>&1; then
|
||||
run_privileged yum install -y pkgconfig libusb1-devel libatomic
|
||||
run_privileged yum install -y libusb1 libatomic
|
||||
elif command -v pacman >/dev/null 2>&1; then
|
||||
run_privileged pacman -Sy --needed pkgconf libusb gcc-libs
|
||||
run_privileged pacman -Sy --needed libusb gcc-libs
|
||||
elif command -v zypper >/dev/null 2>&1; then
|
||||
run_privileged zypper --non-interactive install pkg-config libusb-1_0-devel libatomic1
|
||||
run_privileged zypper --non-interactive install libusb-1_0-0 libatomic1
|
||||
elif command -v brew >/dev/null 2>&1; then
|
||||
brew install pkg-config libusb gcc
|
||||
brew install libusb gcc
|
||||
else
|
||||
echo "Could not detect supported package manager." >&2
|
||||
echo "Install manually: pkg-config and libusb development package." >&2
|
||||
echo "Install manually: libusb-1.0, libatomic and the Qt xcb runtime libraries." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v pkg-config >/dev/null 2>&1 || ! pkg-config --exists libusb-1.0; then
|
||||
echo "libusb-1.0 development package is still unavailable after install attempt." >&2
|
||||
if ! python3 -c "${runtime_check}" >/dev/null 2>&1; then
|
||||
echo "libusb-1.0 or libatomic runtime is still unavailable after install attempt." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@@ -361,10 +360,10 @@ run_producer_only() {
|
||||
import os, sys
|
||||
from pathlib import Path
|
||||
from python_app.orchestration.producer_selection import acquisition_command
|
||||
command = acquisition_command(Path(sys.argv[1]), Path(sys.argv[2]))
|
||||
command = acquisition_command(Path(sys.argv[1]))
|
||||
print("[start.sh] Starting producer:", command, flush=True)
|
||||
os.execv(command[0], command)
|
||||
' "${PROJECT_ROOT}" "${config_path}"
|
||||
' "${config_path}"
|
||||
}
|
||||
|
||||
stop_headless_service() {
|
||||
@@ -393,10 +392,9 @@ verify_cpp_binaries() {
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from python_app.orchestration.producer_selection import acquisition_command
|
||||
command = acquisition_command(Path(sys.argv[1]), Path(sys.argv[2]))
|
||||
print("kamil_adc_collector" if "python_app.scripts.kamil_adc_raw_producer" in command
|
||||
else "sweep_orchestrator" if len(command) == 3 else "")
|
||||
' "${PROJECT_ROOT}" "${PROFILE_PATH:-${PROJECT_ROOT}/run_config.json}")"
|
||||
command = acquisition_command(Path(sys.argv[1]))
|
||||
print("kamil_adc_collector" if "python_app.scripts.kamil_adc_raw_producer" in command else "")
|
||||
' "${PROFILE_PATH:-${PROJECT_ROOT}/run_config.json}")"
|
||||
required_bins="${required_bins} ${acquisition_binary}"
|
||||
for bin in ${required_bins}; do
|
||||
if [[ ! -x "${PROJECT_ROOT}/build/bin/${bin}" ]]; then
|
||||
@@ -427,11 +425,10 @@ main() {
|
||||
resolve_profile_path
|
||||
check_environment
|
||||
detect_radar_model
|
||||
# Skip first-time provisioning (build headers, USB udev rule) in headless
|
||||
# Skip first-time provisioning (runtime libraries, USB udev rule) in headless
|
||||
# mode: the daemon runs unattended at boot as a non-root user and must not
|
||||
# block on sudo. A fresh machine is provisioned by one interactive launch.
|
||||
# `all` builds the libusb orchestrator for every model; only the USB access
|
||||
# rule is device-specific. Python/C++ SHM also needs libatomic.
|
||||
# LibreVNA uses Python/libusb; Python/C++ SHM needs libatomic.
|
||||
if ((HEADLESS == 0)); then
|
||||
ensure_system_dependencies
|
||||
if [[ "${RADAR_MODEL}" != "kamil_adc" ]]; then ensure_usb_access_rules; fi
|
||||
|
||||
Reference in New Issue
Block a user