aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamruddhi Khandale <skhandale@microsoft.com>2023-10-28 01:47:26 +0300
committerGitHub <noreply@github.com>2023-10-28 01:47:26 +0300
commit719901a1b4751d5d9864d9700f56b6ecf80cc4f4 (patch)
tree1d6df5c4c37423804087645bcfe75d8aa356f81a /src
parent4c2c9f7b95fcc160e275c1624cec02a9bba25bdb (diff)
[common-utils] Bug fix: zsh missing rc snippet (#736)feature_common-utils_2.3.0
* [common-utils] Bug fix: zsp missing rc snippet * condion rc snippet * fix bug * remove debugging step
Diffstat (limited to 'src')
-rw-r--r--src/common-utils/devcontainer-feature.json2
-rw-r--r--src/common-utils/main.sh7
2 files changed, 7 insertions, 2 deletions
diff --git a/src/common-utils/devcontainer-feature.json b/src/common-utils/devcontainer-feature.json
index 181e545..dc54e69 100644
--- a/src/common-utils/devcontainer-feature.json
+++ b/src/common-utils/devcontainer-feature.json
@@ -1,6 +1,6 @@
{
"id": "common-utils",
- "version": "2.2.0",
+ "version": "2.3.0",
"name": "Common Utilities",
"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.",
diff --git a/src/common-utils/main.sh b/src/common-utils/main.sh
index 7142246..d1a977f 100644
--- a/src/common-utils/main.sh
+++ b/src/common-utils/main.sh
@@ -421,6 +421,7 @@ fi
# Restore user .bashrc / .profile / .zshrc defaults from skeleton file if it doesn't exist or is empty
possible_rc_files=( ".bashrc" ".profile" )
[ "$INSTALL_OH_MY_ZSH_CONFIG" == "true" ] && possible_rc_files+=('.zshrc')
+[ "$INSTALL_ZSH" == "true" ] && possible_rc_files+=('.zprofile')
for rc_file in "${possible_rc_files[@]}"; do
if [ -f "/etc/skel/${rc_file}" ]; then
if [ ! -e "${user_home}/${rc_file}" ] || [ ! -s "${user_home}/${rc_file}" ]; then
@@ -456,13 +457,17 @@ 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"
+ fi
+
if [ "${ZSH_ALREADY_INSTALLED}" != "true" ]; then
if [ "${ADJUSTED_ID}" = "rhel" ]; then
global_rc_path="/etc/zshrc"
else
global_rc_path="/etc/zsh/zshrc"
fi
- cat "${FEATURE_DIR}/scripts/rc_snippet.sh" >> /etc/zshrc
+ cat "${FEATURE_DIR}/scripts/rc_snippet.sh" >> ${global_rc_path}
ZSH_ALREADY_INSTALLED="true"
fi