desktop_login: use chpasswd not passwd to set user password

This allows us to use assert_script_run, and be more reliable.
Same approach used in _do_install_and_reboot postinstall stuff.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2020-11-12 10:26:10 -08:00
parent 9392c66b45
commit 24c46489a2

View File

@ -29,9 +29,7 @@ sub adduser {
assert_script_run "useradd -c '$name' $login"; assert_script_run "useradd -c '$name' $login";
if ($password ne "askuser") { if ($password ne "askuser") {
# If we want to create a user with a defined password. # If we want to create a user with a defined password.
type_very_safely "passwd $login\n"; assert_script_run "echo '$login:$password' | chpasswd";
type_password $password;
type_password $password;
} }
else { else {
# If we want to create a user without a password, # If we want to create a user without a password,