From a98742c32c5a16b8f92ac8dff7833f48cbfcb389 Mon Sep 17 00:00:00 2001 From: Rohan Garg Date: Fri, 7 Aug 2015 15:38:31 +0200 Subject: [PATCH] Use timedatectl provided by systemd to set the time on the target Use tools provided by systemd to set the time and fall back to manually doing it via linking /etc/localtime --- src/modules/locale/SetTimezoneJob.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/modules/locale/SetTimezoneJob.cpp b/src/modules/locale/SetTimezoneJob.cpp index 1602946a3..485e6a96d 100644 --- a/src/modules/locale/SetTimezoneJob.cpp +++ b/src/modules/locale/SetTimezoneJob.cpp @@ -1,6 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014, Teo Mrnjavac + * Copyright 2015, Rohan Garg * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,6 +46,14 @@ SetTimezoneJob::prettyName() const Calamares::JobResult SetTimezoneJob::exec() { + int ec = CalamaresUtils::System::instance()-> + targetEnvCall( { "timedatectl", + "set-timezone", + m_region + '/' + m_zone } ); + + if ( !ec ) + return Calamares::JobResult::ok(); + QString localtimeSlink( "/etc/localtime" ); QString zoneinfoPath( "/usr/share/zoneinfo" ); zoneinfoPath.append( QDir::separator() + m_region ); @@ -62,7 +71,7 @@ SetTimezoneJob::exec() "-f", localtimeSlink } ); - int ec = CalamaresUtils::System::instance()-> + ec = CalamaresUtils::System::instance()-> targetEnvCall( { "ln", "-s", zoneinfoPath,