From efa5fd835cccd573e8a056367fa7fb246845d34d Mon Sep 17 00:00:00 2001 From: imbytecat Date: Wed, 25 Mar 2026 16:19:55 +0800 Subject: [PATCH] =?UTF-8?q?feat(modules):=20=E6=B7=BB=E5=8A=A0=20zsh=20?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=20shell=20=E8=87=AA=E5=8A=A8=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/zsh/module.yaml | 2 ++ scripts/set-default-shell.sh | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100755 scripts/set-default-shell.sh 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