From 2fc307cc878ca7b34fdd363cbe511bfa3aa1a96b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20R=C4=85czy?= Date: Mon, 25 Sep 2023 13:56:23 -0700 Subject: [PATCH] devcontainer: fix display override (#30041) * Fix display override on mac * Add newline --- .devcontainer/container_post_create.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.devcontainer/container_post_create.sh b/.devcontainer/container_post_create.sh index 4446eff8bc..639b6efc09 100755 --- a/.devcontainer/container_post_create.sh +++ b/.devcontainer/container_post_create.sh @@ -1,11 +1,12 @@ #!/usr/bin/env bash +TARGET_USER=batman source .devcontainer/.host/.env # override display flag for mac if [[ $HOST_OS == darwin ]]; then echo "Setting up DISPLAY override for macOS..." - cat <> /root/.bashrc + cat <> /home/$TARGET_USER/.bashrc if [ -n "\$DISPLAY" ]; then DISPLAY_NUM=\$(echo "\$DISPLAY" | awk -F: '{print \$NF}') export DISPLAY=host.docker.internal:\$DISPLAY_NUM @@ -15,6 +16,5 @@ fi # These lines are temporary, to remain backwards compatible with old devcontainers # that were running as root and therefore had their caches written as root -USER=batman -sudo chown -R $USER: /tmp/scons_cache -sudo chown -R $USER: /tmp/comma_download_cache \ No newline at end of file +sudo chown -R $TARGET_USER: /tmp/scons_cache +sudo chown -R $TARGET_USER: /tmp/comma_download_cache