aboutsummaryrefslogtreecommitdiff
path: root/src/common-utils/main.sh
diff options
context:
space:
mode:
authorJosh Spicer <joshspicer@github.com>2023-12-07 21:49:18 +0300
committerGitHub <noreply@github.com>2023-12-07 21:49:18 +0300
commit3ea4d6bbd7864bcf7b5a91fdeeb66e4f5a6f46c0 (patch)
tree79585189b1dc389a703c8b9a1a9553a2fcd4c8c6 /src/common-utils/main.sh
parentdef3a41f576ceffebdff8266b41b8589a2512ac2 (diff)
Fix `.zprofile` is owned by root (#775)feature_common-utils_2.3.1
* revert behavior of sourcing .profile in .zprofile https://github.com/devcontainers/features/pull/736/files#diff-3e71c0a0669a0410f7dd0d8f2b83f3b6bf6b525d3eabd354f19f32822da669fcR460-R463 * add test * increment version * create empty .zprofile is not present, and fix test * temporarily add back .profile to .zprofile (only if file did not exist)
Diffstat (limited to 'src/common-utils/main.sh')
-rw-r--r--src/common-utils/main.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/common-utils/main.sh b/src/common-utils/main.sh
index a291f98..26f0a75 100644
--- a/src/common-utils/main.sh
+++ b/src/common-utils/main.sh
@@ -459,8 +459,10 @@ fi
# Optionally configure zsh and Oh My Zsh!
if [ "${INSTALL_ZSH}" = "true" ]; then
- if [ ! -f "${user_home}/.zprofile" ] || ! grep -Fxq 'source $HOME/.profile' "${user_home}/.zprofile" ; then
- echo 'source $HOME/.profile' >> "${user_home}/.zprofile"
+ if [ ! -f "${user_home}/.zprofile" ]; then
+ touch "${user_home}/.zprofile"
+ echo 'source $HOME/.profile' >> "${user_home}/.zprofile" # TODO: Reconsider adding '.profile' to '.zprofile'
+ chown ${USERNAME}:${group_name} "${user_home}/.zprofile"
fi
if [ "${ZSH_ALREADY_INSTALLED}" != "true" ]; then