Add initialPassword and initialHashedPassword options

These are like password and hashedPassword, except that they only
apply when the user is initially created.
This commit is contained in:
Eelco Dolstra
2014-11-03 12:32:19 +01:00
parent cb981b9dad
commit 1b53a3fcb7
2 changed files with 48 additions and 10 deletions
@@ -169,6 +169,12 @@ foreach my $u (@{$spec->{users}}) {
} else {
$u->{uid} = allocUid($u->{isSystemUser}) if !defined $u->{uid};
if (defined $u->{initialPassword}) {
$u->{hashedPassword} = hashPassword($u->{initialPassword});
} 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};