From 739abfc212643ed7f524774b628f57a9eda29bc8 Mon Sep 17 00:00:00 2001 From: Chengrui Zhu Date: Wed, 11 Dec 2024 16:38:48 +0800 Subject: [PATCH] Fix chown error when "$XDG_RUNTIME_DIR" is empty and some typos (#25) Fix chown error when "$XDG_RUNTIME_DIR" is empty and some typos --- CHANGELOG | 5 +++++ examples/noetic_nvidia_custom.yaml | 4 ++-- pyproject.toml | 2 +- .../dockerfile_assets/entrypoint_setup.sh | 18 +++++++++--------- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 70b5886..44addea 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.0.4] - 2024-12-11 + +### Fixed +- Fixed issue in the `dockerfile_assets/entrypoint_setup.sh` where the `$XDG_RUNTIME_DIR` was not properly escaped causing `chown` errors. + ## [3.0.3] - 2024-09-19 ### Fixed diff --git a/examples/noetic_nvidia_custom.yaml b/examples/noetic_nvidia_custom.yaml index 45bd405..41abbed 100644 --- a/examples/noetic_nvidia_custom.yaml +++ b/examples/noetic_nvidia_custom.yaml @@ -1,9 +1,9 @@ # Select ROS version. # Supported are: # noetic ROS1. Assumes Ubuntu 20.04 -# humble RSO2. Assumes Ubuntu 22.04 +# humble ROS2. Assumes Ubuntu 22.04 # iron ROS2. Assumes Ubuntu 22.04 -# noetic ROS2. Assumes Ubuntu 24.04 +# jazzy ROS2. Assumes Ubuntu 24.04 # # Check also with 'turludock which ros' ros_version: noetic diff --git a/pyproject.toml b/pyproject.toml index d4713c1..4f8e629 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "turludock" -version = "3.0.3" +version = "3.0.4" description = "Builds ROS docker images that support GUI with either X11 or Wayland." authors = [ "Athanasios ", diff --git a/turludock/assets/dockerfile_assets/entrypoint_setup.sh b/turludock/assets/dockerfile_assets/entrypoint_setup.sh index bff4e01..7dbcf1a 100755 --- a/turludock/assets/dockerfile_assets/entrypoint_setup.sh +++ b/turludock/assets/dockerfile_assets/entrypoint_setup.sh @@ -9,7 +9,7 @@ check_envs () { DOCKER_CUSTOM_USER_OK=false; return; fi - + if [ -z ${DOCKER_USER_ID+x} ]; then DOCKER_CUSTOM_USER_OK=false; return; @@ -20,7 +20,7 @@ check_envs () { return; fi fi - + if [ -z ${DOCKER_USER_GROUP_NAME+x} ]; then DOCKER_CUSTOM_USER_OK=false; return; @@ -62,7 +62,7 @@ setup_env_user () { ln -s /home/$USER/.oh-my-zsh/custom/pure/pure.zsh /home/$USER/.oh-my-zsh/custom/ ln -s /home/$USER/.oh-my-zsh/custom/pure/async.zsh /home/$USER/.oh-my-zsh/custom/ sed -i -e 's@ZSH=\"/root@ZSH=\"/home/$USER@g' /home/$USER/.zshrc - + ## Copy SSH keys & fix owner if [ -d "/root/.ssh" ]; then cp -rf /root/.ssh /home/$USER/ @@ -80,7 +80,7 @@ setup_env_user () { echo 'PATH="$HOME/.local/bin:$PATH"' >> /home/$USER/.zshrc fi fi - + ## Fix owner chown $USER_ID:$GROUP_ID /home/$USER chown -R $USER_ID:$GROUP_ID /home/$USER/.config @@ -96,14 +96,14 @@ setup_env_user () { chmod -R 0700 $XDG_RUNTIME_DIR fi - echo "if [ -d "$XDG_RUNTIME_DIR" ]; then" >> /root/.bashrc - echo " chown -R $USER_ID:$GROUP_ID $XDG_RUNTIME_DIR" >> /root/.bashrc + echo "if [ -d \"\$XDG_RUNTIME_DIR\" ]; then" >> /root/.bashrc + echo " chown -R $USER_ID:$GROUP_ID \$XDG_RUNTIME_DIR" >> /root/.bashrc echo "fi" >> /root/.bashrc - echo "if [ -d "$XDG_RUNTIME_DIR" ]; then" >> /root/.zshrc - echo " chown -R $USER_ID:$GROUP_ID $XDG_RUNTIME_DIR" >> /root/.zshrc + echo "if [ -d \"\$XDG_RUNTIME_DIR\" ]; then" >> /root/.zshrc + echo " chown -R $USER_ID:$GROUP_ID \$XDG_RUNTIME_DIR" >> /root/.zshrc echo "fi" >> /root/.zshrc - + ## This a trick to keep the evnironmental variables of root which is important! echo "if ! [ \"$DOCKER_USER_NAME\" = \"$(id -un)\" ]; then" >> /root/.bashrc