diff options
author | maxine <35892750+amaxine@users.noreply.github.com> | 2024-03-08 09:54:44 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-08 09:54:44 +0000 |
commit | b587c07865dcf74940653fc237a273adb6388a1f (patch) | |
tree | 1fe02829a6dadfcf2541084191b32f2ba05e12fe /nixos/modules | |
parent | e65193c59a67e5c3cce061ad86786701c7ff962a (diff) | |
parent | 8558d7b1ceb604b4e91b17281f2efbbad5ba47a1 (diff) | |
download | nixlib-b587c07865dcf74940653fc237a273adb6388a1f.tar nixlib-b587c07865dcf74940653fc237a273adb6388a1f.tar.gz nixlib-b587c07865dcf74940653fc237a273adb6388a1f.tar.bz2 nixlib-b587c07865dcf74940653fc237a273adb6388a1f.tar.lz nixlib-b587c07865dcf74940653fc237a273adb6388a1f.tar.xz nixlib-b587c07865dcf74940653fc237a273adb6388a1f.tar.zst nixlib-b587c07865dcf74940653fc237a273adb6388a1f.zip |
Merge pull request #292847 from jwillikers/linger-hotfix
Fix the update-lingering activation script to not fail when a user is removed
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/config/users-groups.nix | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix index dd34771c0b42..02cd1a17f538 100644 --- a/nixos/modules/config/users-groups.nix +++ b/nixos/modules/config/users-groups.nix @@ -704,6 +704,11 @@ in { in stringAfter [ "users" ] '' if [ -e ${lingerDir} ] ; then cd ${lingerDir} + for user in ${lingerDir}/*; do + if ! id "$user" >/dev/null 2>&1; then + rm --force -- "$user" + fi + done ls ${lingerDir} | sort | comm -3 -1 ${lingeringUsersFile} - | xargs -r ${pkgs.systemd}/bin/loginctl disable-linger ls ${lingerDir} | sort | comm -3 -2 ${lingeringUsersFile} - | xargs -r ${pkgs.systemd}/bin/loginctl enable-linger fi |