[users] Factor out command-line to useradd

- This is prep-work for #964, which was caused by #955
 - Original assumption was that distro's would have a working
   useradd configuration; @abucodonosor already pointed out that
   this was probably not the case, but I ignored that.
This commit is contained in:
Adriaan de Groot 2018-05-22 11:45:39 -04:00
parent 6aa5be192b
commit 3a59574128

View File

@ -146,13 +146,12 @@ CreateUserJob::exec()
}
}
int ec = CalamaresUtils::System::instance()->
targetEnvCall( { "useradd",
"-m",
"-U",
"-c",
m_fullName,
m_userName } );
QStringList useradd{ "useradd", "-m", "-U" };
// TODO: shell-settings
useradd << "-c" << m_fullName;
useradd << m_userName;
int ec = CalamaresUtils::System::instance()->targetEnvCall( useradd );
if ( ec )
return Calamares::JobResult::error( tr( "Cannot create user %1." )
.arg( m_userName ),