Compare commits

...

2 Commits

2 changed files with 9 additions and 5 deletions

View File

@ -1,6 +1,12 @@
#!/bin/bash
set -eu
# Check if we are root
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exec sudo /usr/bin/entrypoint.sh
fi
if [[ -z "${HOME_USER-}" ]]; then
HOME_USER="vscode"
fi
@ -11,7 +17,7 @@ eval "$(fixuid -q)"
if [ "${HOME_USER-}" ]; then
USER="$HOME_USER"
if [ "$HOME_USER" != "$(whoami)" ]; then
if [[ "${HOME_USER-}" == "vscode" ]]; then
if ! id -u $HOME_USER > /dev/null 2>&1; then
sudo adduser --disabled-password --gecos "" ${HOME_USER}
sudo echo "$HOME_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null
@ -59,9 +65,7 @@ if [ "${HOME_USER-}" ]; then
# Delete the vscode user
if id "vscode" &>/dev/null; then
sudo chown -R vscode:vscode /home/vscode
sudo pkill -u vscode
sleep 2 # wait for processes to terminate
sudo -u root bash -c 'userdel -r vscode'
sudo userdel -r vscode
fi
else
# Switch to the user specified by $HOME_USER and start an interactive shell session.

View File

@ -1 +1 @@
2.0.54
2.0.56