shell-zsh: derive ZSH/ZDOTDIR from $TARGET_HOME unconditionally — ignore inherited $ZSH env var (omz exports it, which pinned paths to the old home e.g. /root while the chown step retargeted to the new user, causing 'insecure completion dirs' owned by the wrong user)

This commit is contained in:
mk 2026-07-28 06:16:45 +03:00
parent 94a0bac9f4
commit 435d66aad2

View File

@ -6,9 +6,13 @@ step_desc="zsh + oh-my-zsh + plugins, set default shell, ship config"
step_run="run_zsh"
# All paths resolve against the config TARGET (set by 05-create-user).
ZSH="${ZSH:-$TARGET_HOME/.oh-my-zsh}"
ZSH_CUSTOM="${ZSH_CUSTOM:-$ZSH/custom}"
ZDOTDIR_TARGET="${ZDOTDIR_TARGET:-$TARGET_HOME/.config/zsh}"
# NOTE: we deliberately do NOT honor an inherited $ZSH env var — oh-my-zsh exports
# ZSH when it loads, so a setup.sh run from an omz-equipped shell would otherwise
# pin these to the *old* home (e.g. /root) while the chown step retargets to the
# *new* user, mis-owning the wrong tree (the 'insecure completion dirs' bug).
ZSH="$TARGET_HOME/.oh-my-zsh"
ZSH_CUSTOM="$ZSH/custom"
ZDOTDIR_TARGET="$TARGET_HOME/.config/zsh"
run_zsh() {
log "installing zsh + oh-my-zsh"