Skip to content

Commit

Permalink
Fix chown error when "$XDG_RUNTIME_DIR" is empty and some typos (#25)
Browse files Browse the repository at this point in the history
Fix chown error when "$XDG_RUNTIME_DIR" is empty and some typos
  • Loading branch information
chengruiz authored Dec 11, 2024
1 parent b10634f commit 739abfc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/noetic_nvidia_custom.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <dev@tasoglou.net>",
Expand Down
18 changes: 9 additions & 9 deletions turludock/assets/dockerfile_assets/entrypoint_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -20,7 +20,7 @@ check_envs () {
return;
fi
fi

if [ -z ${DOCKER_USER_GROUP_NAME+x} ]; then
DOCKER_CUSTOM_USER_OK=false;
return;
Expand Down Expand Up @@ -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/
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 739abfc

Please sign in to comment.