diff --git a/src/modules/preservefiles/PreserveFiles.cpp b/src/modules/preservefiles/PreserveFiles.cpp index 57c2c5422..8352e861d 100644 --- a/src/modules/preservefiles/PreserveFiles.cpp +++ b/src/modules/preservefiles/PreserveFiles.cpp @@ -157,26 +157,9 @@ PreserveFiles::exec() { if ( it.perm.isValid() ) { - auto s_p = CalamaresUtils::System::instance(); - - int r; - - r = s_p->targetEnvCall( QStringList { "chown", it.perm.username(), bare_dest } ); - if ( r ) - { - cWarning() << "Could not chown target" << bare_dest; - } - - r = s_p->targetEnvCall( QStringList { "chgrp", it.perm.group(), bare_dest } ); - if ( r ) - { - cWarning() << "Could not chgrp target" << bare_dest; - } - - r = s_p->targetEnvCall( QStringList { "chmod", it.perm.octal(), bare_dest } ); - if ( r ) + if ( !it.perm.apply( CalamaresUtils::System::instance()->targetPath( bare_dest ) ) ) { - cWarning() << "Could not chmod target" << bare_dest; + cWarning() << "Could not set attributes of" << bare_dest; } } diff --git a/src/modules/users/CreateUserJob.cpp b/src/modules/users/CreateUserJob.cpp index f0b1dca88..84a42437a 100644 --- a/src/modules/users/CreateUserJob.cpp +++ b/src/modules/users/CreateUserJob.cpp @@ -12,6 +12,7 @@ #include "JobQueue.h" #include "utils/CalamaresUtilsSystem.h" #include "utils/Logger.h" +#include "utils/Permissions.h" #include #include @@ -103,7 +104,7 @@ CreateUserJob::exec() if ( fileResult ) { - if ( QProcess::execute( "chmod", { "440", fileResult.path() } ) ) + if ( CalamaresUtils::Permissions::apply( fileResult.path(), 0440 ) ) { return Calamares::JobResult::error( tr( "Cannot chmod sudoers file." ) ); }