2020-09-04 00:38:40 +02:00
|
|
|
#!/bin/sh
|
2020-08-25 21:38:12 +02:00
|
|
|
set -eu
|
|
|
|
|
2020-10-12 10:26:23 +02:00
|
|
|
if [ "${DOCKER_USER-}" ] && [ "$DOCKER_USER" != "$USER" ]; then
|
2020-08-25 21:38:12 +02:00
|
|
|
echo "$DOCKER_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null
|
2020-09-04 00:38:40 +02:00
|
|
|
# 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
|
2020-08-25 21:38:12 +02:00
|
|
|
sudo groupmod -n "$DOCKER_USER" coder
|
|
|
|
|
2020-09-09 06:07:04 +02:00
|
|
|
USER="$DOCKER_USER"
|
2020-09-04 00:38:40 +02:00
|
|
|
|
2020-08-25 21:38:12 +02:00
|
|
|
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 "$@"
|