Skip to content

Commit

Permalink
Merged entrypoint files, implementing #2
Browse files Browse the repository at this point in the history
  • Loading branch information
gstavrinos committed Feb 3, 2023
1 parent 92562d7 commit cd8e8c4
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 33 deletions.
34 changes: 34 additions & 0 deletions includes/entrypoint.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
rosversion="unknown"
wstxt="ros2_ws.txt"
if [ -f /opt/ros/humble/setup.bash ]; then
rosversion="humble"
elif [ -f /opt/ros/noetic/setup.bash ]; then
rosversion="noetic"
wstxt="ros_ws.txt"
fi
if [ "$rosversion" != "unknown" ]; then
. /opt/ros/$rosversion/setup.bash
if [ "$rosversion" == "humble" ]; then
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
fi
while read -r line
do
bl="$(basename $line)"
wstxt="ros2_ws.txt"
cd /opt/ros/$bl
if rosdep check -i --from-path src --rosdistro $rosversion -y | grep -q 'System dependencies have not been satisfied'; then
apt update
fi
rosdep install -i --from-path src --rosdistro $rosversion -y
if [ "$rosversion" == "humble" ]; then
colcon build --symlink-install
. /opt/ros/$bl/install/setup.bash
else
catkin_make
. /opt/ros/$bl/devel/setup.bash
fi
done < /opt/ros/$wstxt
. /usr/share/gazebo/setup.bash
exec "$@"
fi
16 changes: 0 additions & 16 deletions includes/ros2_entrypoint.bash

This file was deleted.

15 changes: 0 additions & 15 deletions includes/ros_entrypoint.bash

This file was deleted.

2 changes: 1 addition & 1 deletion ros-ez/rosez
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ do
volumes=$volumes"--volume $wsdir:/opt/ros/$(basename $wsdir) "
done < $SCRIPT_DIR/../includes/ros_ws.txt
cd $cwd
x="sudo "$(sudo rocker --mode dry-run --network host --x11 $gpu_param --volume rosez-volume:/opt/ros/noetic/ --volume $SCRIPT_DIR/../includes/ros_ws.txt:/opt/ros/ros_ws.txt $volumes $SCRIPT_DIR/../includes/ros_entrypoint.bash:/root/.bashrc -- ros_ez:latest | tail -n 1 | sed -e 's/-v .*rosez-volume:/-v rosez-volume:/')
x="sudo "$(sudo rocker --mode dry-run --network host --x11 $gpu_param --volume rosez-volume:/opt/ros/noetic/ --volume $SCRIPT_DIR/../includes/ros_ws.txt:/opt/ros/ros_ws.txt $volumes $SCRIPT_DIR/../includes/entrypoint.bash:/root/.bashrc -- ros_ez:latest | tail -n 1 | sed -e 's/-v .*rosez-volume:/-v rosez-volume:/')
xauthf="$((echo \"$x\") | grep -E -o '/tmp/.docker[a-zA-Z0-9_-]+.xauth' | head -1)"
touch $xauthf
/bin/bash -c "xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $xauthf nmerge -"
Expand Down
2 changes: 1 addition & 1 deletion ros2-ez/ros2ez
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ do
volumes=$volumes"--volume $wsdir:/opt/ros/$(basename $wsdir) "
done < $SCRIPT_DIR/../includes/ros2_ws.txt
cd $cwd
x="sudo "$(sudo rocker --mode dry-run --network host --x11 $gpu_param --volume ros2ez-volume:/opt/ros/humble/ --volume $SCRIPT_DIR/../includes/ros2_ws.txt:/opt/ros/ros2_ws.txt $volumes $SCRIPT_DIR/../includes/ros2_entrypoint.bash:/root/.bashrc -- ros2_ez:latest | tail -n 1 | sed -e 's/-v .*ros2ez-volume:/-v ros2ez-volume:/')
x="sudo "$(sudo rocker --mode dry-run --network host --x11 $gpu_param --volume ros2ez-volume:/opt/ros/humble/ --volume $SCRIPT_DIR/../includes/ros2_ws.txt:/opt/ros/ros2_ws.txt $volumes $SCRIPT_DIR/../includes/entrypoint.bash:/root/.bashrc -- ros2_ez:latest | tail -n 1 | sed -e 's/-v .*ros2ez-volume:/-v ros2ez-volume:/')
xauthf="$((echo \"$x\") | grep -E -o '/tmp/.docker[a-zA-Z0-9_-]+.xauth' | head -1)"
touch $xauthf
/bin/bash -c "xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $xauthf nmerge -"
Expand Down

0 comments on commit cd8e8c4

Please sign in to comment.