Skip to content

Commit

Permalink
[ros1] update env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsBurgh committed Apr 26, 2024
1 parent 62646a8 commit d4b0b4e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
17 changes: 9 additions & 8 deletions ros1/install.bash
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#! /usr/bin/env bash
# shellcheck disable=SC1090

if [ -z "$TUE_ROS_DISTRO" ]
[[ -v TUE_ENV_ROS_DISTRO || -v TUE_ROS_DISTRO ]] || { TUE_ENV_ROS_DISTRO=${TUE_ROS_DISTRO}; tue-install-warning "Change the config of your environment to use 'TUE_ENV_ROS_DISTRO' instead of 'TUE_ROS_DISTRO'"; }
if [[ -z "${TUE_ENV_ROS_DISTRO}" ]
then
tue-install-error "TUE_ROS_DISTRO was not set"
tue-install-error "TUE_ENV_ROS_DISTRO was not set"
return 1
fi

# Install basic ROS packages.
tue-install-system-now ros-"$TUE_ROS_DISTRO"-ros
tue-install-system-now ros-"${TUE_ENV_ROS_DISTRO}"-ros

if [ ! -d /etc/ros/rosdep ]
then
Expand All @@ -19,16 +20,16 @@ rosdep_update_file="/tmp/tue_rosdep_update_${USER}"
if [ ! -f "$rosdep_update_file" ]
then
tue-install-debug "Updating rosdep"
tue-install-pipe rosdep update --rosdistro "$TUE_ROS_DISTRO"
tue-install-pipe rosdep update --rosdistro "${TUE_ENV_ROS_DISTRO}"
touch "$rosdep_update_file"
fi

mkdir -p "$TUE_SYSTEM_DIR"
mkdir -p "${TUE_ENV_WS_DIR}"

if [ ! -f "$TUE_SYSTEM_DIR"/devel/setup.bash ]
if [ ! -f "${TUE_ENV_WS_DIR}"/devel/setup.bash ]
then
[[ -z "${TUE_ROS_VERSION}" ]] && { tue-install-warning "tue-env variable TUE_ROS_VERSION is not set. This will not be allowed in the future.\nSetting TUE_ROS_VERSION=1 temporarily."; }
[[ -z "${TUE_ENV_ROS_VERSION}" ]] && { tue-install-warning "tue-env variable TUE_ENV_ROS_VERSION is not set. This will not be allowed in the future.\nSetting TUE_ENV_ROS_VERSION=1 temporarily."; }
[[ "$CI" == "true" ]] && status_args=" --no-status"
# shellcheck disable=SC2086
TUE_ROS_VERSION=1 tue-make${status_args} || tue-install-error "Error in building the system workspace"
TUE_ENV_ROS_VERSION=1 tue-make${status_args} || tue-install-error "Error in building the system workspace"
fi
11 changes: 6 additions & 5 deletions ros1/setup
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
#! /usr/bin/env bash

if [ -z "$TUE_ROS_DISTRO" ]
[[ -v TUE_ENV_ROS_DISTRO || -v TUE_ROS_DISTRO ]] || { TUE_ENV_ROS_DISTRO=${TUE_ROS_DISTRO}; >&2 echo "Change the config of your environment to use 'TUE_ENV_ROS_DISTRO' instead of 'TUE_ROS_DISTRO'"; }
if [[ -z "${TUE_ENV_ROS_DISTRO}" ]]
then
echo -e "\e[31;1m[ros] TUE_ROS_DISTRO was not set\e[0m"
echo -e "\e[31;1m[ros] TUE_ENV_ROS_DISTRO was not set\e[0m"
return 1
fi

if [ -f "$TUE_SYSTEM_DIR"/devel/setup.bash ]
if [ -f "${TUE_ENV_WS_DIR}"/devel/setup.bash ]
then
# shellcheck disable=SC1091
source "$TUE_SYSTEM_DIR"/devel/setup.bash
source "${TUE_ENV_WS_DIR}"/devel/setup.bash
else
echo -e "\e[33;1m[ros] system workspaces not found, sourcing /opt/ros\e[0m"
# shellcheck disable=SC1090
source /opt/ros/"$TUE_ROS_DISTRO"/setup.bash
source /opt/ros/"${TUE_ENV_ROS_DISTRO}"/setup.bash
fi

# Set ROSCONSOLE_FORMAT
Expand Down

0 comments on commit d4b0b4e

Please sign in to comment.