[users] Improve explanation of other steps of adding a user
This commit is contained in:
parent
745dc9ad00
commit
dae84d3bb1
@ -161,29 +161,23 @@ CreateUserJob::exec()
|
||||
return pres.explainProcess( useradd, 10 /* bogus timeout */ );
|
||||
}
|
||||
|
||||
int ec = CalamaresUtils::System::instance()->
|
||||
targetEnvCall( { "usermod",
|
||||
"-aG",
|
||||
defaultGroups,
|
||||
m_userName } );
|
||||
if ( ec )
|
||||
return Calamares::JobResult::error( tr( "Cannot add user %1 to groups: %2." )
|
||||
.arg( m_userName )
|
||||
.arg( defaultGroups ),
|
||||
tr( "usermod terminated with error code %1." )
|
||||
.arg( ec ) );
|
||||
pres = CalamaresUtils::System::instance()->targetEnvCommand(
|
||||
{ "usermod", "-aG", defaultGroups, m_userName } );
|
||||
if ( pres.getExitCode() )
|
||||
{
|
||||
cError() << "usermod failed" << pres.getExitCode();
|
||||
return pres.explainProcess( "usermod", 10 );
|
||||
}
|
||||
|
||||
ec = CalamaresUtils::System::instance()->
|
||||
targetEnvCall( { "chown",
|
||||
"-R",
|
||||
QString( "%1:%2" ).arg( m_userName )
|
||||
.arg( m_userName ),
|
||||
QString( "/home/%1" ).arg( m_userName ) } );
|
||||
if ( ec )
|
||||
return Calamares::JobResult::error( tr( "Cannot set home directory ownership for user %1." )
|
||||
.arg( m_userName ),
|
||||
tr( "chown terminated with error code %1." )
|
||||
.arg( ec ) );
|
||||
QString userGroup = QString( "%1:%2" ).arg( m_userName ).arg( m_userName );
|
||||
QString homeDir = QString( "/home/%1" ).arg( m_userName );
|
||||
pres = CalamaresUtils::System::instance()->targetEnvCommand(
|
||||
{ "chown", "-R", userGroup, homeDir } );
|
||||
if ( pres.getExitCode() )
|
||||
{
|
||||
cError() << "chown failed" << pres.getExitCode();
|
||||
return pres.explainProcess( "chown", 10 );
|
||||
}
|
||||
|
||||
return Calamares::JobResult::ok();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user