mirror of
https://github.com/aleleba/aleleba-vscode-dockerfile-configuration.git
synced 2025-06-18 20:08:13 -06:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
6519cc3ef9
|
|||
c27e148488
|
|||
cd8b5c19e1
|
|||
a6e4296f25
|
|||
08cf40624d
|
|||
a3b5fe1d6d
|
|||
99812ff71c
|
|||
d8a8162ffd
|
|||
32d405aa80
|
@ -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
|
||||
@ -55,6 +61,15 @@ if [ "${HOME_USER-}" ]; then
|
||||
|
||||
# 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
|
||||
|
||||
|
@ -1 +1 @@
|
||||
2.0.47
|
||||
2.0.56
|
Reference in New Issue
Block a user