docs(setup): use ~/.bashrc hand-off instead of chsh for zsh switch #221
Reference in New Issue
Block a user
Delete Branch "docs/setup-chsh-bashrc-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Follow-up fix on #220. The corp infra locks the default shell at user-provisioning time on the dev VM (
10.100.201.21) —chshis denied at the PAM level, so thesudo chsh -sblock in20-zsh.shfails on every fresh VM.Switch to the
~/.bashrcexec-zsh hand-off — the same proven pattern used in the legacy02-wsl-terminal-setup.md. UX-identical for the dev, zero infra escalation required.What lands
docs/setup/scripts/20-zsh.shsudo chsh -sblock. Append a guardedexec zsh -lblock to~/.bashrcinstead, marked with a managed-by comment for idempotency on re-runs.docs/setup/01-dev-debian-vm-setup.md20-zsh.shupdated — "set as default shell" → "~/.bashrc(exec zsh on interactive shells —chshis blocked on the corp VM)".docs/setup/README.mdThe hand-off block
Two safety nets in the block:
case $- in *i*)— only runs the hand-off when the shell flag set containsi(interactive).scp/rsync/ non-interactive ssh executions go through bash and are not hijacked.[ -z "${ZSH_VERSION-}" ]—ZSH_VERSIONis set by zsh itself; if it's already set we're already in zsh and a re-exec would loop.Test plan
20-zsh.shon a fresh state: bash, no existing~/.bashrczsh hand-off → script exits withoutchsherror,~/.bashrcgets the block appended,exit+ reconnect lands in zsh.20-zsh.sh→ reports↪ skip zsh hand-off already in ~/.bashrc(idempotency).scp some-file vm-dev:/tmp/from the workstation still works (non-interactive bash not hijacked).pnpm exec prettier --checkclean on the touched markdown files.bash -n docs/setup/scripts/20-zsh.sh(syntax check) clean.Why not amend #220
#220 has already merged. Squash-merge collapsed it to
8a04540on main; a force-push to amend would rewrite that commit and break anyone who's pulled it. The fix lands as a separate commit on the same setup-doc family.