From aae9de7ebc96170ddbaf8996d8ee2289176000aa Mon Sep 17 00:00:00 2001 From: Jacob Woffenden Date: Fri, 9 Dec 2022 22:08:20 +0000 Subject: Change default shell if installing ZSH (#325) * Added new option to configure zsh as default shell Added test scenario Bumped feature version * Update test/common-utils/scenarios.json Co-authored-by: Samruddhi Khandale * Update src/common-utils/devcontainer-feature.json Co-authored-by: Samruddhi Khandale * Update test/common-utils/configure_zsh_as_default_shell.sh Co-authored-by: Samruddhi Khandale Co-authored-by: Samruddhi Khandale --- src/common-utils/install.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/common-utils/install.sh') diff --git a/src/common-utils/install.sh b/src/common-utils/install.sh index 5530b96..eb0e624 100755 --- a/src/common-utils/install.sh +++ b/src/common-utils/install.sh @@ -13,6 +13,7 @@ set -e rm -rf /var/lib/apt/lists/* INSTALL_ZSH="${INSTALLZSH:-"true"}" +CONFIGURE_ZSH_AS_DEFAULT_SHELL="${CONFIGUREZSHASDEFAULTSHELL:-"false"}" INSTALL_OH_MY_ZSH="${INSTALLOHMYZSH:-"true"}" UPGRADE_PACKAGES="${UPGRADEPACKAGES:-"true"}" USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}" @@ -378,6 +379,12 @@ if [ "${INSTALL_ZSH}" = "true" ]; then ZSH_ALREADY_INSTALLED="true" fi + # Change shell of determined user + if [[ "${CONFIGURE_ZSH_AS_DEFAULT_SHELL}" == "true" ]]; then + chsh --shell /bin/zsh ${USERNAME} + fi + + # Adapted, simplified inline Oh My Zsh! install steps that adds, defaults to a codespaces theme. # See https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh for official script. oh_my_install_dir="${user_rc_path}/.oh-my-zsh" -- cgit v1.2.3