From cce914b69afd868291fe32ab5b2eec7458ad5790 Mon Sep 17 00:00:00 2001 From: Andreas Greiner Date: Thu, 15 Dec 2022 09:51:54 +0100 Subject: [PATCH] moved repo addition to 94-ros2-src --- root/etc/cont-init.d/94-ros2-src | 12 ++++++++++++ root/etc/cont-init.d/95-apt-get | 2 +- root/etc/cont-init.d/98-ros2 | 23 +++++------------------ 3 files changed, 18 insertions(+), 19 deletions(-) create mode 100755 root/etc/cont-init.d/94-ros2-src diff --git a/root/etc/cont-init.d/94-ros2-src b/root/etc/cont-init.d/94-ros2-src new file mode 100755 index 0000000..720dbba --- /dev/null +++ b/root/etc/cont-init.d/94-ros2-src @@ -0,0 +1,12 @@ +#!/usr/bin/with-contenv bash + +echo "**** installing ros2 dev environment ****" +if ! dpkg -l | grep gnupg > /dev/null; then + apt-get update && apt-get install -y gnupg +fi + +source /etc/lsb-release +[[ ! -f "/etc/apt/sources.list.d/ros2.list" ]] && \ + curl -sL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key | apt-key add - && \ + echo "deb http://packages.ros.org/ros2/ubuntu ${DISTRIB_CODENAME} main" \ + > /etc/apt/sources.list.d/ros2.list diff --git a/root/etc/cont-init.d/95-apt-get b/root/etc/cont-init.d/95-apt-get index 3a725ea..5b1a21c 100755 --- a/root/etc/cont-init.d/95-apt-get +++ b/root/etc/cont-init.d/95-apt-get @@ -1,3 +1,3 @@ #!/usr/bin/with-contenv bash -apt-get update \ No newline at end of file +apt-get update diff --git a/root/etc/cont-init.d/98-ros2 b/root/etc/cont-init.d/98-ros2 index 5a48170..27b6587 100755 --- a/root/etc/cont-init.d/98-ros2 +++ b/root/etc/cont-init.d/98-ros2 @@ -1,19 +1,6 @@ -!/usr/bin/with-contenv bash +#!/usr/bin/with-contenv bash - -if ! dpkg -l | grep gnupg > /dev/null; then - apt-get update && apt-get install -y gnupg -fi - -if [ ! -f "/etc/apt/sources.list.d/ros2.list" ]; then - echo "**** Adding ROS2 packages to install list ****" - curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg - echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null - - echo "ros-humble-ros-base ros-dev-tools" >> /mod-repo-packages-to-install.list - - echo "**** Automatically sourcing ROS2 ****" - printf "\n# Automatically source ROS2 humble\nsource /opt/ros/humble/setup.bash" >> /etc/bash.bashrc -else - echo "**** ROS2 packages already installed, skipping ****" -fi \ No newline at end of file +echo "**** Installing ros2 and ros dev tools" +apt-get install -y \ + ros-humble-ros-base \ + ros-dev-tools