mirror of
https://github.com/lopsided98/nix-ros-overlay.git
synced 2025-07-13 21:50:38 +03:00
21 lines
498 B
Bash
21 lines
498 B
Bash
isAmentPackage() {
|
|
[ -d "$1/share/ament_index" ]
|
|
}
|
|
|
|
declare -gA _amentPackagesSeen
|
|
|
|
_findAmentPackages() {
|
|
local pkg="$1"
|
|
# Deduplicate the packages
|
|
if [ -z "${_amentPackagesSeen["$pkg"]:-}" ] \
|
|
&& isAmentPackage "$pkg" \
|
|
&& [ -n "$(shopt -s nullglob; echo $pkg/share/*/local_setup.sh)" ]
|
|
then
|
|
# ROS scripts use unbound variables
|
|
set +u
|
|
source "$pkg"/share/*/local_setup.sh
|
|
set -u
|
|
fi
|
|
_amentPackagesSeen["$pkg"]=1
|
|
}
|
|
addEnvHooks "$hostOffset" _findAmentPackages
|