code-server/ci/release-image/entrypoint.sh
dependabot[bot] 9042bbae9a
chore(deps-dev): bump prettier-plugin-sh from 0.6.1 to 0.7.1 (#3680)
* chore(deps-dev): bump prettier-plugin-sh from 0.6.1 to 0.7.1

Bumps [prettier-plugin-sh](https://github.com/rx-ts/prettier) from 0.6.1 to 0.7.1.
- [Release notes](https://github.com/rx-ts/prettier/releases)
- [Changelog](https://github.com/rx-ts/prettier/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rx-ts/prettier/compare/prettier-plugin-sh@0.6.1...prettier-plugin-sh@0.7.1)

---
updated-dependencies:
- dependency-name: prettier-plugin-sh
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: reformat shell scripts

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Akash Satheesan <akash.satheesan@protonmail.com>
2021-06-28 22:06:55 +05:30

22 lines
734 B
Bash
Executable File

#!/bin/sh
set -eu
# We do this first to ensure sudo works below when renaming the user.
# Otherwise the current container UID may not exist in the passwd database.
eval "$(fixuid -q)"
if [ "${DOCKER_USER-}" ]; then
USER="$DOCKER_USER"
if [ "$DOCKER_USER" != "$(whoami)" ]; 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
sudo sed -i "/coder/d" /etc/sudoers.d/nopasswd
fi
fi
dumb-init /usr/bin/code-server "$@"