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 | |
---|---|---|---|
b08429c9ae
|
|||
7f81f891ab
|
|||
66c96f1fe7
|
|||
1e5523c1f7
|
|||
390f9cdc15
|
|||
f9503fe827
|
|||
c50b9e969f
|
|||
f9b4e4644a
|
|||
01410a3ccd
|
@ -1,14 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
if [[ -z "${HOME_USER}" ]]; then
|
if [[ -z "${HOME_USER-}" ]]; then
|
||||||
HOME_USER="vscode"
|
HOME_USER="vscode"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#addgroup nonroot
|
|
||||||
#adduser --disabled-password --gecos "" ${HOME_USER}
|
|
||||||
#echo "${HOME_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
|
||||||
|
|
||||||
# We do this first to ensure sudo works below when renaming the user.
|
# 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.
|
# Otherwise the current container UID may not exist in the passwd database.
|
||||||
eval "$(fixuid -q)"
|
eval "$(fixuid -q)"
|
||||||
@ -36,22 +32,18 @@ if [ "${HOME_USER-}" ]; then
|
|||||||
env | grep -v 'HOME_USER' | while read -r line; do
|
env | grep -v 'HOME_USER' | while read -r line; do
|
||||||
sudo su - ${HOME_USER} -c "echo 'export $line' >> ~/.bashrc"
|
sudo su - ${HOME_USER} -c "echo 'export $line' >> ~/.bashrc"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Changing the property of the directory /home/${HOME_USER}
|
# Copy the HOME variable from vscode user to HOME_USER
|
||||||
sudo chown -R ${HOME_USER}: /home/${HOME_USER}/
|
sudo su - ${HOME_USER} -c "echo 'export HOME=\"/home/\${HOME_USER}\"' >> ~/.bashrc"
|
||||||
|
|
||||||
|
# Copy the .bashrc file from vscode user to HOME_USER
|
||||||
|
sudo su - ${HOME_USER} -c "cat /home/vscode/.bashrc >> ~/.bashrc"
|
||||||
|
|
||||||
# Changing the HOME_USER in the .bashrc file
|
# Changing the HOME_USER in the .bashrc file
|
||||||
sudo su - ${HOME_USER} -c 'sed -i "s|/home/vscode|/home/${HOME_USER}|g" ~/.bashrc'
|
sudo su - ${HOME_USER} -c 'sudo sed -i "s|/home/vscode|/home/${HOME_USER}|g" ~/.bashrc'
|
||||||
|
|
||||||
sudo -u $HOME_USER -i
|
# Switch to the user specified by $HOME_USER and start an interactive shell session.
|
||||||
# Unfortunately we cannot change $HOME as we cannot move any bind mounts
|
sudo su -l ${HOME_USER}
|
||||||
# nor can we bind mount $HOME into a new home as that requires a privileged container.
|
|
||||||
# sudo usermod --login "$HOME_USER" vscode
|
|
||||||
# sudo groupmod -n "$HOME_USER" vscode
|
|
||||||
|
|
||||||
# sudo sed -i "/vscode/d" /etc/sudoers.d/nopasswd
|
|
||||||
# sudo cd /home/${HOME_USER}
|
|
||||||
sudo chown -R ${HOME_USER}:${HOME_USER} /home/${HOME_USER}
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -97,6 +89,9 @@ else
|
|||||||
echo "File extensions.json not found"
|
echo "File extensions.json not found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Make sure the CLI folder is executable
|
||||||
|
sudo chmod -R a+rwX /home/${HOME_USER}/.vscode/cli
|
||||||
|
|
||||||
if [[ -z "${VSCODE_TUNNEL_NAME}" ]]; then
|
if [[ -z "${VSCODE_TUNNEL_NAME}" ]]; then
|
||||||
sudo su - ${HOME_USER} -c "code tunnel --accept-server-license-terms"
|
sudo su - ${HOME_USER} -c "code tunnel --accept-server-license-terms"
|
||||||
else
|
else
|
||||||
|
@ -1 +1 @@
|
|||||||
2.0.32
|
2.0.42
|
Reference in New Issue
Block a user