users: realpath home dirs before comparison (#1803)

This commit is contained in:
Sam 2026-06-17 16:21:08 +00:00 committed by GitHub
commit ee20edc445
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -203,7 +203,9 @@ in
else else
homeDirectory=$(dscl . -read ${dsclUser} NFSHomeDirectory) homeDirectory=$(dscl . -read ${dsclUser} NFSHomeDirectory)
homeDirectory=''${homeDirectory#NFSHomeDirectory: } homeDirectory=''${homeDirectory#NFSHomeDirectory: }
if [[ ${escapeShellArg v.home} != "$homeDirectory" ]]; then configuredHomeDirectory=$(realpath ${escapeShellArg v.home})
homeDirectory=$(realpath "$homeDirectory")
if [[ "$configuredHomeDirectory" != "$homeDirectory" ]]; then
printf >&2 '\e[1;31merror: config contains the wrong home directory for %s, aborting activation\e[0m\n' ${name} printf >&2 '\e[1;31merror: config contains the wrong home directory for %s, aborting activation\e[0m\n' ${name}
printf >&2 'nix-darwin does not support changing the home directory of existing users.\n' printf >&2 'nix-darwin does not support changing the home directory of existing users.\n'
printf >&2 '\n' printf >&2 '\n'