1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-06 16:57:08 +00:00

users: use launchctl managername to determine session type

Seems like this should be more robust, and it will work even
after the activation script purifies its environment. Apparently
it may treat `tmux` sessions like SSH ones, which may have
something to do with `reattach-to-user-namespace`/`pam_reattach`; see
<https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/issues/78#issuecomment-1074543831>.
(My hope is that `pam_reattach` does the right thing here, but I
haven’t tested.)
This commit is contained in:
Emily 2025-02-03 21:47:09 +00:00
parent 3f6f512406
commit d634e28f67

View file

@ -147,7 +147,7 @@ in
homeDirectory=''${homeDirectory#NFSHomeDirectory: } homeDirectory=''${homeDirectory#NFSHomeDirectory: }
if ! sudo dscl . -change /Users/nobody NFSHomeDirectory "$homeDirectory" "$homeDirectory" &> /dev/null; then if ! sudo dscl . -change /Users/nobody NFSHomeDirectory "$homeDirectory" "$homeDirectory" &> /dev/null; then
if [[ -n "$SSH_CONNECTION" ]]; then if [[ "$(launchctl managername)" != Aqua ]]; then
printf >&2 '\e[1;31merror: users cannot be %s over SSH without Full Disk Access, aborting activation\e[0m\n' "$2" printf >&2 '\e[1;31merror: users cannot be %s over SSH without Full Disk Access, aborting activation\e[0m\n' "$2"
printf >&2 'The user %s could not be %s as `darwin-rebuild` was not executed with Full Disk Access over SSH.\n' "$1" "$2" printf >&2 'The user %s could not be %s as `darwin-rebuild` was not executed with Full Disk Access over SSH.\n' "$1" "$2"
printf >&2 'You can either:\n' printf >&2 'You can either:\n'