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