fix(shell-setup): set default shell without a password prompt

A bare `chsh -s /usr/bin/zsh` authenticates the calling user through PAM and
prompts "Password:", stalling an unattended install right after oh-my-zsh.
Run it via `sudo chsh ... "$(whoami)"` so it uses the passwordless setup sudo
rule and completes silently (also more reliable: it targets the account
explicitly rather than relying on the ambient user).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R5kHioUMK3mtf2eiLEozCM
main
Amir Alexander Abdelbaki 2026-06-27 02:13:32 +02:00
parent 9a711013ce
commit 6251eb8218
1 changed files with 6 additions and 2 deletions

View File

@ -260,11 +260,15 @@ fi
# ── Default shell change ─────────────────────────────────────────────────────── # ── Default shell change ───────────────────────────────────────────────────────
# WHY: New login shells still default to bash unless explicitly changed. # WHY: New login shells still default to bash unless explicitly changed.
# `chsh` writes the new shell to /etc/passwd for this user. # This writes the new shell to /etc/passwd for this user.
# HOW: Compare current $SHELL to /usr/bin/zsh and change if different. # HOW: Compare current $SHELL to /usr/bin/zsh and change if different.
# Use `sudo chsh` (not bare `chsh`): a bare chsh authenticates the calling
# user via PAM and prompts "Password:", which hangs an unattended install.
# Routing through sudo uses the passwordless setup rule, so it runs silently;
# `whoami` targets the right account whether run as the user or via runuser.
if [ "$SHELL" != "/usr/bin/zsh" ]; then if [ "$SHELL" != "/usr/bin/zsh" ]; then
log "Setting zsh as default shell..." log "Setting zsh as default shell..."
chsh -s /usr/bin/zsh sudo chsh -s /usr/bin/zsh "$(whoami)"
else else
skip "zsh is already the default shell." skip "zsh is already the default shell."
fi fi