[users] Pass the home permissions to useradd

This commit is contained in:
Adriaan de Groot 2024-09-11 18:00:37 +02:00
parent aa938285a4
commit 8c8bb7a3df

View File

@ -46,7 +46,7 @@ CreateUserJob::prettyStatusMessage() const
}
static Calamares::JobResult
createUser( const QString& loginName, const QString& fullName, const QString& shell )
createUser( const QString& loginName, const QString& fullName, const QString& shell, int umask )
{
QStringList useraddCommand;
#ifdef __FreeBSD__
@ -67,6 +67,10 @@ createUser( const QString& loginName, const QString& fullName, const QString& sh
useraddCommand << "-s" << shell;
}
useraddCommand << "-c" << fullName;
if ( umask >= 0 )
{
useraddCommand << "-K" << ( QStringLiteral( "UMASK=" ) + QString::number( umask, 8 ) );
}
useraddCommand << loginName;
#endif
@ -136,7 +140,8 @@ CreateUserJob::exec()
m_status = tr( "Creating user %1…", "@status" ).arg( m_config->loginName() );
emit progress( 0.5 );
auto useraddResult = createUser( m_config->loginName(), m_config->fullName(), m_config->userShell() );
auto useraddResult
= createUser( m_config->loginName(), m_config->fullName(), m_config->userShell(), m_config->homeUMask() );
if ( !useraddResult )
{
return useraddResult;