agi_fleet/agent/entrypoint.sh
2026-08-04 15:14:59 +04:00

20 lines
725 B
Bash

#!/bin/sh
# sanad_api_x2 entrypoint.
#
# The X2 agent runs on either a slim python base (http backend) or a ROS 2 base
# (ros2 backend). rclpy is only importable after the ROS overlay is sourced, and
# sourcing it must NOT be a hard requirement — so: source it if it exists, carry
# on if it doesn't. One image definition, every backend.
set -e
if [ -z "${ROS_DISTRO:-}" ] && [ -d /opt/ros ]; then
ROS_DISTRO="$(ls /opt/ros 2>/dev/null | head -1)"
fi
if [ -n "${ROS_DISTRO:-}" ] && [ -f "/opt/ros/${ROS_DISTRO}/setup.sh" ]; then
# shellcheck disable=SC1090
. "/opt/ros/${ROS_DISTRO}/setup.sh"
echo "entrypoint: sourced ROS ${ROS_DISTRO} (rclpy available)" >&2
fi
exec python3 -u /app/sanad_api_x2.py "$@"