[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()-> QStringList useradd{ "useradd", "-m", "-U" };
targetEnvCall( { "useradd", // TODO: shell-settings
"-m", useradd << "-c" << m_fullName;
"-U", useradd << m_userName;
"-c",
m_fullName, int ec = CalamaresUtils::System::instance()->targetEnvCall( useradd );
m_userName } );
if ( ec ) if ( ec )
return Calamares::JobResult::error( tr( "Cannot create user %1." ) return Calamares::JobResult::error( tr( "Cannot create user %1." )
.arg( m_userName ), .arg( m_userName ),