mirror of
https://github.com/aleleba/aleleba-vscode-dockerfile-configuration.git
synced 2025-06-19 04:18:11 -06:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
d9df63f836
|
|||
c9799b9a77
|
|||
de3fda3c09
|
|||
559cd39a66
|
|||
4bbe7f51cb
|
|||
b0b9497107
|
@ -16,7 +16,7 @@ if [[ -v VSCODE_TUNNEL_NAME && -n "${VSCODE_TUNNEL_NAME}" ]]; then
|
||||
fi
|
||||
|
||||
# List all environment variables
|
||||
sudo env |
|
||||
printenv |
|
||||
|
||||
# Filter variables that start with GLOBAL_ENV_
|
||||
grep -E '^GLOBAL_ENV_' |
|
||||
@ -31,17 +31,13 @@ sed 's/^GLOBAL_ENV_//' |
|
||||
while IFS= read -r line
|
||||
do
|
||||
if ! grep -q "^${line%=*}=" /etc/environment; then
|
||||
echo "export $line" | sudo tee -a /etc/environment
|
||||
echo "" >> /etc/environment
|
||||
echo "export $line" >> /etc/environment
|
||||
fi
|
||||
done
|
||||
|
||||
USER="$HOME_USER"
|
||||
if ! id -u $HOME_USER > /dev/null 2>&1; then
|
||||
sudo adduser --disabled-password --gecos "" --uid 1000 ${HOME_USER}
|
||||
sudo echo "$HOME_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null
|
||||
|
||||
# List all environment variables
|
||||
sudo env |
|
||||
printenv |
|
||||
|
||||
# Filter variables that start with USER_ENV_
|
||||
grep -E '^USER_ENV_' |
|
||||
@ -52,9 +48,15 @@ if ! id -u $HOME_USER > /dev/null 2>&1; then
|
||||
# Append the result to /usr/bin/.bashrc
|
||||
while IFS= read -r line
|
||||
do
|
||||
echo "export $line" | sudo -u ${HOME_USER} tee -a /usr/bin/.bashrc
|
||||
echo "" >> /usr/bin/.bashrc
|
||||
echo "export $line" >> /usr/bin/.bashrc
|
||||
done
|
||||
|
||||
USER="$HOME_USER"
|
||||
if ! id -u $HOME_USER > /dev/null 2>&1; then
|
||||
sudo adduser --disabled-password --gecos "" --uid 1000 ${HOME_USER}
|
||||
sudo echo "$HOME_USER ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers.d/nopasswd > /dev/null
|
||||
|
||||
# Creating .vscode folder if it doesn't exist
|
||||
if [ ! -d "/home/${HOME_USER}/.vscode" ]; then
|
||||
sudo mkdir -p /home/${HOME_USER}/.vscode
|
||||
@ -74,7 +76,11 @@ fi
|
||||
# Find .sh files in /usr/bin/custom-scripts and execute them in order
|
||||
for script in $(find /usr/bin/custom-scripts -name "*.sh" | sort); do
|
||||
chmod +x $script
|
||||
if [[ $script == *"sudo"* ]]; then
|
||||
sudo -u $HOME_USER bash -c "source /etc/environment; sudo $script"
|
||||
else
|
||||
sudo -u $HOME_USER bash -c "source /etc/environment; $script"
|
||||
fi
|
||||
done
|
||||
|
||||
# Move the .bashrc file to the user's home directory
|
||||
|
@ -1 +1 @@
|
||||
3.0.21
|
||||
3.0.27
|
Reference in New Issue
Block a user