diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-02-24 11:57:03 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-02-24 11:57:38 +0100 |
commit | 16cf3ee9da57738899859a9031ba276061a7999f (patch) | |
tree | 806531a433fcde5167d2d1ddfc505badf8426d04 /nixos/modules/config | |
parent | 31e4ce5e03f33cc93cf2048a9653162493b9f9c3 (diff) | |
download | nixpkgs-16cf3ee9da57738899859a9031ba276061a7999f.tar nixpkgs-16cf3ee9da57738899859a9031ba276061a7999f.tar.gz nixpkgs-16cf3ee9da57738899859a9031ba276061a7999f.tar.bz2 nixpkgs-16cf3ee9da57738899859a9031ba276061a7999f.tar.lz nixpkgs-16cf3ee9da57738899859a9031ba276061a7999f.tar.xz nixpkgs-16cf3ee9da57738899859a9031ba276061a7999f.tar.zst nixpkgs-16cf3ee9da57738899859a9031ba276061a7999f.zip |
Ensure that the home directory exists even if the user already exists
Diffstat (limited to 'nixos/modules/config')
-rw-r--r-- | nixos/modules/config/update-users-groups.pl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/nixos/modules/config/update-users-groups.pl b/nixos/modules/config/update-users-groups.pl index d35ecb754bd..de73de91629 100644 --- a/nixos/modules/config/update-users-groups.pl +++ b/nixos/modules/config/update-users-groups.pl @@ -174,12 +174,12 @@ foreach my $u (@{$spec->{users}}) { } elsif (defined $u->{initialHashedPassword}) { $u->{hashedPassword} = $u->{initialHashedPassword}; } + } - # Create a home directory. - if ($u->{createHome}) { - make_path($u->{home}, { mode => 0700 }) if ! -e $u->{home}; - chown $u->{uid}, $u->{gid}, $u->{home}; - } + # Create a home directory. + if ($u->{createHome} && ! -e $u->{home}) { + make_path($u->{home}, { mode => 0700 }) if ! -e $u->{home}; + chown $u->{uid}, $u->{gid}, $u->{home}; } if (defined $u->{passwordFile}) { |