This commit is contained in:
cheykrym 2026-09-15 17:16:42 +03:00
parent dab2eab841
commit 4cd6f5f25f

View File

@ -21,13 +21,31 @@ if [[ ! -f "$MAIN" ]]; then
exit 1
fi
export DISPLAY="${DISPLAY:-:0}"
cd "$PROJECT_DIR"
if systemctl is-active --quiet car-ui.service; then
echo "ERROR: car-ui.service is already running."
echo
echo "Stop it before running source code directly:"
echo " sudo systemctl stop car-ui.service"
exit 1
fi
if systemctl is-active --quiet graphical.target; then
# Desktop mode
export DISPLAY="${DISPLAY:-:0}"
echo "==> Starting Car UI (Desktop)"
echo " DISPLAY=$DISPLAY"
else
# Console / Car mode
export QT_QPA_PLATFORM=eglfs
echo "==> Starting Car UI (EGLFS)"
echo " QT_QPA_PLATFORM=$QT_QPA_PLATFORM"
fi
echo "==> Starting Car UI"
echo " DISPLAY=$DISPLAY"
echo " Python: $VENV_DIR/bin/python3"
echo
cd "$PROJECT_DIR"
"$VENV_DIR/bin/python3" "$MAIN" 2>&1 | tee "$LOG_FILE"