From bcab8b2bfe60ec2b58e7813eb6df2869e80892d1 Mon Sep 17 00:00:00 2001 From: Kevin Kofler Date: Fri, 15 Jan 2016 02:44:27 +0100 Subject: [PATCH] [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. --- src/modules/locale/SetTimezoneJob.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/modules/locale/SetTimezoneJob.cpp b/src/modules/locale/SetTimezoneJob.cpp index c09abcb8c..c2fba9151 100644 --- a/src/modules/locale/SetTimezoneJob.cpp +++ b/src/modules/locale/SetTimezoneJob.cpp @@ -21,6 +21,7 @@ #include "JobQueue.h" #include "GlobalStorage.h" +#include "Settings.h" #include "utils/Logger.h" #include "utils/CalamaresUtilsSystem.h" @@ -46,13 +47,18 @@ SetTimezoneJob::prettyName() const Calamares::JobResult SetTimezoneJob::exec() { - int ec = CalamaresUtils::System::instance()-> - targetEnvCall( { "timedatectl", - "set-timezone", - m_region + '/' + m_zone } ); + // do not call timedatectl in a chroot, it is not safe (timedatectl talks + // to a running timedated over D-Bus), and we have code that works + if ( !Calamares::Settings::instance()->doChroot() ) + { + int ec = CalamaresUtils::System::instance()-> + targetEnvCall( { "timedatectl", + "set-timezone", + m_region + '/' + m_zone } ); - if ( !ec ) - return Calamares::JobResult::ok(); + if ( !ec ) + return Calamares::JobResult::ok(); + } QString localtimeSlink( "/etc/localtime" ); QString zoneinfoPath( "/usr/share/zoneinfo" ); @@ -71,7 +77,7 @@ SetTimezoneJob::exec() "-f", localtimeSlink } ); - ec = CalamaresUtils::System::instance()-> + int ec = CalamaresUtils::System::instance()-> targetEnvCall( { "ln", "-s", zoneinfoPath,