Skip to content
Snippets Groups Projects
Commit 80271022 authored by Montaño Sarria, Andres Felipe's avatar Montaño Sarria, Andres Felipe
Browse files

Add plugins installation option

parent c27232ea
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,7 @@ RUN apt-get update && \
# ccmake
cmake-curses-gui \
direnv \
gawk \
gdb \
git \
git-lfs \
......@@ -54,26 +55,6 @@ RUN if [ "$EXT_SHELL" = "zsh" ]; \
apt-get -y install zsh; \
fi
# Install extra libs from .deb files
WORKDIR /tmp/srcs/
COPY /extra_libs/* ./
# Enviroment tools based on ubuntu version
RUN if [ -f "common_libs.txt" ]; \
then \
grep -v '^#' common_libs.txt | xargs dpkg -i ;\
fi
# Extra libs, e.g. vtk-7.1_20221201-1_amd64.deb
RUN if [ -f "${ROS_DISTRO}_libs.txt" ]; \
then \
grep -v '^#' ${ROS_DISTRO}_libs.txt | xargs dpkg -i ;\
fi
RUN rm -rf *
RUN apt-get --reinstall install -y libnotify-bin notify-osd
# Configure system to look for debian packages in the Artifactory repository
COPY auth.conf /etc/apt/auth.conf.d/tecnalia.conf
......@@ -106,6 +87,8 @@ RUN if [ "${ROS_DISTRO}" = "melodic" ]; \
python-osrf-pycommon\
python-vcstool; \
else\
if [ "${ROS_DISTRO}" = "noetic" ]; \
then \
apt-get update && \
apt-get -y install \
ipython3 \
......@@ -117,6 +100,7 @@ RUN if [ "${ROS_DISTRO}" = "melodic" ]; \
python3-pip \
# clang
clangd liblldb-dev libllvm-ocaml-dev python3-clang; \
fi \
fi
# Install ROS 1 tools
......@@ -149,8 +133,45 @@ RUN if [ -f "${ROS_DISTRO}_requirements.txt" ]; \
RUN rm -rf *
# Install extra libs from .deb files
WORKDIR /tmp/srcs/
COPY /extra_libs/* ./
# Enviroment tools based on ubuntu version
RUN if [ -f "common_libs.txt" ]; \
then \
grep -v '^#' common_libs.txt | xargs dpkg -i ;\
fi
# Extra libs, e.g. vtk-7.1_20221201-1_amd64.deb
RUN if [ -f "${ROS_DISTRO}_libs.txt" ]; \
then \
grep -v '^#' ${ROS_DISTRO}_libs.txt | xargs dpkg -i ;\
fi
# Read the plugin list and copy the plugins to their destinations
RUN if [ -f "${ROS_DISTRO}_plugins.txt" ]; \
then \
while IFS= read -r line; \
do \
echo "Processing line: $line"; \
if [[ "$line" == \#* ]]; \
then \
echo "Skipping ${line}"; \
else \
plugin_name=$(echo "$line" | awk '{print $1}'); \
destination=$(echo "$line" | awk '{print $2}'); \
echo "Coping ${plugin_name} into ${destination}"; \
mkdir -p "$destination" && cp -r "$plugin_name" "$destination/"; \
fi; \
done < ${ROS_DISTRO}_plugins.txt ; \
fi
RUN rm -rf *
RUN apt-get --reinstall install -y libnotify-bin notify-osd
# Update this date to re-run the image final update
LABEL image.date=23-10-2023
LABEL image.date=25-10-2023
# Update final image
RUN apt-get update \
......
......@@ -9,11 +9,22 @@ alias drmi="docker rmi"
alias dsp="docker system prune --all"
alias dimp="docker image prune"
# Determine shell extension
if [ -z $SHELL ]; then
echo "SHELL not set"
export SHELL=/usr/bin/zsh
ext=$(basename ${SHELL});
else
ext=$(basename ${SHELL});
fi
# Build docker image
# usage: dockbuild {noetic, melodic}
function dockbuild(){
if [ $# -lt 1 ]; then
echo "Usage: dockbuild <ROS_DISTRO> [build_args]"
echo "ROS_DISTRO:"
echo " melodic, noetic, humble, etc."
echo "build_args:"
echo " EXT_SHELL - zsh (default) or bash"
return 1
......@@ -39,7 +50,23 @@ function dockbuild(){
# ToDo Add extra parameters by arg
# To share docker --volume /var/run/docker.sock:/var/run/docker.sock:ro
# To share video (usb-cam) --volume /dev/video0:/dev/video0
# To share pcan --volume /dev/pcanusb32:/dev/pcanusb32
function dockrun() {
if [ $# -lt 1 ]; then
echo "Usage: dockrun <ROS_DISTRO> [posicional options]"
echo "ROS_DISTRO:"
echo " melodic, noetic, humble, etc."
echo "Options:"
echo " Passing 1 option --> path_to_workspace. E.g., dockrun humble mairon_ws"
echo " Passing 2 options --> path_to_workspace + extra_config. E.g., dockrun humble mairon_ws video"
echo " extra_config: pcan, video, pcan_video"
echo "Examples:"
echo "dockrun humble mairon_ws"
echo "dockrun noetic neurondones_ws pcan_video"
echo "dockrun melodic odinrobot_ws video"
return 1
fi
# Check if the image exist
if [[ "$(docker images -q devenv:$1 2> /dev/null)" == "" ]]; then
# build the image
......@@ -48,12 +75,55 @@ function dockrun() {
# Check if the container exist
if [[ $(docker ps -aq -f name=$1) ]]; then
# Attach to conayiner
# Attach to container
if [ $# -lt 2 ]; then
docker exec -it $1 bash -c "cd ~/ros/$1 && $ext"
else
docker exec -it $1 bash -c "cd ~/ros/$1/$2 && $ext"
fi
else
# Launch container
cd ~/ros/$1/$2;
rocker --home --ssh --git --user --privileged --nvidia --x11 --network host --name $1 devenv:$1 $3
if [ $# -lt 4 ]; then
rocker --home --ssh --git --user --privileged --nvidia --x11 --network host --name $1 devenv:$1
else
if [ $3 = "pcan" ]; then
rocker --home --ssh --git --user --privileged --nvidia --x11 --volume /dev/pcanusb32:/dev/pcanusb32 --network host --name $1 devenv:$1
else
fi
fi
fi
}
function dockexec() {
if [ $# -lt 1 ]; then
echo "Usage: dockexec <ROS_DISTRO> [workspace] [command]"
echo "ROS_DISTRO:"
echo " melodic, noetic, humble, etc."
echo "Example:"
echo "dockexec noetic neurondones_ws roscore"
return 1
fi
# Check if the image exist
if [[ "$(docker images -q devenv:$1 2> /dev/null)" == "" ]]; then
# build the image
echo "Docker image for ${1} does not exist"
return 1
fi
# Check if the container exist
if [[ $(docker ps -aq -f name=$1) ]]; then
# Attach to container
if [ $# -lt 2 ]; then
docker exec -it $1 bash -c "cd ~/ros/$1 && $ext"
else
docker exec -it $1 bash -c "cd ~/ros/$1/$2 && $ext"
fi
else
# Launch container
echo "Container for ${1} does not exist"
fi
}
......
......@@ -88,7 +88,7 @@ function cbclean(){
then
roshome && rm -rf build devel install && catkin build --summarize --cmake-args -DCMAKE_BUILD_TYPE=Release
else
rm -rf build devel install && cb
rm -rf build log install && cb "$@"
fi
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment