Resolve issue around modified UID/GID non-root users
This commit is contained in:
Родитель
ef5234c25a
Коммит
2b98c5148a
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -21,6 +21,11 @@ if [ "$(id -u)" -ne 0 ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Switch to bash right away
|
||||
if [ "${SWITCHED_TO_BASH}" != "true" ]; then
|
||||
apk add bash
|
||||
|
@ -29,11 +34,6 @@ if [ "${SWITCHED_TO_BASH}" != "true" ]; then
|
|||
exit $?
|
||||
fi
|
||||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
|
||||
USERNAME=""
|
||||
|
@ -163,7 +163,7 @@ EOF
|
|||
|
||||
# code shim, it fallbacks to code-insiders if code is not available
|
||||
cat << 'EOF' > /usr/local/bin/code
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
get_in_path_except_current() {
|
||||
which -a "$1" | grep -v "$0" | head -1
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -135,7 +135,14 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
|
|||
fi
|
||||
|
||||
# Add GOPATH variable and bin directory into PATH in bashrc/zshrc files (unless disabled)
|
||||
updaterc "export GOPATH=\"${TARGET_GOPATH}\"\nexport GOROOT=\"${TARGET_GOROOT}\"\nexport PATH=\"\${GOROOT}/bin:\${GOPATH}/bin:\${PATH}\""
|
||||
updaterc "$(cat << EOF
|
||||
export GOPATH="${TARGET_GOPATH}"
|
||||
if [[ "\${PATH}" != *"\${GOPATH}/bin"* ]]; then export PATH="\${PATH}:\${GOPATH}/bin"; fi
|
||||
export GOROOT="${TARGET_GOROOT}"
|
||||
if [[ "\${PATH}" != *"\${GOROOT}/bin"* ]]; then export PATH="\${PATH}:\${GOROOT}/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
||||
echo "Done!"
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -66,14 +66,22 @@ fi
|
|||
|
||||
# Install sdkman if not installed
|
||||
if [ ! -d "${SDKMAN_DIR}" ]; then
|
||||
# Create sdkman group, dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^sdkman:" > /dev/null 2>&1; then
|
||||
groupadd -r sdkman
|
||||
fi
|
||||
usermod -a -G sdkman ${USERNAME}
|
||||
umask 0002
|
||||
# Install SDKMAN
|
||||
curl -sSL "https://get.sdkman.io?rcupdate=false" | bash
|
||||
chown -R "${USERNAME}" "${SDKMAN_DIR}"
|
||||
chown -R :sdkman ${SDKMAN_DIR}
|
||||
find ${SDKMAN_DIR} -type d | xargs -d '\n' chmod g+s
|
||||
# Add sourcing of sdkman into bashrc/zshrc files (unless disabled)
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\nsource \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\n. \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
fi
|
||||
|
||||
# Install gradle
|
||||
su ${USERNAME} -c ". ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install gradle ${GRADLE_VERSION} && sdk flush archives && sdk flush temp"
|
||||
su ${USERNAME} -c "umask 0002 && . ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install gradle ${GRADLE_VERSION} && sdk flush archives && sdk flush temp"
|
||||
updaterc "export GRADLE_USER_HOME=\${HOME}/.gradle"
|
||||
|
||||
echo "Done!"
|
||||
|
|
|
@ -27,7 +27,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -66,14 +66,22 @@ fi
|
|||
|
||||
# Install sdkman if not installed
|
||||
if [ ! -d "${SDKMAN_DIR}" ]; then
|
||||
# Create sdkman group, dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^sdkman:" > /dev/null 2>&1; then
|
||||
groupadd -r sdkman
|
||||
fi
|
||||
usermod -a -G sdkman ${USERNAME}
|
||||
umask 0002
|
||||
# Install SDKMAN
|
||||
curl -sSL "https://get.sdkman.io?rcupdate=false" | bash
|
||||
chown -R "${USERNAME}" "${SDKMAN_DIR}"
|
||||
chown -R :sdkman ${SDKMAN_DIR}
|
||||
find ${SDKMAN_DIR} -type d | xargs -d '\n' chmod g+s
|
||||
# Add sourcing of sdkman into bashrc/zshrc files (unless disabled)
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\nsource \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\n. \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
fi
|
||||
|
||||
if [ "${JAVA_VERSION}" != "none" ]; then
|
||||
su ${USERNAME} -c ". ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install java ${JAVA_VERSION} && sdk flush archives && sdk flush temp"
|
||||
su ${USERNAME} -c "umask 0002 && . ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install java ${JAVA_VERSION} && sdk flush archives && sdk flush temp"
|
||||
fi
|
||||
|
||||
echo "Done!"
|
|
@ -27,7 +27,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -66,14 +66,22 @@ fi
|
|||
|
||||
# Install sdkman if not installed
|
||||
if [ ! -d "${SDKMAN_DIR}" ]; then
|
||||
# Create sdkman group, dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^sdkman:" > /dev/null 2>&1; then
|
||||
groupadd -r sdkman
|
||||
fi
|
||||
usermod -a -G sdkman ${USERNAME}
|
||||
umask 0002
|
||||
# Install SDKMAN
|
||||
curl -sSL "https://get.sdkman.io?rcupdate=false" | bash
|
||||
chown -R "${USERNAME}" "${SDKMAN_DIR}"
|
||||
chown -R :sdkman ${SDKMAN_DIR}
|
||||
find ${SDKMAN_DIR} -type d | xargs -d '\n' chmod g+s
|
||||
# Add sourcing of sdkman into bashrc/zshrc files (unless disabled)
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\nsource \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\n. \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
fi
|
||||
|
||||
# Install Maven
|
||||
su ${USERNAME} -c ". ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install maven ${MAVEN_VERSION} && sdk flush archives && sdk flush temp"
|
||||
su ${USERNAME} -c "umask 0002 && . ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install maven ${MAVEN_VERSION} && sdk flush archives && sdk flush temp"
|
||||
updaterc "export M2=\$HOME/.m2"
|
||||
|
||||
echo "Done!"
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -118,22 +118,28 @@ export PATH=${PYTHON_INSTALL_PATH}/bin:${PIPX_BIN_DIR}:${PATH}
|
|||
echo "Updating pip..."
|
||||
python3 -m pip install --no-cache-dir --upgrade pip
|
||||
|
||||
# Install tools
|
||||
# Create pipx group, dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^pipx:" > /dev/null 2>&1; then
|
||||
groupadd -r pipx
|
||||
fi
|
||||
usermod -a -G pipx ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${PIPX_BIN_DIR}
|
||||
chown -R ${USERNAME} ${PIPX_HOME} ${PIPX_BIN_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
echo "Installing Python tools..."
|
||||
export PIPX_HOME=${PIPX_HOME}
|
||||
export PIPX_BIN_DIR=${PIPX_BIN_DIR}
|
||||
export PYTHONUSERBASE=/tmp/pip-tmp
|
||||
export PIP_CACHE_DIR=/tmp/pip-tmp/cache
|
||||
export PATH=${PATH}
|
||||
pip3 install --disable-pip-version-check --no-warn-script-location --no-cache-dir --user pipx
|
||||
/tmp/pip-tmp/bin/pipx install --pip-args=--no-cache-dir pipx
|
||||
echo "${DEFAULT_UTILS}" | xargs -n 1 /tmp/pip-tmp/bin/pipx install --system-site-packages --pip-args '--no-cache-dir --force-reinstall'
|
||||
chown -R ${USERNAME} ${PIPX_HOME}
|
||||
rm -rf /tmp/pip-tmp
|
||||
chown :pipx ${PIPX_HOME} ${PIPX_BIN_DIR}
|
||||
chmod g+s ${PIPX_HOME} ${PIPX_BIN_DIR}
|
||||
|
||||
# Install tools
|
||||
echo "Installing Python tools..."
|
||||
export PYTHONUSERBASE=/tmp/pip-tmp
|
||||
export PIP_CACHE_DIR=/tmp/pip-tmp/cache
|
||||
pip3 install --disable-pip-version-check --no-warn-script-location --no-cache-dir --user pipx
|
||||
/tmp/pip-tmp/bin/pipx install --pip-args=--no-cache-dir pipx
|
||||
echo "${DEFAULT_UTILS}" | xargs -n 1 /tmp/pip-tmp/bin/pipx install --system-site-packages --pip-args '--no-cache-dir --force-reinstall'
|
||||
rm -rf /tmp/pip-tmp
|
||||
|
||||
updaterc "$(cat << EOF
|
||||
export PIPX_HOME="${PIPX_HOME}"
|
||||
export PIPX_BIN_DIR="${PIPX_BIN_DIR}"
|
||||
if [[ "\${PATH}" != *"\${PIPX_BIN_DIR}"* ]]; then export PATH="\${PATH}:\${PIPX_BIN_DIR}"; fi
|
||||
EOF
|
||||
)"
|
||||
updaterc "export PIPX_HOME=${PIPX_HOME}\nexport PIPX_BIN_DIR=${PIPX_BIN_DIR}\nexport PATH=\${PATH}:\${PIPX_BIN_DIR}"
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -110,7 +110,7 @@ if [ "${INSTALL_RUBY_TOOLS}" = "true" ] && [ "${SKIP_GEM_INSTALL}" != "true" ];
|
|||
fi
|
||||
|
||||
# VS Code server usually first in the path, so silence annoying rvm warning (that does not apply) and then source it
|
||||
updaterc "if ! grep rvm_silence_path_mismatch_check_flag \$HOME/.rvmrc > /dev/null 2>&1; then echo 'rvm_silence_path_mismatch_check_flag=1' >> \$HOME/.rvmrc; fi\nsource /usr/local/rvm/scripts/rvm"
|
||||
updaterc "if ! grep rvm_silence_path_mismatch_check_flag \$HOME/.rvmrc > /dev/null 2>&1; then echo 'rvm_silence_path_mismatch_check_flag=1' >> \$HOME/.rvmrc; fi\nsource /usr/local/rvm/scripts/rvm > /dev/null 2>&1"
|
||||
|
||||
# Install rbenv/ruby-build for good measure
|
||||
git clone --depth=1 \
|
||||
|
|
|
@ -23,7 +23,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -86,5 +86,13 @@ EOF
|
|||
# Add CARGO_HOME, RUSTUP_HOME and bin directory into bashrc/zshrc files (unless disabled)
|
||||
updaterc "export CARGO_HOME=\"${CARGO_HOME}\"\nexport RUSTUP_HOME=\"${RUSTUP_HOME}\"\nexport PATH=\"\${CARGO_HOME}/bin:\${PATH}\""
|
||||
|
||||
updaterc "$(cat << EOF
|
||||
export RUSTUP_HOME="${RUSTUP_HOME}"
|
||||
export CARGO_HOME="${CARGO_HOME}"
|
||||
if [[ "\${PATH}" != *"\${CARGO_HOME}/bin"* ]]; then export PATH="\${PATH}:\${CARGO_HOME}/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
||||
echo "Done!"
|
||||
|
||||
|
|
|
@ -24,7 +24,9 @@ fi
|
|||
|
||||
# SSH uses a login shells, so we need to ensure these get the same initial PATH as non-login shells.
|
||||
# /etc/profile wipes out the path which is a problem when the PATH was modified using the ENV directive in a Dockerfile.
|
||||
echo "export PATH=${PATH//$(bash -lc 'echo $PATH')/\${PATH}}" > /etc/profile.d/00-restore-env.sh
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -135,7 +135,14 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
|
|||
fi
|
||||
|
||||
# Add GOPATH variable and bin directory into PATH in bashrc/zshrc files (unless disabled)
|
||||
updaterc "export GOPATH=\"${TARGET_GOPATH}\"\nexport GOROOT=\"${TARGET_GOROOT}\"\nexport PATH=\"\${GOROOT}/bin:\${GOPATH}/bin:\${PATH}\""
|
||||
updaterc "$(cat << EOF
|
||||
export GOPATH="${TARGET_GOPATH}"
|
||||
if [[ "\${PATH}" != *"\${GOPATH}/bin"* ]]; then export PATH="\${PATH}:\${GOPATH}/bin"; fi
|
||||
export GOROOT="${TARGET_GOROOT}"
|
||||
if [[ "\${PATH}" != *"\${GOROOT}/bin"* ]]; then export PATH="\${PATH}:\${GOROOT}/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
||||
echo "Done!"
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -66,14 +66,22 @@ fi
|
|||
|
||||
# Install sdkman if not installed
|
||||
if [ ! -d "${SDKMAN_DIR}" ]; then
|
||||
# Create sdkman group, dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^sdkman:" > /dev/null 2>&1; then
|
||||
groupadd -r sdkman
|
||||
fi
|
||||
usermod -a -G sdkman ${USERNAME}
|
||||
umask 0002
|
||||
# Install SDKMAN
|
||||
curl -sSL "https://get.sdkman.io?rcupdate=false" | bash
|
||||
chown -R "${USERNAME}" "${SDKMAN_DIR}"
|
||||
chown -R :sdkman ${SDKMAN_DIR}
|
||||
find ${SDKMAN_DIR} -type d | xargs -d '\n' chmod g+s
|
||||
# Add sourcing of sdkman into bashrc/zshrc files (unless disabled)
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\nsource \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\n. \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
fi
|
||||
|
||||
# Install gradle
|
||||
su ${USERNAME} -c ". ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install gradle ${GRADLE_VERSION} && sdk flush archives && sdk flush temp"
|
||||
su ${USERNAME} -c "umask 0002 && . ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install gradle ${GRADLE_VERSION} && sdk flush archives && sdk flush temp"
|
||||
updaterc "export GRADLE_USER_HOME=\${HOME}/.gradle"
|
||||
|
||||
echo "Done!"
|
||||
|
|
|
@ -27,7 +27,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -66,14 +66,22 @@ fi
|
|||
|
||||
# Install sdkman if not installed
|
||||
if [ ! -d "${SDKMAN_DIR}" ]; then
|
||||
# Create sdkman group, dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^sdkman:" > /dev/null 2>&1; then
|
||||
groupadd -r sdkman
|
||||
fi
|
||||
usermod -a -G sdkman ${USERNAME}
|
||||
umask 0002
|
||||
# Install SDKMAN
|
||||
curl -sSL "https://get.sdkman.io?rcupdate=false" | bash
|
||||
chown -R "${USERNAME}" "${SDKMAN_DIR}"
|
||||
chown -R :sdkman ${SDKMAN_DIR}
|
||||
find ${SDKMAN_DIR} -type d | xargs -d '\n' chmod g+s
|
||||
# Add sourcing of sdkman into bashrc/zshrc files (unless disabled)
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\nsource \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\n. \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
fi
|
||||
|
||||
if [ "${JAVA_VERSION}" != "none" ]; then
|
||||
su ${USERNAME} -c ". ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install java ${JAVA_VERSION} && sdk flush archives && sdk flush temp"
|
||||
su ${USERNAME} -c "umask 0002 && . ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install java ${JAVA_VERSION} && sdk flush archives && sdk flush temp"
|
||||
fi
|
||||
|
||||
echo "Done!"
|
|
@ -27,7 +27,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -66,14 +66,22 @@ fi
|
|||
|
||||
# Install sdkman if not installed
|
||||
if [ ! -d "${SDKMAN_DIR}" ]; then
|
||||
# Create sdkman group, dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^sdkman:" > /dev/null 2>&1; then
|
||||
groupadd -r sdkman
|
||||
fi
|
||||
usermod -a -G sdkman ${USERNAME}
|
||||
umask 0002
|
||||
# Install SDKMAN
|
||||
curl -sSL "https://get.sdkman.io?rcupdate=false" | bash
|
||||
chown -R "${USERNAME}" "${SDKMAN_DIR}"
|
||||
chown -R :sdkman ${SDKMAN_DIR}
|
||||
find ${SDKMAN_DIR} -type d | xargs -d '\n' chmod g+s
|
||||
# Add sourcing of sdkman into bashrc/zshrc files (unless disabled)
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\nsource \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\n. \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
fi
|
||||
|
||||
# Install Maven
|
||||
su ${USERNAME} -c ". ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install maven ${MAVEN_VERSION} && sdk flush archives && sdk flush temp"
|
||||
su ${USERNAME} -c "umask 0002 && . ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install maven ${MAVEN_VERSION} && sdk flush archives && sdk flush temp"
|
||||
updaterc "export M2=\$HOME/.m2"
|
||||
|
||||
echo "Done!"
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -118,22 +118,28 @@ export PATH=${PYTHON_INSTALL_PATH}/bin:${PIPX_BIN_DIR}:${PATH}
|
|||
echo "Updating pip..."
|
||||
python3 -m pip install --no-cache-dir --upgrade pip
|
||||
|
||||
# Install tools
|
||||
# Create pipx group, dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^pipx:" > /dev/null 2>&1; then
|
||||
groupadd -r pipx
|
||||
fi
|
||||
usermod -a -G pipx ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${PIPX_BIN_DIR}
|
||||
chown -R ${USERNAME} ${PIPX_HOME} ${PIPX_BIN_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
echo "Installing Python tools..."
|
||||
export PIPX_HOME=${PIPX_HOME}
|
||||
export PIPX_BIN_DIR=${PIPX_BIN_DIR}
|
||||
export PYTHONUSERBASE=/tmp/pip-tmp
|
||||
export PIP_CACHE_DIR=/tmp/pip-tmp/cache
|
||||
export PATH=${PATH}
|
||||
pip3 install --disable-pip-version-check --no-warn-script-location --no-cache-dir --user pipx
|
||||
/tmp/pip-tmp/bin/pipx install --pip-args=--no-cache-dir pipx
|
||||
echo "${DEFAULT_UTILS}" | xargs -n 1 /tmp/pip-tmp/bin/pipx install --system-site-packages --pip-args '--no-cache-dir --force-reinstall'
|
||||
chown -R ${USERNAME} ${PIPX_HOME}
|
||||
rm -rf /tmp/pip-tmp
|
||||
chown :pipx ${PIPX_HOME} ${PIPX_BIN_DIR}
|
||||
chmod g+s ${PIPX_HOME} ${PIPX_BIN_DIR}
|
||||
|
||||
# Install tools
|
||||
echo "Installing Python tools..."
|
||||
export PYTHONUSERBASE=/tmp/pip-tmp
|
||||
export PIP_CACHE_DIR=/tmp/pip-tmp/cache
|
||||
pip3 install --disable-pip-version-check --no-warn-script-location --no-cache-dir --user pipx
|
||||
/tmp/pip-tmp/bin/pipx install --pip-args=--no-cache-dir pipx
|
||||
echo "${DEFAULT_UTILS}" | xargs -n 1 /tmp/pip-tmp/bin/pipx install --system-site-packages --pip-args '--no-cache-dir --force-reinstall'
|
||||
rm -rf /tmp/pip-tmp
|
||||
|
||||
updaterc "$(cat << EOF
|
||||
export PIPX_HOME="${PIPX_HOME}"
|
||||
export PIPX_BIN_DIR="${PIPX_BIN_DIR}"
|
||||
if [[ "\${PATH}" != *"\${PIPX_BIN_DIR}"* ]]; then export PATH="\${PATH}:\${PIPX_BIN_DIR}"; fi
|
||||
EOF
|
||||
)"
|
||||
updaterc "export PIPX_HOME=${PIPX_HOME}\nexport PIPX_BIN_DIR=${PIPX_BIN_DIR}\nexport PATH=\${PATH}:\${PIPX_BIN_DIR}"
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -110,7 +110,7 @@ if [ "${INSTALL_RUBY_TOOLS}" = "true" ] && [ "${SKIP_GEM_INSTALL}" != "true" ];
|
|||
fi
|
||||
|
||||
# VS Code server usually first in the path, so silence annoying rvm warning (that does not apply) and then source it
|
||||
updaterc "if ! grep rvm_silence_path_mismatch_check_flag \$HOME/.rvmrc > /dev/null 2>&1; then echo 'rvm_silence_path_mismatch_check_flag=1' >> \$HOME/.rvmrc; fi\nsource /usr/local/rvm/scripts/rvm"
|
||||
updaterc "if ! grep rvm_silence_path_mismatch_check_flag \$HOME/.rvmrc > /dev/null 2>&1; then echo 'rvm_silence_path_mismatch_check_flag=1' >> \$HOME/.rvmrc; fi\nsource /usr/local/rvm/scripts/rvm > /dev/null 2>&1"
|
||||
|
||||
# Install rbenv/ruby-build for good measure
|
||||
git clone --depth=1 \
|
||||
|
|
|
@ -23,7 +23,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -86,5 +86,13 @@ EOF
|
|||
# Add CARGO_HOME, RUSTUP_HOME and bin directory into bashrc/zshrc files (unless disabled)
|
||||
updaterc "export CARGO_HOME=\"${CARGO_HOME}\"\nexport RUSTUP_HOME=\"${RUSTUP_HOME}\"\nexport PATH=\"\${CARGO_HOME}/bin:\${PATH}\""
|
||||
|
||||
updaterc "$(cat << EOF
|
||||
export RUSTUP_HOME="${RUSTUP_HOME}"
|
||||
export CARGO_HOME="${CARGO_HOME}"
|
||||
if [[ "\${PATH}" != *"\${CARGO_HOME}/bin"* ]]; then export PATH="\${PATH}:\${CARGO_HOME}/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
||||
echo "Done!"
|
||||
|
||||
|
|
|
@ -24,7 +24,9 @@ fi
|
|||
|
||||
# SSH uses a login shells, so we need to ensure these get the same initial PATH as non-login shells.
|
||||
# /etc/profile wipes out the path which is a problem when the PATH was modified using the ENV directive in a Dockerfile.
|
||||
echo "export PATH=${PATH//$(bash -lc 'echo $PATH')/\${PATH}}" > /etc/profile.d/00-restore-env.sh
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# [Choice] .NET Core version: 3.1, 2.1
|
||||
ARG VARIANT=3.1
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/dotnetcore:dev-${VARIANT}
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/dotnet:dev-${VARIANT}
|
||||
|
||||
# [Option] Install Node.js
|
||||
ARG INSTALL_NODE="true"
|
||||
ARG NODE_VERSION="lts/*"
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Option] Install Azure CLI
|
||||
ARG INSTALL_AZURE_CLI="false"
|
||||
|
|
|
@ -12,17 +12,18 @@ ARG USERNAME=vscode
|
|||
ARG USER_UID=1000
|
||||
ARG USER_GID=$USER_UID
|
||||
COPY library-scripts/*.sh /tmp/library-scripts/
|
||||
RUN apt-get update \
|
||||
&& /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
|
||||
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
|
||||
RUN apt-get update && /bin/bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \
|
||||
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
|
||||
|
||||
# Add bin location to path
|
||||
ENV PUB_CACHE="/usr/local/share/pub-cache"
|
||||
ENV PATH="${PATH}:${PUB_CACHE}/bin"
|
||||
RUN mkdir -p ${PUB_CACHE} \
|
||||
&& chown ${USERNAME}:root ${PUB_CACHE} \
|
||||
&& echo "if [ \"\$(stat -c '%U' ${PUB_CACHE})\" != \"${USERNAME}\" ]; then sudo chown -R ${USER_UID}:root ${PUB_CACHE}; fi" \
|
||||
| tee -a /root/.bashrc /root/.zshrc /home/${USERNAME}/.bashrc >> /home/${USERNAME}/.zshrc
|
||||
ENV PATH="${PUB_CACHE}/bin:${PATH}"
|
||||
RUN if ! cat /etc/group | grep -e "^pub-cache:" > /dev/null 2>&1; then groupadd -r pub-cache; fi \
|
||||
&& usermod -a -G pub-cache ${USERNAME} \
|
||||
&& umask 0002 \
|
||||
&& mkdir -p ${PUB_CACHE} \
|
||||
&& chown :pub-cache ${PUB_CACHE} \
|
||||
&& sed -i -e "s/export PATH=/export PATH=\/usr\/local\/share\/pub-cache:/" /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@ FROM mcr.microsoft.com/vscode/devcontainers/dotnet:dev-${VARIANT}
|
|||
# [Option] Install Node.js
|
||||
ARG INSTALL_NODE="true"
|
||||
ARG NODE_VERSION="lts/*"
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Option] Install Azure CLI
|
||||
ARG INSTALL_AZURE_CLI="false"
|
||||
COPY library-scripts/azcli-debian.sh /tmp/library-scripts/
|
||||
RUN if [ "$INSTALL_AZURE_CLI" = "true" ]; then bash /tmp/library-scripts/azcli-debian.sh; fi \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/library-scripts
|
||||
&& apt-get clean -y && rm -rf /var/lib/apt/lists/* /tmp/library-scripts
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
|
|
|
@ -12,10 +12,10 @@ checkExtension "ionide.ionide-fsharp"
|
|||
check "dotnet" dotnet --info
|
||||
check "nuget" dotnet restore
|
||||
check "msbuild" dotnet msbuild
|
||||
rm -rf obj bin
|
||||
sudo rm -rf obj bin
|
||||
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10"
|
||||
check "nvm-node" bash -c ". /usr/local/share/nvm/nvm.sh && node --version"
|
||||
check "yarn" yarn --version
|
||||
check "yarn" bash -c ". /usr/local/share/nvm/nvm.sh && yarn --version"
|
||||
|
||||
# Report result
|
||||
reportResults
|
|
@ -1,11 +1,11 @@
|
|||
# [Choice] .NET Core version: 5.0, 3.1, 2.1
|
||||
ARG VARIANT=3.1
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/dotnetcore:${VARIANT}
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/dotnet:${VARIANT}
|
||||
|
||||
# [Option] Install Node.js
|
||||
ARG INSTALL_NODE="true"
|
||||
ARG NODE_VERSION="lts/*"
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Option] Install Azure CLI
|
||||
ARG INSTALL_AZURE_CLI="false"
|
||||
|
@ -21,12 +21,8 @@ RUN bash ./installSQLtools.sh \
|
|||
# Update args in docker-compose.yaml to set the UID/GID of the "vscode" user.
|
||||
ARG USER_UID=1000
|
||||
ARG USER_GID=$USER_UID
|
||||
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \
|
||||
groupmod --gid $USER_GID vscode \
|
||||
&& usermod --uid $USER_UID --gid $USER_GID vscode \
|
||||
&& chown -R $USER_UID:$USER_GID /home/vscode \
|
||||
&& chown -R $USER_UID:root /usr/local/share/nvm /usr/local/share/npm-global; \
|
||||
fi
|
||||
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then groupmod --gid $USER_GID vscode && usermod --uid $USER_UID --gid $USER_GID vscode; fi
|
||||
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
|
|
|
@ -15,7 +15,7 @@ check "msbuild" dotnet msbuild
|
|||
rm -rf obj bin
|
||||
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10"
|
||||
check "nvm-node" bash -c ". /usr/local/share/nvm/nvm.sh && node --version"
|
||||
check "yarn" yarn --version
|
||||
check "yarn" bash -c ". /usr/local/share/nvm/nvm.sh && yarn --version"
|
||||
|
||||
# Report result
|
||||
reportResults
|
|
@ -5,7 +5,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/dotnet:dev-${VARIANT}
|
|||
# [Option] Install Node.js
|
||||
ARG INSTALL_NODE="true"
|
||||
ARG NODE_VERSION="lts/*"
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Option] Install Azure CLI
|
||||
ARG INSTALL_AZURE_CLI="false"
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -11,10 +11,10 @@ checkExtension "ms-dotnettools.csharp"
|
|||
check "dotnet" dotnet --info
|
||||
check "nuget" dotnet restore
|
||||
check "msbuild" dotnet msbuild
|
||||
rm -rf obj bin
|
||||
sudo rm -rf obj bin
|
||||
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 10"
|
||||
check "nvm-node" bash -c ". /usr/local/share/nvm/nvm.sh && node --version"
|
||||
check "yarn" yarn --version
|
||||
check "yarn" bash -c ". /usr/local/share/nvm/nvm.sh && yarn --version"
|
||||
|
||||
# Report result
|
||||
reportResults
|
|
@ -1,11 +1,11 @@
|
|||
# [Choice] Go version: 1, 1.15, 1.14
|
||||
ARG VARIANT=1
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/go:${VARIANT}
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/go:dev-${VARIANT}
|
||||
|
||||
# [Option] Install Node.js
|
||||
ARG INSTALL_NODE="true"
|
||||
ARG NODE_VERSION="lts/*"
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -135,7 +135,14 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
|
|||
fi
|
||||
|
||||
# Add GOPATH variable and bin directory into PATH in bashrc/zshrc files (unless disabled)
|
||||
updaterc "export GOPATH=\"${TARGET_GOPATH}\"\nexport GOROOT=\"${TARGET_GOROOT}\"\nexport PATH=\"\${GOROOT}/bin:\${GOPATH}/bin:\${PATH}\""
|
||||
updaterc "$(cat << EOF
|
||||
export GOPATH="${TARGET_GOPATH}"
|
||||
if [[ "\${PATH}" != *"\${GOPATH}/bin"* ]]; then export PATH="\${PATH}:\${GOPATH}/bin"; fi
|
||||
export GOROOT="${TARGET_GOROOT}"
|
||||
if [[ "\${PATH}" != *"\${GOROOT}/bin"* ]]; then export PATH="\${PATH}:\${GOROOT}/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
||||
echo "Done!"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -6,13 +6,13 @@ ARG MAVEN_VERSION=""
|
|||
# [Option] Install Gradle
|
||||
ARG INSTALL_GRADLE="false"
|
||||
ARG GRADLE_VERSION=""
|
||||
RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "source /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
|
||||
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "source /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
|
||||
RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
|
||||
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
|
||||
|
||||
# [Option] Install Node.js
|
||||
ARG INSTALL_NODE="true"
|
||||
ARG NODE_VERSION="lts/*"
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM mcr.microsoft.com/vscode/devcontainers/java:11
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/java:dev-11
|
||||
|
||||
# Install JDK 8 and optionally Maven and Gradle - version of "" installs latest
|
||||
ARG JDK8_VERSION=""
|
||||
|
@ -6,16 +6,16 @@ ARG INSTALL_MAVEN="false"
|
|||
ARG MAVEN_VERSION=""
|
||||
ARG INSTALL_GRADLE="false"
|
||||
ARG GRADLE_VERSION=""
|
||||
RUN su vscode -c "source /usr/local/sdkman/bin/sdkman-init.sh && if [ "${JDK8_VERSION}" = "" ]; then \
|
||||
RUN su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && if [ "${JDK8_VERSION}" = "" ]; then \
|
||||
sdk install java \$(sdk ls java | grep -m 1 -o ' 8.*.hs-adpt ' | awk '{print \$NF}'); \
|
||||
else sdk install java '${JDK8_VERSION}'; fi" \
|
||||
&& if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "source /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
|
||||
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "source /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
|
||||
&& if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
|
||||
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
|
||||
|
||||
# [Optional] Install a version of Node.js using nvm for front end dev
|
||||
ARG INSTALL_NODE="true"
|
||||
ARG NODE_VERSION="lts/*"
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
|
|
|
@ -16,7 +16,7 @@ rm -rf mv maven-wrapper-maven-wrapper-0.5.5
|
|||
# Definition specific tests
|
||||
checkExtension "vscjava.vscode-java-pack"
|
||||
check "java" java -version
|
||||
check "build-and-test-jar" ./mvnw package
|
||||
check "build-and-test-jar" ./mvnw -q package
|
||||
check "test-project" java -jar target/my-app-1.0-SNAPSHOT.jar
|
||||
|
||||
# Clean up
|
||||
|
|
|
@ -8,13 +8,13 @@ ARG MAVEN_VERSION=""
|
|||
# [Option] Install Gradle
|
||||
ARG INSTALL_GRADLE="false"
|
||||
ARG GRADLE_VERSION=""
|
||||
RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "source /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
|
||||
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "source /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
|
||||
RUN if [ "${INSTALL_MAVEN}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install maven \"${MAVEN_VERSION}\""; fi \
|
||||
&& if [ "${INSTALL_GRADLE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/sdkman/bin/sdkman-init.sh && sdk install gradle \"${GRADLE_VERSION}\""; fi
|
||||
|
||||
# [Option] Install Node.js
|
||||
ARG INSTALL_NODE="true"
|
||||
ARG NODE_VERSION="lts/*"
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
|
|
|
@ -42,4 +42,4 @@ RUN if [ "$INSTALL_NODE" = "true" ]; then bash /tmp/library-scripts/node-debian.
|
|||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||
# && apt-get -y install --no-install-recommends <your-package-list-here>
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -66,14 +66,22 @@ fi
|
|||
|
||||
# Install sdkman if not installed
|
||||
if [ ! -d "${SDKMAN_DIR}" ]; then
|
||||
# Create sdkman group, dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^sdkman:" > /dev/null 2>&1; then
|
||||
groupadd -r sdkman
|
||||
fi
|
||||
usermod -a -G sdkman ${USERNAME}
|
||||
umask 0002
|
||||
# Install SDKMAN
|
||||
curl -sSL "https://get.sdkman.io?rcupdate=false" | bash
|
||||
chown -R "${USERNAME}" "${SDKMAN_DIR}"
|
||||
chown -R :sdkman ${SDKMAN_DIR}
|
||||
find ${SDKMAN_DIR} -type d | xargs -d '\n' chmod g+s
|
||||
# Add sourcing of sdkman into bashrc/zshrc files (unless disabled)
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\nsource \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\n. \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
fi
|
||||
|
||||
# Install gradle
|
||||
su ${USERNAME} -c ". ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install gradle ${GRADLE_VERSION} && sdk flush archives && sdk flush temp"
|
||||
su ${USERNAME} -c "umask 0002 && . ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install gradle ${GRADLE_VERSION} && sdk flush archives && sdk flush temp"
|
||||
updaterc "export GRADLE_USER_HOME=\${HOME}/.gradle"
|
||||
|
||||
echo "Done!"
|
||||
|
|
|
@ -27,7 +27,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -66,14 +66,22 @@ fi
|
|||
|
||||
# Install sdkman if not installed
|
||||
if [ ! -d "${SDKMAN_DIR}" ]; then
|
||||
# Create sdkman group, dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^sdkman:" > /dev/null 2>&1; then
|
||||
groupadd -r sdkman
|
||||
fi
|
||||
usermod -a -G sdkman ${USERNAME}
|
||||
umask 0002
|
||||
# Install SDKMAN
|
||||
curl -sSL "https://get.sdkman.io?rcupdate=false" | bash
|
||||
chown -R "${USERNAME}" "${SDKMAN_DIR}"
|
||||
chown -R :sdkman ${SDKMAN_DIR}
|
||||
find ${SDKMAN_DIR} -type d | xargs -d '\n' chmod g+s
|
||||
# Add sourcing of sdkman into bashrc/zshrc files (unless disabled)
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\nsource \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\n. \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
fi
|
||||
|
||||
if [ "${JAVA_VERSION}" != "none" ]; then
|
||||
su ${USERNAME} -c ". ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install java ${JAVA_VERSION} && sdk flush archives && sdk flush temp"
|
||||
su ${USERNAME} -c "umask 0002 && . ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install java ${JAVA_VERSION} && sdk flush archives && sdk flush temp"
|
||||
fi
|
||||
|
||||
echo "Done!"
|
|
@ -27,7 +27,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -66,14 +66,22 @@ fi
|
|||
|
||||
# Install sdkman if not installed
|
||||
if [ ! -d "${SDKMAN_DIR}" ]; then
|
||||
# Create sdkman group, dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^sdkman:" > /dev/null 2>&1; then
|
||||
groupadd -r sdkman
|
||||
fi
|
||||
usermod -a -G sdkman ${USERNAME}
|
||||
umask 0002
|
||||
# Install SDKMAN
|
||||
curl -sSL "https://get.sdkman.io?rcupdate=false" | bash
|
||||
chown -R "${USERNAME}" "${SDKMAN_DIR}"
|
||||
chown -R :sdkman ${SDKMAN_DIR}
|
||||
find ${SDKMAN_DIR} -type d | xargs -d '\n' chmod g+s
|
||||
# Add sourcing of sdkman into bashrc/zshrc files (unless disabled)
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\nsource \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
updaterc "export SDKMAN_DIR=${SDKMAN_DIR}\n. \${SDKMAN_DIR}/bin/sdkman-init.sh"
|
||||
fi
|
||||
|
||||
# Install Maven
|
||||
su ${USERNAME} -c ". ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install maven ${MAVEN_VERSION} && sdk flush archives && sdk flush temp"
|
||||
su ${USERNAME} -c "umask 0002 && . ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk install maven ${MAVEN_VERSION} && sdk flush archives && sdk flush temp"
|
||||
updaterc "export M2=\$HOME/.m2"
|
||||
|
||||
echo "Done!"
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -8,7 +8,7 @@ checkCommon
|
|||
|
||||
# Prep
|
||||
echo -e "\nGetting Maven wrapper..."
|
||||
curl -sSL https://github.com/takari/maven-wrapper/archive/maven-wrapper-0.5.5.tar.gz| tar -xzf -
|
||||
curl -sSL https://github.com/takari/maven-wrapper/archive/maven-wrapper-0.5.5.tar.gz| tar -xzf -
|
||||
mv maven-wrapper-maven-wrapper-0.5.5/mvnw mvnw
|
||||
mv maven-wrapper-maven-wrapper-0.5.5/.mvn .mvn
|
||||
rm -rf mv maven-wrapper-maven-wrapper-0.5.5
|
||||
|
@ -16,7 +16,7 @@ rm -rf mv maven-wrapper-maven-wrapper-0.5.5
|
|||
# Definition specific tests
|
||||
checkExtension "vscjava.vscode-java-pack"
|
||||
check "java" java -version
|
||||
check "build-and-test-jar" ./mvnw package
|
||||
check "build-and-test-jar" ./mvnw -q package
|
||||
check "test-project" java -jar target/my-app-1.0-SNAPSHOT.jar
|
||||
|
||||
# Clean up
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Update the VARIANT arg in docker-compose.yml to pick a Node version: 10, 12, 14
|
||||
ARG VARIANT=12
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:${VARIANT}
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:dev-${VARIANT}
|
||||
|
||||
# Install MongoDB command line tools
|
||||
ARG MONGO_TOOLS_VERSION=4.2
|
||||
|
@ -13,12 +13,7 @@ RUN curl -sSL "https://www.mongodb.org/static/pgp/server-${MONGO_TOOLS_VERSION}.
|
|||
# Update args in docker-compose.yaml to set the UID/GID of the "node" user.
|
||||
ARG USER_UID=1000
|
||||
ARG USER_GID=$USER_UID
|
||||
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \
|
||||
groupmod --gid $USER_GID node \
|
||||
&& usermod --uid $USER_UID --gid $USER_GID node \
|
||||
&& chown -R $USER_UID:$USER_GID /home/node \
|
||||
&& chown -R $USER_UID:root /usr/local/share/nvm /usr/local/share/npm-global; \
|
||||
fi
|
||||
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then groupmod --gid $USER_GID node && usermod --uid $USER_UID --gid $USER_GID node; fi
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
|
@ -28,7 +23,8 @@ RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \
|
|||
# ARG EXTRA_NODE_VERSION=10
|
||||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
|
||||
|
||||
# [Optional] Uncomment if you want to install more global node packages
|
||||
# RUN sudo -u node npm install -g <your-package-list-here>
|
||||
# [Optional] Uncomment if you want to install more global node modules
|
||||
# RUN su node -c "npm install -g <your-package-list-here>"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ check "eslint" eslint server.js
|
|||
check "test-project" npm run test
|
||||
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 8"
|
||||
check "nvm-node" bash -c ". /usr/local/share/nvm/nvm.sh && node --version"
|
||||
sudo rm -rf node_modules
|
||||
|
||||
# Report result
|
||||
reportResults
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
# Update the VARIANT arg in docker-compose.yml to pick a Node version: 10, 12, 14
|
||||
ARG VARIANT=12
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:${VARIANT}
|
||||
FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:dev-${VARIANT}
|
||||
|
||||
# Update args in docker-compose.yaml to set the UID/GID of the "node" user.
|
||||
ARG USER_UID=1000
|
||||
ARG USER_GID=$USER_UID
|
||||
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \
|
||||
groupmod --gid $USER_GID node \
|
||||
&& usermod --uid $USER_UID --gid $USER_GID node \
|
||||
&& chown -R $USER_UID:$USER_GID /home/node \
|
||||
&& chown -R $USER_UID:root /usr/local/share/nvm /usr/local/share/npm-global; \
|
||||
fi
|
||||
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then groupmod --gid $USER_GID node && usermod --uid $USER_UID --gid $USER_GID node; fi
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
|
@ -20,6 +15,5 @@ RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \
|
|||
# ARG EXTRA_NODE_VERSION=10
|
||||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
|
||||
|
||||
# [Optional] Uncomment if you want to install more global node packages
|
||||
# RUN sudo -u node npm install -g <your-package-list-here>
|
||||
|
||||
# [Optional] Uncomment if you want to install more global node modules
|
||||
# RUN su node -c "npm install -g <your-package-list-here>"
|
||||
|
|
|
@ -15,6 +15,7 @@ check "eslint" eslint server.js
|
|||
check "test-project" npm run test
|
||||
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 8"
|
||||
check "nvm-node" bash -c ". /usr/local/share/nvm/nvm.sh && node --version"
|
||||
sudo rm -rf node_modules
|
||||
|
||||
# Report result
|
||||
reportResults
|
||||
|
|
|
@ -11,4 +11,4 @@ FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:${VARIANT}
|
|||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
|
||||
|
||||
# [Optional] Uncomment if you want to install more global node modules
|
||||
# RUN sudo -u node npm install -g <your-package-list-here>
|
||||
# RUN su node -c "npm install -g <your-package-list-here>"
|
||||
|
|
|
@ -24,15 +24,17 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
|||
# Install yarn, nvm
|
||||
&& rm -rf /opt/yarn-* /usr/local/bin/yarn /usr/local/bin/yarnpkg \
|
||||
&& bash /tmp/library-scripts/node-debian.sh "${NVM_DIR}" "none" "${USERNAME}" \
|
||||
# Configure global npm install location
|
||||
# Configure global npm install location, use group to adapt to UID/GID changes
|
||||
&& if ! cat /etc/group | grep -e "^npm:" > /dev/null 2>&1; then groupadd -r npm; fi \
|
||||
&& usermod -a -G npm ${USERNAME} \
|
||||
&& umask 0002 \
|
||||
&& mkdir -p ${NPM_GLOBAL} \
|
||||
&& chown ${USERNAME}:root ${NPM_GLOBAL} \
|
||||
&& chown ${USERNAME}:npm ${NPM_GLOBAL} \
|
||||
&& chmod g+s ${NPM_GLOBAL} \
|
||||
&& npm config -g set prefix ${NPM_GLOBAL} \
|
||||
&& sudo -u ${USERNAME} npm config -g set prefix ${NPM_GLOBAL} \
|
||||
&& echo "if [ \"\$(stat -c '%U' ${NPM_GLOBAL})\" != \"\$USER\" ]; then sudo chown -R \$USER:root ${NPM_GLOBAL} \${NVM_DIR}; fi" \
|
||||
| tee -a /etc/bash.bashrc >> /etc/zsh/zshrc \
|
||||
# Install eslint
|
||||
&& su ${USERNAME} -c "npm install -g eslint" \
|
||||
&& su ${USERNAME} -c "umask 0002 && npm install -g eslint" \
|
||||
&& npm cache clean --force > /dev/null 2>&1 \
|
||||
# Clean up
|
||||
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* /root/.gnupg /tmp/library-scripts
|
||||
|
@ -44,3 +46,6 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
|||
# [Optional] Uncomment if you want to install an additional version of node using nvm
|
||||
# ARG EXTRA_NODE_VERSION=10
|
||||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
|
||||
|
||||
# [Optional] Uncomment if you want to install more global node modules
|
||||
# RUN su node -c "npm install -g <your-package-list-here>""
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -15,6 +15,7 @@ check "eslint" eslint server.js
|
|||
check "test-project" npm run test
|
||||
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm install 8"
|
||||
check "nvm-node" bash -c ". /usr/local/share/nvm/nvm.sh && node --version"
|
||||
sudo rm -rf node_modules
|
||||
|
||||
# Report result
|
||||
reportResults
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -10,17 +10,12 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
|||
# Update args in docker-compose.yaml to set the UID/GID of the "vscode" user.
|
||||
ARG USER_UID=1000
|
||||
ARG USER_GID=$USER_UID
|
||||
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \
|
||||
groupmod --gid $USER_GID vscode \
|
||||
&& usermod --uid $USER_UID --gid $USER_GID vscode \
|
||||
&& chown -R $USER_UID:$USER_GID /home/vscode \
|
||||
&& chown -R $USER_UID:root /usr/local/share/nvm; \
|
||||
fi
|
||||
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then groupmod --gid $USER_GID vscode && usermod --uid $USER_UID --gid $USER_GID vscode; fi
|
||||
|
||||
# [Optional] Install a version of Node.js using nvm for front end dev
|
||||
ARG INSTALL_NODE="true"
|
||||
ARG NODE_VERSION="lts/*"
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
|
|
|
@ -13,6 +13,7 @@ checkExtension "mrmlnc.vscode-apache"
|
|||
checkExtension "mtxr.sqltools"
|
||||
checkExtension "mtxr.sqltools-driver-mysql"
|
||||
check "php" php --version
|
||||
check "apache2ctl" which apache2ctl
|
||||
sleep 15 # Sleep to be sure MariaDB is running.
|
||||
check "mariadb" mariadb -h localhost -P 3306 --protocol=tcp -u root --password=mariadb -D mariadb -Bse exit
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/php:${VARIANT}
|
|||
# [Option] Install Node.js
|
||||
ARG INSTALL_NODE="true"
|
||||
ARG NODE_VERSION="lts/*"
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
#!/bin/bash
|
||||
|
||||
USERNAME=${1:-vscode}
|
||||
|
||||
if [ -z $HOME ]; then
|
||||
HOME="/root"
|
||||
fi
|
||||
|
||||
FAILED=()
|
||||
|
||||
check() {
|
||||
LABEL=$1
|
||||
shift
|
||||
echo -e "\n🧪 Testing $LABEL"
|
||||
if "$@"; then
|
||||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
checkMultiple() {
|
||||
PASSED=0
|
||||
LABEL="$1"
|
||||
echo -e "\n🧪 Testing $LABEL."
|
||||
shift; MINIMUMPASSED=$1
|
||||
shift; EXPRESSION="$1"
|
||||
while [ "$EXPRESSION" != "" ]; do
|
||||
if $EXPRESSION; then ((PASSED++)); fi
|
||||
shift; EXPRESSION=$1
|
||||
done
|
||||
if [ $PASSED -ge $MINIMUMPASSED ]; then
|
||||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
checkOSPackages() {
|
||||
LABEL=$1
|
||||
shift
|
||||
echo -e "\n🧪 Testing $LABEL"
|
||||
if dpkg-query --show -f='${Package}: ${Version}\n' "$@"; then
|
||||
echo "✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo "❌ $LABEL check failed."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
checkExtension() {
|
||||
# Happens asynchronusly, so keep retrying 10 times with an increasing delay
|
||||
EXTN_ID="$1"
|
||||
TIMEOUT_SECONDS="${2:-10}"
|
||||
RETRY_COUNT=0
|
||||
echo -e -n "\n🧪 Looking for extension $1 for maximum of ${TIMEOUT_SECONDS}s"
|
||||
until [ "${RETRY_COUNT}" -eq "${TIMEOUT_SECONDS}" ] || \
|
||||
[ ! -e $HOME/.vscode-server/extensions/${EXTN_ID}* ] || \
|
||||
[ ! -e $HOME/.vscode-server-insiders/extensions/${EXTN_ID}* ] || \
|
||||
[ ! -e $HOME/.vscode-test-server/extensions/${EXTN_ID}* ] || \
|
||||
[ ! -e $HOME/.vscode-remote/extensions/${EXTN_ID}* ]
|
||||
do
|
||||
sleep 1s
|
||||
(( RETRY_COUNT++ ))
|
||||
echo -n "."
|
||||
done
|
||||
|
||||
if [ ${RETRY_COUNT} -lt ${TIMEOUT_SECONDS} ]; then
|
||||
echo -e "\n✅ Passed!"
|
||||
return 0
|
||||
else
|
||||
echo -e "\n❌ Extension $EXTN_ID not found."
|
||||
FAILED+=("$LABEL")
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
checkCommon()
|
||||
{
|
||||
PACKAGE_LIST="apt-utils \
|
||||
git \
|
||||
openssh-client \
|
||||
less \
|
||||
iproute2 \
|
||||
procps \
|
||||
curl \
|
||||
wget \
|
||||
unzip \
|
||||
nano \
|
||||
jq \
|
||||
lsb-release \
|
||||
ca-certificates \
|
||||
apt-transport-https \
|
||||
dialog \
|
||||
gnupg2 \
|
||||
libc6 \
|
||||
libgcc1 \
|
||||
libgssapi-krb5-2 \
|
||||
liblttng-ust0 \
|
||||
libstdc++6 \
|
||||
zlib1g \
|
||||
locales \
|
||||
sudo"
|
||||
|
||||
# Actual tests
|
||||
checkOSPackages "common-os-packages" ${PACKAGE_LIST}
|
||||
checkMultiple "vscode-server" 1 "[ -d $HOME/.vscode-server/bin ]" "[ -d $HOME/.vscode-server-insiders/bin ]" "[ -d $HOME/.vscode-test-server/bin ]" "[ -d $HOME/.vscode-remote/bin ]" "[ -d $HOME/.vscode-remote/bin ]"
|
||||
check "non-root-user" id ${USERNAME}
|
||||
check "locale" [ $(locale -a | grep en_US.utf8) ]
|
||||
check "sudo" sudo echo "sudo works."
|
||||
check "zsh" zsh --version
|
||||
check "oh-my-zsh" [ -d "$HOME/.oh-my-zsh" ]
|
||||
check "login-shell-path" [ -f "/etc/profile.d/00-restore-env.sh" ]
|
||||
check "code" which code
|
||||
}
|
||||
|
||||
reportResults() {
|
||||
if [ ${#FAILED[@]} -ne 0 ]; then
|
||||
echo -e "\n💥 Failed tests: ${FAILED[@]}"
|
||||
exit 1
|
||||
else
|
||||
echo -e "\n💯 All passed!"
|
||||
exit 0
|
||||
fi
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
cd $(dirname "$0")
|
||||
|
||||
source test-utils.sh vscode
|
||||
|
||||
# Run common tests
|
||||
checkCommon
|
||||
|
||||
# Actual tests
|
||||
checkExtension "felixfbecker.php-debug"
|
||||
checkExtension "felixfbecker.php-intellisense"
|
||||
checkExtension "mrmlnc.vscode-apache"
|
||||
check "php" php --version
|
||||
check "apache2ctl" which apache2ctl
|
||||
|
||||
# Report result
|
||||
reportResults
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/miniconda:dev-3
|
|||
# [Option] Install Node.js
|
||||
ARG INSTALL_NODE="true"
|
||||
ARG NODE_VERSION="lts/*"
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# Copy environment.yml (if found) to a temp locaition so we update the environment. Also
|
||||
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -118,22 +118,28 @@ export PATH=${PYTHON_INSTALL_PATH}/bin:${PIPX_BIN_DIR}:${PATH}
|
|||
echo "Updating pip..."
|
||||
python3 -m pip install --no-cache-dir --upgrade pip
|
||||
|
||||
# Install tools
|
||||
# Create pipx group, dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^pipx:" > /dev/null 2>&1; then
|
||||
groupadd -r pipx
|
||||
fi
|
||||
usermod -a -G pipx ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${PIPX_BIN_DIR}
|
||||
chown -R ${USERNAME} ${PIPX_HOME} ${PIPX_BIN_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
echo "Installing Python tools..."
|
||||
export PIPX_HOME=${PIPX_HOME}
|
||||
export PIPX_BIN_DIR=${PIPX_BIN_DIR}
|
||||
export PYTHONUSERBASE=/tmp/pip-tmp
|
||||
export PIP_CACHE_DIR=/tmp/pip-tmp/cache
|
||||
export PATH=${PATH}
|
||||
pip3 install --disable-pip-version-check --no-warn-script-location --no-cache-dir --user pipx
|
||||
/tmp/pip-tmp/bin/pipx install --pip-args=--no-cache-dir pipx
|
||||
echo "${DEFAULT_UTILS}" | xargs -n 1 /tmp/pip-tmp/bin/pipx install --system-site-packages --pip-args '--no-cache-dir --force-reinstall'
|
||||
chown -R ${USERNAME} ${PIPX_HOME}
|
||||
rm -rf /tmp/pip-tmp
|
||||
chown :pipx ${PIPX_HOME} ${PIPX_BIN_DIR}
|
||||
chmod g+s ${PIPX_HOME} ${PIPX_BIN_DIR}
|
||||
|
||||
# Install tools
|
||||
echo "Installing Python tools..."
|
||||
export PYTHONUSERBASE=/tmp/pip-tmp
|
||||
export PIP_CACHE_DIR=/tmp/pip-tmp/cache
|
||||
pip3 install --disable-pip-version-check --no-warn-script-location --no-cache-dir --user pipx
|
||||
/tmp/pip-tmp/bin/pipx install --pip-args=--no-cache-dir pipx
|
||||
echo "${DEFAULT_UTILS}" | xargs -n 1 /tmp/pip-tmp/bin/pipx install --system-site-packages --pip-args '--no-cache-dir --force-reinstall'
|
||||
rm -rf /tmp/pip-tmp
|
||||
|
||||
updaterc "$(cat << EOF
|
||||
export PIPX_HOME="${PIPX_HOME}"
|
||||
export PIPX_BIN_DIR="${PIPX_BIN_DIR}"
|
||||
if [[ "\${PATH}" != *"\${PIPX_BIN_DIR}"* ]]; then export PATH="\${PATH}:\${PIPX_BIN_DIR}"; fi
|
||||
EOF
|
||||
)"
|
||||
updaterc "export PIPX_HOME=${PIPX_HOME}\nexport PIPX_BIN_DIR=${PIPX_BIN_DIR}\nexport PATH=\${PATH}:\${PIPX_BIN_DIR}"
|
||||
|
|
|
@ -7,16 +7,12 @@ ENV PYTHONUNBUFFERED 1
|
|||
# Update args in docker-compose.yaml to set the UID/GID of the "vscode" user.
|
||||
ARG USER_UID=1000
|
||||
ARG USER_GID=$USER_UID
|
||||
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then \
|
||||
groupmod --gid $USER_GID vscode \
|
||||
&& usermod --uid $USER_UID --gid $USER_GID vscode \
|
||||
&& chown -R $USER_UID:$USER_GID /home/vscode; \
|
||||
fi
|
||||
RUN if [ "$USER_GID" != "1000" ] || [ "$USER_UID" != "1000" ]; then groupmod --gid $USER_GID vscode && usermod --uid $USER_UID --gid $USER_GID vscode; fi
|
||||
|
||||
# [Option] Install Node.js
|
||||
ARG INSTALL_NODE="true"
|
||||
ARG NODE_VERSION="lts/*"
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Optional] If your requirements rarely change, uncomment this section to add them to the image.
|
||||
# COPY requirements.txt /tmp/pip-tmp/
|
||||
|
|
|
@ -5,7 +5,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
|
|||
# [Option] Install Node.js
|
||||
ARG INSTALL_NODE="true"
|
||||
ARG NODE_VERSION="lts/*"
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
|
||||
# COPY requirements.txt /tmp/pip-tmp/
|
||||
|
|
|
@ -24,7 +24,7 @@ ENV PIPX_HOME=/usr/local/py-utils \
|
|||
PIPX_BIN_DIR=/usr/local/py-utils/bin
|
||||
ENV PATH=${PATH}:${PIPX_BIN_DIR}
|
||||
COPY .devcontainer/library-scripts/python-debian.sh /tmp/library-scripts/
|
||||
RUN bash /tmp/library-scripts/python-debian.sh "none" "/usr/local" "${PIPX_HOME}" "${USERNAME}" "false" \
|
||||
RUN bash /tmp/library-scripts/python-debian.sh "none" "/usr/local" "${PIPX_HOME}" "${USERNAME}" \
|
||||
&& apt-get clean -y && rm -rf /tmp/library-scripts
|
||||
|
||||
# [Option] Install Node.js
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "Python 3",
|
||||
"build": {
|
||||
"dockerfile": "Dockerfile",
|
||||
"dockerfile": "base.Dockerfile",
|
||||
"context": "..",
|
||||
"args": {
|
||||
// Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -118,22 +118,28 @@ export PATH=${PYTHON_INSTALL_PATH}/bin:${PIPX_BIN_DIR}:${PATH}
|
|||
echo "Updating pip..."
|
||||
python3 -m pip install --no-cache-dir --upgrade pip
|
||||
|
||||
# Install tools
|
||||
# Create pipx group, dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^pipx:" > /dev/null 2>&1; then
|
||||
groupadd -r pipx
|
||||
fi
|
||||
usermod -a -G pipx ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${PIPX_BIN_DIR}
|
||||
chown -R ${USERNAME} ${PIPX_HOME} ${PIPX_BIN_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
echo "Installing Python tools..."
|
||||
export PIPX_HOME=${PIPX_HOME}
|
||||
export PIPX_BIN_DIR=${PIPX_BIN_DIR}
|
||||
export PYTHONUSERBASE=/tmp/pip-tmp
|
||||
export PIP_CACHE_DIR=/tmp/pip-tmp/cache
|
||||
export PATH=${PATH}
|
||||
pip3 install --disable-pip-version-check --no-warn-script-location --no-cache-dir --user pipx
|
||||
/tmp/pip-tmp/bin/pipx install --pip-args=--no-cache-dir pipx
|
||||
echo "${DEFAULT_UTILS}" | xargs -n 1 /tmp/pip-tmp/bin/pipx install --system-site-packages --pip-args '--no-cache-dir --force-reinstall'
|
||||
chown -R ${USERNAME} ${PIPX_HOME}
|
||||
rm -rf /tmp/pip-tmp
|
||||
chown :pipx ${PIPX_HOME} ${PIPX_BIN_DIR}
|
||||
chmod g+s ${PIPX_HOME} ${PIPX_BIN_DIR}
|
||||
|
||||
# Install tools
|
||||
echo "Installing Python tools..."
|
||||
export PYTHONUSERBASE=/tmp/pip-tmp
|
||||
export PIP_CACHE_DIR=/tmp/pip-tmp/cache
|
||||
pip3 install --disable-pip-version-check --no-warn-script-location --no-cache-dir --user pipx
|
||||
/tmp/pip-tmp/bin/pipx install --pip-args=--no-cache-dir pipx
|
||||
echo "${DEFAULT_UTILS}" | xargs -n 1 /tmp/pip-tmp/bin/pipx install --system-site-packages --pip-args '--no-cache-dir --force-reinstall'
|
||||
rm -rf /tmp/pip-tmp
|
||||
|
||||
updaterc "$(cat << EOF
|
||||
export PIPX_HOME="${PIPX_HOME}"
|
||||
export PIPX_BIN_DIR="${PIPX_BIN_DIR}"
|
||||
if [[ "\${PATH}" != *"\${PIPX_BIN_DIR}"* ]]; then export PATH="\${PATH}:\${PIPX_BIN_DIR}"; fi
|
||||
EOF
|
||||
)"
|
||||
updaterc "export PIPX_HOME=${PIPX_HOME}\nexport PIPX_BIN_DIR=${PIPX_BIN_DIR}\nexport PATH=\${PATH}:\${PIPX_BIN_DIR}"
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/ruby:${VARIANT}
|
|||
# [Option] Install Node.js
|
||||
ARG INSTALL_NODE="true"
|
||||
ARG NODE_VERSION="lts/*"
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
|
|
|
@ -24,7 +24,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# If in automatic mode, determine if a user already exists, if not use vscode
|
||||
|
@ -188,8 +188,7 @@ fi
|
|||
# .bashrc/.zshrc snippet
|
||||
RC_SNIPPET="$(cat << EOF
|
||||
export USER=\$(whoami)
|
||||
|
||||
export PATH=\$PATH:\$HOME/.local/bin
|
||||
if [[ "\${PATH}" != *"\$HOME/.local/bin"* ]]; then export PATH="\${PATH}:\$HOME/.local/bin"; fi
|
||||
EOF
|
||||
)"
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ fi
|
|||
|
||||
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
|
||||
rm -f /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\${PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
|
||||
chmod +x /etc/profile.d/00-restore-env.sh
|
||||
|
||||
# Determine the appropriate non-root user
|
||||
|
@ -76,45 +76,29 @@ if [ -d "${NVM_DIR}" ]; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# Run NVM installer as non-root if needed
|
||||
# Create nvm group, nvm dir, and set sticky bit
|
||||
if ! cat /etc/group | grep -e "^nvm:" > /dev/null 2>&1; then
|
||||
groupadd -r nvm
|
||||
fi
|
||||
usermod -a -G nvm ${USERNAME}
|
||||
umask 0002
|
||||
mkdir -p ${NVM_DIR}
|
||||
chown ${USERNAME} ${NVM_DIR}
|
||||
su ${USERNAME} -c "$(cat << EOF
|
||||
set -e
|
||||
|
||||
# Do not update profile - we'll do this manually
|
||||
export PROFILE=/dev/null
|
||||
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
EOF
|
||||
)" 2>&1
|
||||
|
||||
chown :nvm ${NVM_DIR}
|
||||
chmod g+s ${NVM_DIR}
|
||||
# Do not update profile - we'll do this later
|
||||
export PROFILE=/dev/null
|
||||
# Install nvm
|
||||
curl -so- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
|
||||
source ${NVM_DIR}/nvm.sh
|
||||
if [ "${NODE_VERSION}" != "" ]; then
|
||||
nvm alias default ${NODE_VERSION}
|
||||
fi
|
||||
nvm clear-cache
|
||||
# Update rc files
|
||||
if [ "${UPDATE_RC}" = "true" ]; then
|
||||
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc with NVM scripts..."
|
||||
(cat <<EOF
|
||||
export NVM_DIR="${NVM_DIR}"
|
||||
sudoIf()
|
||||
{
|
||||
if [ "\$(id -u)" -ne 0 ]; then
|
||||
sudo "\$@"
|
||||
else
|
||||
"\$@"
|
||||
fi
|
||||
}
|
||||
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
|
||||
if [ "\$(id -u)" -eq 0 ] || type sudo > /dev/null 2>&1; then
|
||||
echo "Fixing permissions of \"\$NVM_DIR\"..."
|
||||
sudoIf chown -R ${USERNAME}:root \$NVM_DIR
|
||||
else
|
||||
echo "Warning: NVM directory is not owned by ${USERNAME} and sudo is not installed. Unable to correct permissions."
|
||||
fi
|
||||
fi
|
||||
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
|
||||
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
|
||||
EOF
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче