diff --git a/modules/zsh/module.yaml b/modules/zsh/module.yaml index 12cee84..a7bdbc8 100644 --- a/modules/zsh/module.yaml +++ b/modules/zsh/module.yaml @@ -3,3 +3,5 @@ description: Zsh 及插件 dotfiles: - source: dotfiles/.zshrc target: ~/.zshrc +post_install_hook: scripts/set-default-shell.sh +hook_behavior: once diff --git a/scripts/set-default-shell.sh b/scripts/set-default-shell.sh new file mode 100755 index 0000000..412db3d --- /dev/null +++ b/scripts/set-default-shell.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -euo pipefail + +if [ "$SHELL" != "$(which zsh)" ]; then + echo "==> 设置默认 shell 为 zsh..." + sudo chsh -s "$(which zsh)" "$USER" + echo "✓ 默认 shell 已设置为 zsh(重新登录后生效)" +else + echo "默认 shell 已经是 zsh" +fi