mirror of
https://github.com/danog/code-server.git
synced 2024-12-15 02:37:27 +01:00
9fb318cf15
We do not try renaming $HOME anymore as there is no good way to do it. We also only try to convert if the user hasn't been changed. Finally I added usage to the docker docs in install.md Closes #2056
21 lines
647 B
Bash
Executable File
21 lines
647 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
# This isn't set by default.
|
|
export USER="$(whoami)"
|
|
|
|
if [ "${DOCKER_USER-}" != "$USER" ]; then
|
|
echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null
|
|
# Unfortunately we cannot change $HOME as we cannot move any bind mounts
|
|
# nor can we bind mount $HOME into a new home as that requires a privileged container.
|
|
sudo usermod --login "$DOCKER_USER" coder
|
|
sudo groupmod -n "$DOCKER_USER" coder
|
|
|
|
export USER="$(whoami)"
|
|
|
|
sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd
|
|
sudo sed -i "s/coder/$DOCKER_USER/g" /etc/fixuid/config.yml
|
|
fi
|
|
|
|
dumb-init fixuid -q /usr/bin/code-server "$@"
|