From 38f32bfd568e9abcd2ed148c9544f212aa3f6214 Mon Sep 17 00:00:00 2001 From: Daniel Hillenbrand Date: Tue, 19 Aug 2014 20:39:26 +0200 Subject: [PATCH] locale: make sure /etc/localtime doesn't exist If /etc/localtime exists in source image, creating a new symlink will fail and prevent the installer from doing it's job. --- src/modules/locale/SetTimezoneJob.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/locale/SetTimezoneJob.cpp b/src/modules/locale/SetTimezoneJob.cpp index 5ae908446..a4529f44d 100644 --- a/src/modules/locale/SetTimezoneJob.cpp +++ b/src/modules/locale/SetTimezoneJob.cpp @@ -45,6 +45,7 @@ SetTimezoneJob::prettyName() const Calamares::JobResult SetTimezoneJob::exec() { + QString localtimeSlink( "/etc/localtime" ); QString zoneinfoPath( "/usr/share/zoneinfo" ); zoneinfoPath.append( QDir::separator() + m_region ); zoneinfoPath.append( QDir::separator() + m_zone ); @@ -55,10 +56,15 @@ SetTimezoneJob::exec() return Calamares::JobResult::error( tr( "Cannot access selected timezone path." ), tr( "Bad path: %1" ).arg( zoneFile.absolutePath() ) ); + // Make sure /etc/localtime doesn't exist, otherwise symlinking will fail + CalamaresUtils::chrootCall( { "rm", + "-f", + localtimeSlink } ); + int ec = CalamaresUtils::chrootCall( { "ln", "-s", zoneinfoPath, - "/etc/localtime" } ); + localtimeSlink } ); if ( ec ) return Calamares::JobResult::error( tr( "Cannot set timezone." ), tr( "Link creation failed, target: %1; link name: %2" )