devcontainer: fix display override (#30041)

* Fix display override on mac

* Add newline
old-commit-hash: 2fc307cc87
test-msgs
Kacper Rączy 2 years ago committed by GitHub
parent 48e2871d42
commit 067d643e75
  1. 8
      .devcontainer/container_post_create.sh

@ -1,11 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
TARGET_USER=batman
source .devcontainer/.host/.env source .devcontainer/.host/.env
# override display flag for mac # override display flag for mac
if [[ $HOST_OS == darwin ]]; then if [[ $HOST_OS == darwin ]]; then
echo "Setting up DISPLAY override for macOS..." echo "Setting up DISPLAY override for macOS..."
cat <<EOF >> /root/.bashrc cat <<EOF >> /home/$TARGET_USER/.bashrc
if [ -n "\$DISPLAY" ]; then if [ -n "\$DISPLAY" ]; then
DISPLAY_NUM=\$(echo "\$DISPLAY" | awk -F: '{print \$NF}') DISPLAY_NUM=\$(echo "\$DISPLAY" | awk -F: '{print \$NF}')
export DISPLAY=host.docker.internal:\$DISPLAY_NUM export DISPLAY=host.docker.internal:\$DISPLAY_NUM
@ -15,6 +16,5 @@ fi
# These lines are temporary, to remain backwards compatible with old devcontainers # These lines are temporary, to remain backwards compatible with old devcontainers
# that were running as root and therefore had their caches written as root # that were running as root and therefore had their caches written as root
USER=batman sudo chown -R $TARGET_USER: /tmp/scons_cache
sudo chown -R $USER: /tmp/scons_cache sudo chown -R $TARGET_USER: /tmp/comma_download_cache
sudo chown -R $USER: /tmp/comma_download_cache

Loading…
Cancel
Save