From 3d1675ed94c6686182a9b1fc14dcc1c2d42d727d Mon Sep 17 00:00:00 2001 From: George Stavrinos Date: Tue, 29 Oct 2024 17:40:05 +0200 Subject: [PATCH 1/4] Improved volume handling for better media sharing (external drives) The diff is huge due to my auto-formatter --- internal/rosez_exec.bash | 177 +++++++++++++++++++-------------------- 1 file changed, 87 insertions(+), 90 deletions(-) diff --git a/internal/rosez_exec.bash b/internal/rosez_exec.bash index 6990a3d..1443f50 100755 --- a/internal/rosez_exec.bash +++ b/internal/rosez_exec.bash @@ -1,5 +1,5 @@ #!/bin/bash -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) cwd=$(pwd) cd $cwd source $SCRIPT_DIR/helpers.bash @@ -23,138 +23,135 @@ no_sound=0 lockdir="" userid=$(id -u) if [ "$1" == "1" ]; then - rosws_file="ros_ws.txt" - rosez_vol="rosez-volume" - ros="noetic" - ros_image="ros_ez" + rosws_file="ros_ws.txt" + rosez_vol="rosez-volume" + ros="noetic" + ros_image="ros_ez" elif [ "$1" == "3" ]; then - rosws_file="rosm_ws.txt" - rosez_vol="rosezm-volume" - ros="melodic" - ros_image="ros_ezm" + rosws_file="rosm_ws.txt" + rosez_vol="rosezm-volume" + ros="melodic" + ros_image="ros_ezm" elif [ "$1" == "4" ]; then - rosws_file="ros2f_ws.txt" - rosez_vol="ros2ezf-volume" - ros="foxy" - ros_image="ros2_ezf" + rosws_file="ros2f_ws.txt" + rosez_vol="ros2ezf-volume" + ros="foxy" + ros_image="ros2_ezf" fi shift trap 'signal_handler' $signal_list volumes="" lockation="" -while read -r line -do - wsdir=$(eval echo -e "$line") - if [ ! -d "$wsdir" ]; then - echo "$wsdir not found, creating it" - mkdir -p $wsdir/src - fi - volumes=$volumes"--volume $wsdir:/opt/ros/$(basename $wsdir) " - if [[ -z "$lockation" ]]; then - lockation=$wsdir - fi -done < $SCRIPT_DIR/../includes/$rosws_file +while read -r line; do + wsdir=$(eval echo -e "$line") + if [ ! -d "$wsdir" ]; then + echo "$wsdir not found, creating it" + mkdir -p $wsdir/src + fi + volumes=$volumes"--volume $wsdir:/opt/ros/$(basename $wsdir) " + if [[ -z "$lockation" ]]; then + lockation=$wsdir + fi +done <$SCRIPT_DIR/../includes/$rosws_file # I am not using the index here, # but I make sure that I cycle through # the (at most) first i parameters # to catch all the flags for i in "${!known_params[@]}"; do - if [ "${known_params[0]}" == "$1" ] || [ "${known_params_short[0]}" == "$1" ]; then - gpu_param="--device /dev/dri/card0" - shift - elif [ "${known_params[1]}" == "$1" ] || [ "${known_params_short[1]}" == "$1" ]; then - clear_locks=1 - shift - elif [ "${known_params[2]}" == "$1" ] || [ "${known_params_short[2]}" == "$1" ]; then - skip_compilation=1 - shift - elif [ "${known_params[3]}" == "$1" ] || [ "${known_params_short[3]}" == "$1" ]; then - non_interactive=1 - shift - elif [ "${known_params[4]}" == "$1" ] || [ "${known_params_short[4]}" == "$1" ]; then - no_sound=1 - shift - else - break - fi + if [ "${known_params[0]}" == "$1" ] || [ "${known_params_short[0]}" == "$1" ]; then + gpu_param="--device /dev/dri/card0" + shift + elif [ "${known_params[1]}" == "$1" ] || [ "${known_params_short[1]}" == "$1" ]; then + clear_locks=1 + shift + elif [ "${known_params[2]}" == "$1" ] || [ "${known_params_short[2]}" == "$1" ]; then + skip_compilation=1 + shift + elif [ "${known_params[3]}" == "$1" ] || [ "${known_params_short[3]}" == "$1" ]; then + non_interactive=1 + shift + elif [ "${known_params[4]}" == "$1" ] || [ "${known_params_short[4]}" == "$1" ]; then + no_sound=1 + shift + else + break + fi done if [ -z "$gpu_param" ]; then - if grep -q "nvidia" <<< "$gpu_string" || grep -q "Nvidia" <<< "$gpu_string" || grep -q "NVIDIA" <<< "$gpu_string" - then - gpu_param="--gpus all" - elif grep -q "intel" <<< "$gpu_string" || grep -q "Intel" <<< "$gpu_string" || grep -q "INTEL" <<< "$gpu_string" - then - gpu_param="--device /dev/dri/card0" - else - echo "No Nvidia or Intel GPU found. This case has not been investigated yet. GUI integration might be broken. (Good luck!)" - fi + if grep -q "nvidia" <<<"$gpu_string" || grep -q "Nvidia" <<<"$gpu_string" || grep -q "NVIDIA" <<<"$gpu_string"; then + gpu_param="--gpus all" + elif grep -q "intel" <<<"$gpu_string" || grep -q "Intel" <<<"$gpu_string" || grep -q "INTEL" <<<"$gpu_string"; then + gpu_param="--device /dev/dri/card0" + else + echo "No Nvidia or Intel GPU found. This case has not been investigated yet. GUI integration might be broken. (Good luck!)" + fi fi if [ $clear_locks -gt 0 ]; then - echo -e "${colour_orange}I was passed the clear-locks flag. Deleting all lock files...$colour_end" - rm -f $lockation/$lock_prefix*$lock_suffix + echo -e "${colour_orange}I was passed the clear-locks flag. Deleting all lock files...$colour_end" + rm -f $lockation/$lock_prefix*$lock_suffix fi echo $gpu_param touch $lockation/$lock_file locked=1 while [ $locked -gt 0 ]; do - found_lock="$(find $lockation -maxdepth 1 -name "$lock_prefix*$lock_suffix" -print | sort | head -1)" - # The found_lock should be empty only - # in the (rare?) case of enabling the - # clear-locks (cl) flag from another rosez process - # --- - # A new lock_file is created, since the other rosez - # process will instantly get priority with the cl flag. - echo $found_lock - if [[ -z "$found_lock" ]]; then - now="$(date +'%Y-%m-%d_%H_%M_%S_%N')" - lock_file="$lock_prefix$now$lock_suffix" - touch $lockation/$lock_file - found_lock=$lockation/$lock_file - fi - fl="$(basename $found_lock)" - echo -e "${colour_blue}Processing: $fl$colour_end" - if [ "$fl" \< "$earliest_possible_lock_file" ]; then - echo -e "${colour_orange}Found problematic lock file ($fl)! Deleting it... (Lock file older than uptime)$colour_end" - sudo rm $found_lock - elif [ "$fl" \< "$lock_file" ]; then - echo -e "${colour_orange}Found earlier lock file ($fl) than my own ($lock_file)!\nWaiting...$colour_end" - sleep 3 - elif [ "$fl" == "$lock_file" ]; then - echo -e "${colour_green}My lock file ($lock_file) is the earliest found. Continuing...$colour_end" - locked=0 - fi + found_lock="$(find $lockation -maxdepth 1 -name "$lock_prefix*$lock_suffix" -print | sort | head -1)" + # The found_lock should be empty only + # in the (rare?) case of enabling the + # clear-locks (cl) flag from another rosez process + # --- + # A new lock_file is created, since the other rosez + # process will instantly get priority with the cl flag. + echo $found_lock + if [[ -z "$found_lock" ]]; then + now="$(date +'%Y-%m-%d_%H_%M_%S_%N')" + lock_file="$lock_prefix$now$lock_suffix" + touch $lockation/$lock_file + found_lock=$lockation/$lock_file + fi + fl="$(basename $found_lock)" + echo -e "${colour_blue}Processing: $fl$colour_end" + if [ "$fl" \< "$earliest_possible_lock_file" ]; then + echo -e "${colour_orange}Found problematic lock file ($fl)! Deleting it... (Lock file older than uptime)$colour_end" + sudo rm $found_lock + elif [ "$fl" \< "$lock_file" ]; then + echo -e "${colour_orange}Found earlier lock file ($fl) than my own ($lock_file)!\nWaiting...$colour_end" + sleep 3 + elif [ "$fl" == "$lock_file" ]; then + echo -e "${colour_green}My lock file ($lock_file) is the earliest found. Continuing...$colour_end" + locked=0 + fi done bloom_file=/home/$USER/.config/bloom gitconfig_file=/home/$USER/.gitconfig ssh_folder=/home/$USER/.ssh -if [ ! -f $bloom_file ]; then - touch $bloom_file +if [ ! -f $bloom_file ]; then + touch $bloom_file fi -if [ ! -f $gitconfig_file ]; then - touch $gitconfig_file +if [ ! -f $gitconfig_file ]; then + touch $gitconfig_file fi -if [ ! -d $ssh_folder ]; then - mkdir $ssh_folder +if [ ! -d $ssh_folder ]; then + mkdir $ssh_folder fi intermediate_error_handler $? sound="-v /run/user/$userid/pulse:/run/user/$userid/pulse --device /dev/snd -e PULSE_SERVER=unix:/run/user/$userid/pulse/native -v /run/user/$userid/pulse/native:/run/user/$userid/pulse/native" if [ $no_sound -gt 0 ]; then - sound="" + sound="" fi it="-it" if [ $non_interactive -gt 0 ]; then - it="" + it="" fi xauthf="/tmp/.$ros_image-$now.xauth" touch $xauthf intermediate_error_handler $? /bin/bash -c "xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $xauthf nmerge -" intermediate_error_handler $? -x="docker run --ulimit nofile=1024:524288 --rm $it -u $userid --ipc=host --privileged --network host $gpu_param $sound --group-add dialout --group-add video --group-add audio -v $rosez_vol-bin:/bin -v $rosez_vol-etc:/etc/ -v $rosez_vol-home:/home/ -v $rosez_vol-lib:/lib/ -v $rosez_vol-lib64:/lib64/ -v /mnt:/mnt -v $rosez_vol-opt:/opt/ -v $rosez_vol-root:/root/ -v /run:/run -v $rosez_vol-sbin:/sbin/ -v $rosez_vol-srv:/srv/ -v $rosez_vol-usr:/usr -v $rosez_vol-var:/var -v $rosez_vol:/opt/ros/$ros -v $SCRIPT_DIR/../includes/$rosws_file:/opt/ros/$rosws_file $volumes -v $SCRIPT_DIR/entrypoint.bash:/home/rosez_user/.bashrc -v /sys:/sys -v /dev:/dev -v $bloom_file:/home/rosez_user/.config/bloom -v $gitconfig_file:/home/rosez_user/.gitconfig -v $ssh_folder:/home/rosez_user/.ssh -v $SCRIPT_DIR/supported_versions.txt:/home/rosez_user/supported_versions.txt -v $SCRIPT_DIR/helpers.bash:/home/rosez_user/helpers.bash -v /:$HOME/.$rosez_vol -e DISPLAY -e TERM -e QT_X11_NO_MITSHM=1 -e XAUTHORITY=$xauthf -v $xauthf:$xauthf -v /tmp/.X11-unix:/tmp/.X11-unix -v /etc/localtime:/etc/localtime:ro $ros_image:latest" +x="docker run --ulimit nofile=1024:524288 --rm $it -u $userid --ipc=host --privileged --network host $gpu_param $sound --group-add dialout --group-add video --group-add audio -v $rosez_vol-bin:/bin -v $rosez_vol-etc:/etc/ -v $rosez_vol-home:/home/ -v $rosez_vol-lib:/lib/ -v $rosez_vol-lib64:/lib64/ -v /media:/media -v /mnt:/mnt -v $rosez_vol-opt:/opt/ -v $rosez_vol-root:/root/ -v /run:/run -v $rosez_vol-sbin:/sbin/ -v $rosez_vol-srv:/srv/ -v $rosez_vol-usr:/usr -v $rosez_vol-var:/var -v $rosez_vol:/opt/ros/$ros -v $SCRIPT_DIR/../includes/$rosws_file:/opt/ros/$rosws_file $volumes -v $SCRIPT_DIR/entrypoint.bash:/home/rosez_user/.bashrc -v /sys:/sys -v /proc:/proc -v /dev:/dev -v $bloom_file:/home/rosez_user/.config/bloom -v $gitconfig_file:/home/rosez_user/.gitconfig -v $ssh_folder:/home/rosez_user/.ssh -v $SCRIPT_DIR/supported_versions.txt:/home/rosez_user/supported_versions.txt -v $SCRIPT_DIR/helpers.bash:/home/rosez_user/helpers.bash -v /:$HOME/.$rosez_vol -e DISPLAY -e TERM -e QT_X11_NO_MITSHM=1 -e XAUTHORITY=$xauthf -v $xauthf:$xauthf -v /tmp/.X11-unix:/tmp/.X11-unix -v /etc/localtime:/etc/localtime:ro $ros_image:latest" intermediate_error_handler $? extras="env $ENV LOCKFILE=$lock_file SKIPCOMPILATION=$skip_compilation /bin/bash" if [ $# -gt 0 ]; then - extras=$extras" -c \"source /home/rosez_user/.bashrc && $* \"" + extras=$extras" -c \"source /home/rosez_user/.bashrc && $* \"" fi x="$x $extras" intermediate_error_handler $? From d50c87f12f063684fc277d27024fea66c1275e4f Mon Sep 17 00:00:00 2001 From: George Stavrinos Date: Wed, 30 Oct 2024 18:14:52 +0200 Subject: [PATCH 2/4] Now using docker run once and then using exec for multiple shells and commands The diff is flooded mostly by my auto formatter. This should settle down in future commits --- README.md | 84 ++++++++------- internal/entrypoint.bash | 101 +++++++++--------- internal/helpers.bash | 91 ++++++++-------- internal/rosez_exec.bash | 218 ++++++++++++++++++++++----------------- 4 files changed, 269 insertions(+), 225 deletions(-) diff --git a/README.md b/README.md index 1d0e74b..1078362 100644 --- a/README.md +++ b/README.md @@ -4,15 +4,16 @@ Docker hacks for quick and easy access to ROS2 (foxy, humble) and ROS1 (melodic, ## Requirements -* `docker` -* `Linux` (not necessarily Debian-based) -* `dialog` (optionally for interactive terminal UI) +- `docker` +- `Linux` (not necessarily Debian-based) +- `dialog` (optionally for interactive terminal UI) ## Instructions -* Make sure your system satisfies all the requirements. The installer script tries to remain distro-agnostic, thus does not install anything. -* Run the `installer.bash` script with a single argument with the rosez version you need to install. e.g. `./installer.bash ros2ez`. You can also run it interactively with no arguments. For ros-ez versions < `1.7.0`, you must use one of the `ros_*installer.bash` scripts. There are multiple, one for each supported ROS distribution. -* Run `. ~/.bashrc` or open a new terminal. -* Run `ros2ez` for ROS2 Humble, `ros2ezf` for ROS2 Foxy or `rosez` for ROS1 Noetic and `rosezm` for ROS1 Melodic followed by the command you want to run else. If no command is provided you will be thrown in a shell inside the image (useful when autocomplete is required). + +- Make sure your system satisfies all the requirements. The installer script tries to remain distro-agnostic, thus does not install anything. +- Run the `installer.bash` script with a single argument with the rosez version you need to install. e.g. `./installer.bash ros2ez`. You can also run it interactively with no arguments. For ros-ez versions < `1.7.0`, you must use one of the `ros_*installer.bash` scripts. There are multiple, one for each supported ROS distribution. +- Run `. ~/.bashrc` or open a new terminal. +- Run `ros2ez` for ROS2 Humble, `ros2ezf` for ROS2 Foxy or `rosez` for ROS1 Noetic and `rosezm` for ROS1 Melodic followed by the command you want to run else. If no command is provided you will be thrown in a shell inside the image (useful when autocomplete is required). #### Examples @@ -22,36 +23,47 @@ or `rosez rosrun rviz rviz` -#### Tips/Features/Changelog! -* `NVIDIA` users should install the [nvidia-container-toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker) that massively boosts performance inside docker containers. -* If you encounter errors regarding your graphics card while trying to run the `rosez` or `ros2ez` script, try adding the `fi` or `force-integrated` flag, which will force usage of the integrated graphics card of your computer. This is, of course, not optimal, so update your drivers and try running the script again. Make sure that the flag is the first argument of your command. If this fails too, open an issue. For instance, the examples above can be executed with the integrated graphics card by running `ros2ez fi ros2 run teleop_twist_keyboard teleop_twist_keyboard cmd_vel:=racer_01/cmd_vel` and `rosez fi rosrun rviz rviz` respectively. -* You can change or add default workspaces by editing the `includes/ros*_ws.txt` file. One directory per line. -* Migrating from `v1.0.0` to newer versions will most probably introduce some permission issues, since newer versions try to stay inside the user's permissions instead of root. A chown of your workspace(s) to your user should fix the problem. -* [For versions >= `v1.1.0`] User configurable and system files have been separated, so you (most probably) should not mess with the `internals` folder. -* [For versions <= `v1.1.0`] Running multiple `ros*ez` commands concurrently (in separate terminals) can introduce race conditions, especially in workspace building (colcon (ROS2) or catkin (ROS1)). Refrain from running `ros*ez` commands concurrently, but wait for build commands to finish. -* [For versions >= `v1.2.0`] The new concurrency handling system allows for execution of multiple `ros*ez` commands concurrently (in separate terminals). The system uses lock files and tries to handle them effectively to avoid dangling ones. In the (rare?) case of a dangling lock file (essentially eternally waiting for a lock file to unlock), you should do one of the following solutions: The first one is to reboot your machine. The next time you boot up, your lock file will be older than your system's uptime, and be automatically removed. The second one is to use the `clear-locks` or `cl` flag during `ros*ez` execution. Keep in mind that if you generally use the `force-integrated` or `fi` flag, you willneed it here too. For instance, the next commands will remove **ALL** locks and then run the specified command `ros2ez fi cl ros2 run teleop_twist_keyboard teleop_twist_keyboard cmd_vel:=racer_01/cmd_vel` or for ros1 `rosez cl fi rosrun rviz rviz`. Note that the order of the flags is not important, but **have** to be placed before the required ros command. -* [For versions >= `v1.2.1`] Users are now able to use their local git configuration (ssh keys etc) and bloom release, from within the ros\*ez environment. -* [For versions >= `v1.2.2`] There was a problem that was introduced in `v1.2.1` regarding volumes and permissions for user configuration files in ssh, git and bloom. It is now fixed. -* [For versions >= `v1.2.3`] The installer script now checks if the user is in the docker group, and if not adds them and prompts for reboot at the end of the installation. -* [For versions >= `v1.3.0`] A ROS Melodic version is now available (with the `rosezm` command) and a much more robust locking mechanism is now in effect. If you experienced frequent lockouts or race conditions, this version should be more stable. -* [For versions >= `v1.4.0`] All supported ROS versions (melodic/noetic/humble) now work on a completely persistent filesystem to save apt, library and other installations + all other user-defined changes on the container. Additionally, this version also supports audio, enabling users to play sounds through the `rosez` containers. -* [For versions >= `v1.5.0`] The `sc` or `skip-compilation` flag is now supported, which completely bypasses rosdep and catkin/colcon builds for faster startup. -* [For versions >= `v1.6.0`] A ROS2 Foxy version is now available (with the `ros2ezf` command). Its image comes with built-in `ros1_bridge` support for *ez* ROS1-ROS2 integration. -* [For versions >= `v1.6.1`] A deletion script has been included inside the `internal/deeper/` folder. It takes the version-to-delete as an argument. For example, `bash delete_version.bash ros2ezf` deletes the Foxy version for rosez. -* [For versions >= `v1.7.0`] A new script to easily create systemd services was added. It can be used interactively using `dialog` or non-interactively by passing it 9 arguments. Running the `create_rosez_systemd_service.bash` with less than 9 args (but more than 0) will trigger a help message. Additionally the installation scripts have been merged into one, `installer.bash`. You can now use it interactively, or pass a single argument with the rosez version you need to install. e.g. `./installer.bash ros2ez` -* [For versions >= `v2.0.0`] Docker devices like sound and graphics are now manually handled. This version is **NOT** the same as the previous ones. This is a pretty substantial change, thus getting a major release. Externally nothing should change for the end user, but internally a lot has changed. OSRF's `rocker` is no longer utilized, making docker handling more versatile (but also fragile). -* [For versions >= `v2.0.1`] Sound integration is now working normally. The bug was introduced in `v2.0.0`. -* [For versions >= `v2.0.2`] Simplification of the systemd service generation. -* [For versions >= `v2.1.0`] First attempt to use (runtime) host folders instead of saving them on volumes (for /mnt, /run, /sys). -* [For versions >= `v2.2.0`] Fixed a bug that surfaced on newer kernels running old distros regarding soft and hard nofile (ulimit). +#### Tips/Features + +- `NVIDIA` users should install the [nvidia-container-toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#docker) that massively boosts performance inside docker containers. +- If you encounter errors regarding your graphics card while trying to run the `rosez` or `ros2ez` script, try adding the `fi` or `force-integrated` flag, which will force usage of the integrated graphics card of your computer. This is, of course, not optimal, so update your drivers and try running the script again. Make sure that the flag is the first argument of your command. If this fails too, open an issue. For instance, the examples above can be executed with the integrated graphics card by running `ros2ez fi ros2 run teleop_twist_keyboard teleop_twist_keyboard cmd_vel:=racer_01/cmd_vel` and `rosez fi rosrun rviz rviz` respectively. +- You can change or add default workspaces by editing the `includes/ros*_ws.txt` file. One directory per line. + +## Available flags + +TODO ## Tested Linux distributions -* EndeavourOS -* Fedora 35, 36, 39, 40 -* Ubuntu 22.04 -* MX Linux 19.1 -* Windows through WSL2 (experimental) + +- EndeavourOS +- Fedora 35, 36, 39, 40, 41 +- Ubuntu 22.04 +- MX Linux 19.1 +- Windows through WSL2 (experimental) ## Tested display servers -* X11 -* Wayland + +- X11 +- Wayland + +## Changelog + +- Migrating from `v1.0.0` to newer versions will most probably introduce some permission issues, since newer versions try to stay inside the user's permissions instead of root. A chown of your workspace(s) to your user should fix the problem. +- [For versions >= `v1.1.0`] User configurable and system files have been separated, so you (most probably) should not mess with the `internals` folder. +- [For versions <= `v1.1.0`] Running multiple `ros*ez` commands concurrently (in separate terminals) can introduce race conditions, especially in workspace building (colcon (ROS2) or catkin (ROS1)). Refrain from running `ros*ez` commands concurrently, but wait for build commands to finish. +- [For versions >= `v1.2.0`] The new concurrency handling system allows for execution of multiple `ros*ez` commands concurrently (in separate terminals). The system uses lock files and tries to handle them effectively to avoid dangling ones. In the (rare?) case of a dangling lock file (essentially eternally waiting for a lock file to unlock), you should do one of the following solutions: The first one is to reboot your machine. The next time you boot up, your lock file will be older than your system's uptime, and be automatically removed. The second one is to use the `clear-locks` or `cl` flag during `ros*ez` execution. Keep in mind that if you generally use the `force-integrated` or `fi` flag, you willneed it here too. For instance, the next commands will remove **ALL** locks and then run the specified command `ros2ez fi cl ros2 run teleop_twist_keyboard teleop_twist_keyboard cmd_vel:=racer_01/cmd_vel` or for ros1 `rosez cl fi rosrun rviz rviz`. Note that the order of the flags is not important, but **have** to be placed before the required ros command. +- [For versions >= `v1.2.1`] Users are now able to use their local git configuration (ssh keys etc) and bloom release, from within the ros\*ez environment. +- [For versions >= `v1.2.2`] There was a problem that was introduced in `v1.2.1` regarding volumes and permissions for user configuration files in ssh, git and bloom. It is now fixed. +- [For versions >= `v1.2.3`] The installer script now checks if the user is in the docker group, and if not adds them and prompts for reboot at the end of the installation. +- [For versions >= `v1.3.0`] A ROS Melodic version is now available (with the `rosezm` command) and a much more robust locking mechanism is now in effect. If you experienced frequent lockouts or race conditions, this version should be more stable. +- [For versions >= `v1.4.0`] All supported ROS versions (melodic/noetic/humble) now work on a completely persistent filesystem to save apt, library and other installations + all other user-defined changes on the container. Additionally, this version also supports audio, enabling users to play sounds through the `rosez` containers. +- [For versions >= `v1.5.0`] The `sc` or `skip-compilation` flag is now supported, which completely bypasses rosdep and catkin/colcon builds for faster startup. +- [For versions >= `v1.6.0`] A ROS2 Foxy version is now available (with the `ros2ezf` command). Its image comes with built-in `ros1_bridge` support for _ez_ ROS1-ROS2 integration. +- [For versions >= `v1.6.1`] A deletion script has been included inside the `internal/deeper/` folder. It takes the version-to-delete as an argument. For example, `bash delete_version.bash ros2ezf` deletes the Foxy version for rosez. +- [For versions >= `v1.7.0`] A new script to easily create systemd services was added. It can be used interactively using `dialog` or non-interactively by passing it 9 arguments. Running the `create_rosez_systemd_service.bash` with less than 9 args (but more than 0) will trigger a help message. Additionally the installation scripts have been merged into one, `installer.bash`. You can now use it interactively, or pass a single argument with the rosez version you need to install. e.g. `./installer.bash ros2ez` +- [For versions >= `v2.0.0`] Docker devices like sound and graphics are now manually handled. This version is **NOT** the same as the previous ones. This is a pretty substantial change, thus getting a major release. Externally nothing should change for the end user, but internally a lot has changed. OSRF's `rocker` is no longer utilized, making docker handling more versatile (but also fragile). +- [For versions >= `v2.0.1`] Sound integration is now working normally. The bug was introduced in `v2.0.0`. +- [For versions >= `v2.0.2`] Simplification of the systemd service generation. +- [For versions >= `v2.1.0`] First attempt to use (runtime) host folders instead of saving them on volumes (for /mnt, /run, /sys). +- [For versions >= `v2.2.0`] Fixed a bug that surfaced on newer kernels running old distros regarding soft and hard nofile (ulimit). +- [For versions >= `v2.3.0`] The `rosez*` containers are now handled in a more optimised way. This is achieved by running the container once and then using exec to access a shell. This should solve (most of?) the conflicts in packages install/not found on different shells. Also introduced a the `kill-container` or `kc` flag to forcefully kill the `rosez*` container. diff --git a/internal/entrypoint.bash b/internal/entrypoint.bash index 84907cc..a00a86c 100644 --- a/internal/entrypoint.bash +++ b/internal/entrypoint.bash @@ -7,63 +7,64 @@ skip_compilation=$SKIPCOMPILATION rosversion="unknown" lockation="" wstxt="" -for i in $(seq 0 $(( ${#distros[@]}-1 )) ); do - if [ -f /opt/ros/"${distros[$i]}"/setup.bash ]; then - rosversion="${distros[$i]}" - wstxt="${workspaces[$i]}" - fi +for i in $(seq 0 $((${#distros[@]} - 1))); do + if [ -f /opt/ros/"${distros[$i]}"/setup.bash ]; then + rosversion="${distros[$i]}" + wstxt="${workspaces[$i]}" + fi done -read -r lockdir/dev/null` || tmpfile=/tmp/test$$ - trap "rm -f $tmpfile" $signal_list - if [ -n "$3" ] && [ $3 -eq 0 ]; then - eval "$dialog_command $1 \"$2\" 20 61 \"$4\" 2>$tmpfile" + tmpfile=$(tempfile 2>/dev/null) || tmpfile=/tmp/test$$ + trap "rm -f $tmpfile" $signal_list + if [ -n "$3" ] && [ $3 -eq 0 ]; then + eval "$dialog_command $1 \"$2\" 20 61 \"$4\" 2>$tmpfile" - else - eval "$dialog_command $1 \"$2\" 20 60 $3 $4 2>$tmpfile" - fi - retval=$? - if [ $retval -eq 0 ]; then - choice=$(cat $tmpfile) - else - clear - exit 0 - fi - } + else + eval "$dialog_command $1 \"$2\" 20 60 $3 $4 2>$tmpfile" + fi + retval=$? + if [ $retval -eq 0 ]; then + choice=$(cat $tmpfile) + else + clear + exit 0 + fi +} # This function read a txt file with all the supported ros versions along with their configuration function get_supported_versions { - helper_script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) - supported_versions_file=$helper_script_dir/supported_versions.txt - vnum=0 - while read -r line; do - while IFS=',' read -ra line_arr; do - if [ $vnum -gt 0 ]; then - index=$(( $vnum-1 )) - rosezv[$index]="${line_arr[0]}" - workspaces[$index]="${line_arr[1]}" - volumes[$index]="${line_arr[2]}" - distros[$index]="${line_arr[3]}" - image_names[$index]="${line_arr[4]}" - executable_folder_names[$index]="${line_arr[5]}" - dockerfiles[$index]="${line_arr[6]}" - fi - vnum=$(( $vnum+1 )) - done <<< $line - done < $supported_versions_file + helper_script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) + supported_versions_file=$helper_script_dir/supported_versions.txt + vnum=0 + while read -r line; do + while IFS=',' read -ra line_arr; do + if [ $vnum -gt 0 ]; then + index=$(($vnum - 1)) + rosezv[$index]="${line_arr[0]}" + workspaces[$index]="${line_arr[1]}" + volumes[$index]="${line_arr[2]}" + distros[$index]="${line_arr[3]}" + image_names[$index]="${line_arr[4]}" + executable_folder_names[$index]="${line_arr[5]}" + dockerfiles[$index]="${line_arr[6]}" + fi + vnum=$(($vnum + 1)) + done <<<$line + done <$supported_versions_file } # This function is used to trap signals function signal_handler() { - echo -e "${colour_red}Execution was aborted, deleting my lock_file ($lock_file)$colour_end" - rm -f $lockation/$lock_file - exit + echo -e "${colour_red}Execution was aborted, deleting my lock files ($read_lock_file and $exec_lock_file)$colour_end" + rm -f $lockation/$read_lock_file + rm -f $lockation/$exec_lock_file + exit } # This function is used to check intermediate commands' @@ -75,8 +78,8 @@ function signal_handler() { # This is a required behaviour, in order # to enter the shell (not exit) when a build fails. function intermediate_error_handler() { - if [ $1 -gt 0 ]; then - echo -e "${colour_red}Intermediate process aborted!$colour_end" - signal_handler - fi + if [ $1 -gt 0 ]; then + echo -e "${colour_red}Intermediate process aborted!$colour_end" + signal_handler + fi } diff --git a/internal/rosez_exec.bash b/internal/rosez_exec.bash index 6990a3d..ef577a5 100755 --- a/internal/rosez_exec.bash +++ b/internal/rosez_exec.bash @@ -1,5 +1,5 @@ #!/bin/bash -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) cwd=$(pwd) cd $cwd source $SCRIPT_DIR/helpers.bash @@ -8,8 +8,11 @@ uptime_date="$(uptime -s | sed "s/[: ]/_/g")" # Using uptime_date I can see if a lock file is older # than the current uptime and thus safely delete it. # This should enable the "a reboot should fix it" behaviour -earliest_possible_lock_file="$lock_prefix$uptime_date$lock_suffix" -lock_file="$lock_prefix$now$lock_suffix" +earliest_possible_read_lock_file="$read_lock_prefix$uptime_date$read_lock_suffix" +earliest_possible_exec_lock_file="$exec_lock_prefix$uptime_date$exec_lock_suffix" +read_lock_file="$read_lock_prefix$now$read_lock_suffix" +exec_lock_file="$exec_lock_prefix$now$exec_lock_suffix" +# TODO: investigate all parameters and how they are affected with exec VS run rosws_file="ros2_ws.txt" rosez_vol="ros2ez-volume" ros="humble" @@ -20,143 +23,168 @@ clear_locks=0 skip_compilation=0 non_interactive=0 no_sound=0 +kill_container=0 lockdir="" userid=$(id -u) if [ "$1" == "1" ]; then - rosws_file="ros_ws.txt" - rosez_vol="rosez-volume" - ros="noetic" - ros_image="ros_ez" + rosws_file="ros_ws.txt" + rosez_vol="rosez-volume" + ros="noetic" + ros_image="ros_ez" elif [ "$1" == "3" ]; then - rosws_file="rosm_ws.txt" - rosez_vol="rosezm-volume" - ros="melodic" - ros_image="ros_ezm" + rosws_file="rosm_ws.txt" + rosez_vol="rosezm-volume" + ros="melodic" + ros_image="ros_ezm" elif [ "$1" == "4" ]; then - rosws_file="ros2f_ws.txt" - rosez_vol="ros2ezf-volume" - ros="foxy" - ros_image="ros2_ezf" + rosws_file="ros2f_ws.txt" + rosez_vol="ros2ezf-volume" + ros="foxy" + ros_image="ros2_ezf" fi shift trap 'signal_handler' $signal_list volumes="" lockation="" -while read -r line -do - wsdir=$(eval echo -e "$line") - if [ ! -d "$wsdir" ]; then - echo "$wsdir not found, creating it" - mkdir -p $wsdir/src - fi - volumes=$volumes"--volume $wsdir:/opt/ros/$(basename $wsdir) " - if [[ -z "$lockation" ]]; then - lockation=$wsdir - fi -done < $SCRIPT_DIR/../includes/$rosws_file +while read -r line; do + wsdir=$(eval echo -e "$line") + if [ ! -d "$wsdir" ]; then + echo "$wsdir not found, creating it" + mkdir -p $wsdir/src + fi + volumes=$volumes"--volume $wsdir:/opt/ros/$(basename $wsdir) " + if [[ -z "$lockation" ]]; then + lockation=$wsdir + fi +done <$SCRIPT_DIR/../includes/$rosws_file # I am not using the index here, # but I make sure that I cycle through # the (at most) first i parameters # to catch all the flags for i in "${!known_params[@]}"; do - if [ "${known_params[0]}" == "$1" ] || [ "${known_params_short[0]}" == "$1" ]; then - gpu_param="--device /dev/dri/card0" - shift - elif [ "${known_params[1]}" == "$1" ] || [ "${known_params_short[1]}" == "$1" ]; then - clear_locks=1 - shift - elif [ "${known_params[2]}" == "$1" ] || [ "${known_params_short[2]}" == "$1" ]; then - skip_compilation=1 - shift - elif [ "${known_params[3]}" == "$1" ] || [ "${known_params_short[3]}" == "$1" ]; then - non_interactive=1 - shift - elif [ "${known_params[4]}" == "$1" ] || [ "${known_params_short[4]}" == "$1" ]; then - no_sound=1 - shift - else - break - fi + if [ "${known_params[0]}" == "$1" ] || [ "${known_params_short[0]}" == "$1" ]; then + gpu_param="--device /dev/dri/card0" + shift + elif [ "${known_params[1]}" == "$1" ] || [ "${known_params_short[1]}" == "$1" ]; then + clear_locks=1 + shift + elif [ "${known_params[2]}" == "$1" ] || [ "${known_params_short[2]}" == "$1" ]; then + skip_compilation=1 + shift + elif [ "${known_params[3]}" == "$1" ] || [ "${known_params_short[3]}" == "$1" ]; then + non_interactive=1 + shift + elif [ "${known_params[4]}" == "$1" ] || [ "${known_params_short[4]}" == "$1" ]; then + no_sound=1 + shift + elif [ "${known_params[5]}" == "$1" ] || [ "${known_params_short[5]}" == "$1" ]; then + kill_container=1 + shift + else + break + fi done if [ -z "$gpu_param" ]; then - if grep -q "nvidia" <<< "$gpu_string" || grep -q "Nvidia" <<< "$gpu_string" || grep -q "NVIDIA" <<< "$gpu_string" - then - gpu_param="--gpus all" - elif grep -q "intel" <<< "$gpu_string" || grep -q "Intel" <<< "$gpu_string" || grep -q "INTEL" <<< "$gpu_string" - then - gpu_param="--device /dev/dri/card0" - else - echo "No Nvidia or Intel GPU found. This case has not been investigated yet. GUI integration might be broken. (Good luck!)" - fi + if grep -q "nvidia" <<<"$gpu_string" || grep -q "Nvidia" <<<"$gpu_string" || grep -q "NVIDIA" <<<"$gpu_string"; then + gpu_param="--gpus all" + elif grep -q "intel" <<<"$gpu_string" || grep -q "Intel" <<<"$gpu_string" || grep -q "INTEL" <<<"$gpu_string"; then + gpu_param="--device /dev/dri/card0" + else + echo "No Nvidia or Intel GPU found. This case has not been investigated yet. GUI integration might be broken. (Good luck!)" + fi fi if [ $clear_locks -gt 0 ]; then - echo -e "${colour_orange}I was passed the clear-locks flag. Deleting all lock files...$colour_end" - rm -f $lockation/$lock_prefix*$lock_suffix + echo -e "${colour_orange}I was passed the clear-locks flag. Deleting all lock files...$colour_end" + rm -f $lockation/$read_lock_prefix*$read_lock_suffix +fi +if [ $kill_container -gt 0 ]; then + echo -e "${colour_orange}I was passed the kill-container flag. Killing (and deleting) my container ($ros_image)...$colour_end" + docker rm -f $ros_image >/dev/null 2>&1 fi echo $gpu_param -touch $lockation/$lock_file +touch $lockation/$read_lock_file locked=1 while [ $locked -gt 0 ]; do - found_lock="$(find $lockation -maxdepth 1 -name "$lock_prefix*$lock_suffix" -print | sort | head -1)" - # The found_lock should be empty only - # in the (rare?) case of enabling the - # clear-locks (cl) flag from another rosez process - # --- - # A new lock_file is created, since the other rosez - # process will instantly get priority with the cl flag. - echo $found_lock - if [[ -z "$found_lock" ]]; then - now="$(date +'%Y-%m-%d_%H_%M_%S_%N')" - lock_file="$lock_prefix$now$lock_suffix" - touch $lockation/$lock_file - found_lock=$lockation/$lock_file - fi - fl="$(basename $found_lock)" - echo -e "${colour_blue}Processing: $fl$colour_end" - if [ "$fl" \< "$earliest_possible_lock_file" ]; then - echo -e "${colour_orange}Found problematic lock file ($fl)! Deleting it... (Lock file older than uptime)$colour_end" - sudo rm $found_lock - elif [ "$fl" \< "$lock_file" ]; then - echo -e "${colour_orange}Found earlier lock file ($fl) than my own ($lock_file)!\nWaiting...$colour_end" - sleep 3 - elif [ "$fl" == "$lock_file" ]; then - echo -e "${colour_green}My lock file ($lock_file) is the earliest found. Continuing...$colour_end" - locked=0 - fi + found_lock="$(find $lockation -maxdepth 1 -name "$read_lock_prefix*$read_lock_suffix" -print | sort | head -1)" + # The found_lock should be empty only + # in the (rare?) case of enabling the + # clear-locks (cl) flag from another rosez process + # --- + # A new lock_file is created, since the other rosez + # process will instantly get priority with the cl flag. + echo $found_lock + if [[ -z "$found_lock" ]]; then + now="$(date +'%Y-%m-%d_%H_%M_%S_%N')" + read_lock_file="$read_lock_prefix$now$read_lock_suffix" + touch $lockation/$read_lock_file + found_lock=$lockation/$read_lock_file + fi + fl="$(basename $found_lock)" + echo -e "${colour_blue}Processing: $fl$colour_end" + if [[ "$fl" < "$earliest_possible_read_lock_file" ]]; then + echo -e "${colour_orange}Found problematic lock file ($fl)! Deleting it... (Lock file older than uptime)$colour_end" + rm $found_lock + elif [ "$fl" \< "$read_lock_file" ]; then + echo -e "${colour_orange}Found earlier lock file ($fl) than my own ($read_lock_file)!\nWaiting...$colour_end" + sleep 3 + elif [ "$fl" == "$read_lock_file" ]; then + echo -e "${colour_green}My lock file ($read_lock_file) is the earliest found. Continuing...$colour_end" + locked=0 + fi done bloom_file=/home/$USER/.config/bloom gitconfig_file=/home/$USER/.gitconfig ssh_folder=/home/$USER/.ssh -if [ ! -f $bloom_file ]; then - touch $bloom_file +if [ ! -f $bloom_file ]; then + touch $bloom_file fi -if [ ! -f $gitconfig_file ]; then - touch $gitconfig_file +if [ ! -f $gitconfig_file ]; then + touch $gitconfig_file fi -if [ ! -d $ssh_folder ]; then - mkdir $ssh_folder +if [ ! -d $ssh_folder ]; then + mkdir $ssh_folder fi intermediate_error_handler $? sound="-v /run/user/$userid/pulse:/run/user/$userid/pulse --device /dev/snd -e PULSE_SERVER=unix:/run/user/$userid/pulse/native -v /run/user/$userid/pulse/native:/run/user/$userid/pulse/native" if [ $no_sound -gt 0 ]; then - sound="" + sound="" fi it="-it" if [ $non_interactive -gt 0 ]; then - it="" + it="" fi xauthf="/tmp/.$ros_image-$now.xauth" touch $xauthf intermediate_error_handler $? /bin/bash -c "xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $xauthf nmerge -" intermediate_error_handler $? -x="docker run --ulimit nofile=1024:524288 --rm $it -u $userid --ipc=host --privileged --network host $gpu_param $sound --group-add dialout --group-add video --group-add audio -v $rosez_vol-bin:/bin -v $rosez_vol-etc:/etc/ -v $rosez_vol-home:/home/ -v $rosez_vol-lib:/lib/ -v $rosez_vol-lib64:/lib64/ -v /mnt:/mnt -v $rosez_vol-opt:/opt/ -v $rosez_vol-root:/root/ -v /run:/run -v $rosez_vol-sbin:/sbin/ -v $rosez_vol-srv:/srv/ -v $rosez_vol-usr:/usr -v $rosez_vol-var:/var -v $rosez_vol:/opt/ros/$ros -v $SCRIPT_DIR/../includes/$rosws_file:/opt/ros/$rosws_file $volumes -v $SCRIPT_DIR/entrypoint.bash:/home/rosez_user/.bashrc -v /sys:/sys -v /dev:/dev -v $bloom_file:/home/rosez_user/.config/bloom -v $gitconfig_file:/home/rosez_user/.gitconfig -v $ssh_folder:/home/rosez_user/.ssh -v $SCRIPT_DIR/supported_versions.txt:/home/rosez_user/supported_versions.txt -v $SCRIPT_DIR/helpers.bash:/home/rosez_user/helpers.bash -v /:$HOME/.$rosez_vol -e DISPLAY -e TERM -e QT_X11_NO_MITSHM=1 -e XAUTHORITY=$xauthf -v $xauthf:$xauthf -v /tmp/.X11-unix:/tmp/.X11-unix -v /etc/localtime:/etc/localtime:ro $ros_image:latest" +container_id=$(docker ps -q --filter "name=$ros_image") +found_lock="$(find $lockation -maxdepth 1 -name "$exec_lock_prefix*$exec_lock_suffix" -print | sort | head -1)" +fl="$(basename "$found_lock")" +if [[ -z "$container_id" || "$fl" < "$earliest_possible_exec_lock_file" ]]; then + docker rm -f $ros_image >/dev/null 2>&1 + intermediate_error_handler $? + x="docker run --name $ros_image --ulimit nofile=1024:524288 -d -u $userid --ipc=host --privileged --network host $gpu_param $sound --group-add dialout --group-add video --group-add audio -v $rosez_vol-bin:/bin -v $rosez_vol-etc:/etc/ -v $rosez_vol-home:/home/ -v $rosez_vol-lib:/lib/ -v $rosez_vol-lib64:/lib64/ -v /mnt:/mnt -v $rosez_vol-opt:/opt/ -v $rosez_vol-root:/root/ -v /run:/run -v $rosez_vol-sbin:/sbin/ -v $rosez_vol-srv:/srv/ -v $rosez_vol-usr:/usr -v $rosez_vol-var:/var -v $rosez_vol:/opt/ros/$ros -v $SCRIPT_DIR/../includes/$rosws_file:/opt/ros/$rosws_file $volumes -v $SCRIPT_DIR/entrypoint.bash:/home/rosez_user/.bashrc -v /sys:/sys -v /dev:/dev -v $bloom_file:/home/rosez_user/.config/bloom -v $gitconfig_file:/home/rosez_user/.gitconfig -v $ssh_folder:/home/rosez_user/.ssh -v $SCRIPT_DIR/supported_versions.txt:/home/rosez_user/supported_versions.txt -v $SCRIPT_DIR/helpers.bash:/home/rosez_user/helpers.bash -v /:$HOME/.$rosez_vol -e DISPLAY -e TERM -e QT_X11_NO_MITSHM=1 -e XAUTHORITY=$xauthf -v $xauthf:$xauthf -v /tmp/.X11-unix:/tmp/.X11-unix -v /etc/localtime:/etc/localtime:ro $ros_image:latest tail -f /dev/null" + intermediate_error_handler $? + echo -e "${colour_blue}$ros_image daemon not found.${colour_end}\nExecuting:\n---\n$x\n---" + eval "$x" + container_id=$(docker ps -q --filter "name=$ros_image") + intermediate_error_handler $? +fi +x="docker exec $it $container_id" intermediate_error_handler $? -extras="env $ENV LOCKFILE=$lock_file SKIPCOMPILATION=$skip_compilation /bin/bash" +extras="env $ENV LOCKFILE=$read_lock_file SKIPCOMPILATION=$skip_compilation /bin/bash" if [ $# -gt 0 ]; then - extras=$extras" -c \"source /home/rosez_user/.bashrc && $* \"" + extras=$extras" -c \"source /home/rosez_user/.bashrc && $* \"" fi x="$x $extras" intermediate_error_handler $? -printf "Executing:\n---\n$x\n---\n" +touch $lockation/$exec_lock_file +echo -e "Executing:\n---\n$x\n---" eval "$x" +rm -f $lockation/$exec_lock_file +found_lock="$(find $lockation -maxdepth 1 -name "$exec_lock_prefix*$exec_lock_suffix" -print | sort | head -1)" +if [[ -z "$found_lock" ]]; then + echo -e "\n${colour_blue}This shell was the last one using the $ros_image container. Removing it${colour_end}" + docker rm -f $ros_image >/dev/null 2>&1 +fi From d4371243b5b811cb692eb55aad380038de4f99cd Mon Sep 17 00:00:00 2001 From: George Stavrinos Date: Thu, 31 Oct 2024 17:12:23 +0200 Subject: [PATCH 3/4] Fixed the long build output error" -m "By not saving it in a variable (which was not used anyway) --- internal/entrypoint.bash | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/entrypoint.bash b/internal/entrypoint.bash index a00a86c..c7a8de5 100644 --- a/internal/entrypoint.bash +++ b/internal/entrypoint.bash @@ -33,23 +33,23 @@ if [ "$rosversion" != "unknown" ]; then if [ $skip_compilation -ne 1 ]; then if rosdep check -ir --from-path src --rosdistro $rosversion -y | grep -q 'System dependencies have not been satisfied'; then intermediate_error_handler $? - output=$(script --flush --quiet --return /tmp/ansible-output.txt --command "sudo apt update" | tee /dev/fd/2) + script --flush --quiet --return /tmp/rosez-build-output.txt --command "sudo apt update" | tee /dev/fd/2 intermediate_error_handler $? fi - output=$(script --flush --quiet --return /tmp/ansible-output.txt --command "rosdep install -ir --from-path src --rosdistro $rosversion -y" | tee /dev/fd/2) + script --flush --quiet --return /tmp/rosez-build-output.txt --command "rosdep install -ir --from-path src --rosdistro $rosversion -y" | tee /dev/fd/2 intermediate_error_handler $? fi if [ "$rosversion" == "humble" ] || [ "$rosversion" == "foxy" ]; then if [ $skip_compilation -ne 1 ]; then - output=$(script --flush --quiet --return /tmp/ansible-output.txt --command "colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo" | tee /dev/fd/2) + script --flush --quiet --return /tmp/rosez-build-output.txt --command "colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo" | tee /dev/fd/2 intermediate_error_handler $? fi . /opt/ros/$bl/install/setup.bash intermediate_error_handler $? else if [ $skip_compilation -ne 1 ]; then - output=$(script --flush --quiet --return /tmp/ansible-output.txt --command "catkin_make" | tee /dev/fd/2) + script --flush --quiet --return /tmp/rosez-build-output.txt --command "catkin_make" intermediate_error_handler $? fi . /opt/ros/$bl/devel/setup.bash From 5c0b26c3a176bc914a6907e64c92284b3b84570d Mon Sep 17 00:00:00 2001 From: George Stavrinos Date: Thu, 31 Oct 2024 17:39:54 +0200 Subject: [PATCH 4/4] Added a better description of the changes of the newest version --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1078362..07d3b5e 100644 --- a/README.md +++ b/README.md @@ -66,4 +66,8 @@ TODO - [For versions >= `v2.0.2`] Simplification of the systemd service generation. - [For versions >= `v2.1.0`] First attempt to use (runtime) host folders instead of saving them on volumes (for /mnt, /run, /sys). - [For versions >= `v2.2.0`] Fixed a bug that surfaced on newer kernels running old distros regarding soft and hard nofile (ulimit). -- [For versions >= `v2.3.0`] The `rosez*` containers are now handled in a more optimised way. This is achieved by running the container once and then using exec to access a shell. This should solve (most of?) the conflicts in packages install/not found on different shells. Also introduced a the `kill-container` or `kc` flag to forcefully kill the `rosez*` container. +- [For versions >= `v2.3.0`]: + - The `rosez*` containers are now handled in a more optimised way. This is achieved by running the container once and then using exec to access a shell. This should solve (most of?) the conflicts in packages install/not found on different shells. + - Introduced a the `kill-container` or `kc` flag to forcefully kill the `rosez*` container. + - Now sharing `/media` between host and container. + - Fixed a bug that occured when the output of the build command was too long.