Compare commits

..

9 Commits

2 changed files with 23 additions and 4 deletions

View File

@ -1,6 +1,13 @@
#!/bin/bash #!/bin/bash
set -eu 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
exit 0
fi
if [[ -z "${HOME_USER-}" ]]; then if [[ -z "${HOME_USER-}" ]]; then
HOME_USER="vscode" HOME_USER="vscode"
fi fi
@ -33,9 +40,6 @@ if [ "${HOME_USER-}" ]; then
sudo su - ${HOME_USER} -c "echo 'export $line' >> ~/.bashrc" sudo su - ${HOME_USER} -c "echo 'export $line' >> ~/.bashrc"
done done
# Copy the HOME variable from vscode user to HOME_USER
sudo su - ${HOME_USER} -c "echo 'export HOME=\"/home/\${HOME_USER}\"' >> ~/.bashrc"
# Copy the .bashrc file from vscode user to HOME_USER # Copy the .bashrc file from vscode user to HOME_USER
sudo su - ${HOME_USER} -c "cat /home/vscode/.bashrc >> ~/.bashrc" sudo su - ${HOME_USER} -c "cat /home/vscode/.bashrc >> ~/.bashrc"
@ -52,6 +56,21 @@ if [ "${HOME_USER-}" ]; then
# Switch to the user specified by $HOME_USER and start an interactive shell session. # Switch to the user specified by $HOME_USER and start an interactive shell session.
sudo su -l ${HOME_USER} sudo su -l ${HOME_USER}
# Copy the HOME variable from vscode user to HOME_USER
sudo su -l ${HOME_USER} -c "echo \"export HOME=/home/${HOME_USER}\" >> ~/.bashrc"
# Source the .bashrc file to apply the changes immediately
sudo su -l ${HOME_USER} -c "source ~/.bashrc"
# Delete the vscode user
if id "vscode" &>/dev/null; then
sudo chown -R vscode:vscode /home/vscode
sudo userdel -r vscode
fi
else
# Switch to the user specified by $HOME_USER and start an interactive shell session.
sudo su -l ${HOME_USER}
fi fi
fi fi

View File

@ -1 +1 @@
2.0.46 2.0.55