Unverified Commit 0668db5e authored by naturedamends's avatar naturedamends Committed by GitHub

Commonutils: chown: cannot access '/home/vscode/.zshrc': No such file or directory (#662)

* Update main.sh

* Update devcontainer-feature.json

* Test install as non root user.

---------
Co-authored-by: 's avatarSamruddhi Khandale <skhandale@microsoft.com>
parent 0cf690ee
{ {
"id": "common-utils", "id": "common-utils",
"version": "2.1.1", "version": "2.1.2",
"name": "Common Utilities", "name": "Common Utilities",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils",
"description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.", "description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.",
......
...@@ -500,7 +500,7 @@ if [ "${INSTALL_ZSH}" = "true" ]; then ...@@ -500,7 +500,7 @@ if [ "${INSTALL_ZSH}" = "true" ]; then
copy_to_user_files=("${oh_my_install_dir}") copy_to_user_files=("${oh_my_install_dir}")
[ -f "$user_rc_file" ] && copy_to_user_files+=("$user_rc_file") [ -f "$user_rc_file" ] && copy_to_user_files+=("$user_rc_file")
cp -rf "${copy_to_user_files[@]}" /root cp -rf "${copy_to_user_files[@]}" /root
chown -R ${USERNAME}:${group_name} "${oh_my_install_dir}" "${user_rc_file}" chown -R ${USERNAME}:${group_name} "${copy_to_user_files[@]}"
fi fi
fi fi
fi fi
......
#!/bin/bash
set -e
# Optional: Import test library
source dev-container-features-test-lib
# Definition specific tests
check "default-zsh-with-no-zshrc" bash -c "[ ! -e ~/.zshrc ]"
# Report result
reportResults
...@@ -4,12 +4,11 @@ set -e ...@@ -4,12 +4,11 @@ set -e
# Optional: Import test library # Optional: Import test library
source dev-container-features-test-lib source dev-container-features-test-lib
# Definition specific tests # Definition specific tests
function file_not_overridden() { function file_not_overridden() {
cat ~/.zshrc | grep 'alias fnomockalias=' | grep testingmock cat $1 | grep 'alias fnomockalias=' | grep testingmock
} }
check "default-zsh-with-no-zshrc" file_not_overridden check "default-zsh-with-no-zshrc" file_not_overridden /home/devcontainer/.zshrc
# Report result # Report result
reportResults reportResults
...@@ -115,10 +115,20 @@ ...@@ -115,10 +115,20 @@
} }
} }
}, },
"configure_zsh_no_template": { "configure_zsh_no_template_second_step": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu", "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"postCreateCommand": "echo alias fnomockalias=testingmock >> /root/.zshrc", "postCreateCommand": "echo alias fnomockalias=testingmock >> /home/devcontainer/.zshrc",
"remoteUser": "root", "remoteUser": "devcontainer",
"features": {
"common-utils": {
"installZsh": true,
"installOhMyZshConfig": false
}
}
},
"configure_zsh_no_template_first_step": {
"image": "debian:bullseye",
"remoteUser": "devcontainer",
"features": { "features": {
"common-utils": { "common-utils": {
"installZsh": true, "installZsh": true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment