[locale] Do not call timedatectl in a chroot, it is not safe
(timedatectl talks to a running timedated over D-Bus.) And we already have code that works in a chroot below.
This commit is contained in:
parent
2dfa0944c3
commit
bcab8b2bfe
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
|
#include "Settings.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/CalamaresUtilsSystem.h"
|
#include "utils/CalamaresUtilsSystem.h"
|
||||||
|
|
||||||
@ -46,13 +47,18 @@ SetTimezoneJob::prettyName() const
|
|||||||
Calamares::JobResult
|
Calamares::JobResult
|
||||||
SetTimezoneJob::exec()
|
SetTimezoneJob::exec()
|
||||||
{
|
{
|
||||||
int ec = CalamaresUtils::System::instance()->
|
// do not call timedatectl in a chroot, it is not safe (timedatectl talks
|
||||||
targetEnvCall( { "timedatectl",
|
// to a running timedated over D-Bus), and we have code that works
|
||||||
"set-timezone",
|
if ( !Calamares::Settings::instance()->doChroot() )
|
||||||
m_region + '/' + m_zone } );
|
{
|
||||||
|
int ec = CalamaresUtils::System::instance()->
|
||||||
|
targetEnvCall( { "timedatectl",
|
||||||
|
"set-timezone",
|
||||||
|
m_region + '/' + m_zone } );
|
||||||
|
|
||||||
if ( !ec )
|
if ( !ec )
|
||||||
return Calamares::JobResult::ok();
|
return Calamares::JobResult::ok();
|
||||||
|
}
|
||||||
|
|
||||||
QString localtimeSlink( "/etc/localtime" );
|
QString localtimeSlink( "/etc/localtime" );
|
||||||
QString zoneinfoPath( "/usr/share/zoneinfo" );
|
QString zoneinfoPath( "/usr/share/zoneinfo" );
|
||||||
@ -71,7 +77,7 @@ SetTimezoneJob::exec()
|
|||||||
"-f",
|
"-f",
|
||||||
localtimeSlink } );
|
localtimeSlink } );
|
||||||
|
|
||||||
ec = CalamaresUtils::System::instance()->
|
int ec = CalamaresUtils::System::instance()->
|
||||||
targetEnvCall( { "ln",
|
targetEnvCall( { "ln",
|
||||||
"-s",
|
"-s",
|
||||||
zoneinfoPath,
|
zoneinfoPath,
|
||||||
|
Loading…
Reference in New Issue
Block a user