diff options
| author | Michael Hoang <enzime@users.noreply.github.com> | 2024-11-05 01:52:34 +1100 |
|---|---|---|
| committer | Michael Hoang <enzime@users.noreply.github.com> | 2024-11-07 18:17:34 +1100 |
| commit | 9cd45289c9200b5adf29ed4faaf8e00a8c06da9c (patch) | |
| tree | 77f193b46475436cc954207ec2212b0feac47663 /pkgs | |
| parent | 1b5fa6be405425ae5040d68c4a3bfff14fdf2100 (diff) | |
uninstaller: reset any shells pointing to `/run/current-system/sw/bin`
Diffstat (limited to 'pkgs')
| -rw-r--r-- | pkgs/darwin-uninstaller/configuration.nix | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/darwin-uninstaller/configuration.nix b/pkgs/darwin-uninstaller/configuration.nix index 0bdccb9..a2283d8 100644 --- a/pkgs/darwin-uninstaller/configuration.nix +++ b/pkgs/darwin-uninstaller/configuration.nix @@ -46,5 +46,15 @@ with lib; echo >&2 fi fi + + # grep will return 1 when no lines matched which makes this line fail with `set -eo pipefail` + dscl . -list /Users UserShell | { grep "\s/run/" || true; } | awk '{print $1}' | while read -r user; do + shell=$(dscl . -read /Users/"$user" UserShell) + if [[ "$shell" != */bin/zsh ]]; then + echo >&2 "warning: changing $user's shell from $shell to /bin/zsh" + fi + + dscl . -create /Users/"$user" UserShell /bin/zsh + done ''; } |
