[users] Improve explanation when useradd fails

This commit is contained in:
Adriaan de Groot 2018-05-23 07:03:59 -04:00
parent 0d24c1db6c
commit 01ff1efc5d

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
* Copyright 2018, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -153,14 +154,14 @@ CreateUserJob::exec()
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 ),
tr( "useradd terminated with error code %1." )
.arg( ec ) );
auto pres = CalamaresUtils::System::instance()->targetEnvCommand( useradd );
if ( pres.getExitCode() )
{
cError() << "useradd failed" << pres.getExitCode();
return pres.explainProcess( useradd, 10 /* bogus timeout */ );
}
ec = CalamaresUtils::System::instance()->
int ec = CalamaresUtils::System::instance()->
targetEnvCall( { "usermod",
"-aG",
defaultGroups,