Write timezone correctly.

This commit is contained in:
Teo Mrnjavac 2016-08-26 15:05:26 +02:00
parent 3a84c66829
commit f2a087c348

View File

@ -88,16 +88,17 @@ SetTimezoneJob::exec()
.arg( zoneinfoPath )
.arg( "/etc/localtime" ) );
QFile timezoneFile( "/etc/timezone" );
if ( timezoneFile.exists() )
{
if (!timezoneFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate))
QFile timezoneFile( gs->value( "rootMountPoint" ).toString() + "/etc/timezone" );
if ( !timezoneFile.open( QIODevice::WriteOnly |
QIODevice::Text |
QIODevice::Truncate ) )
return Calamares::JobResult::error( tr( "Cannot set timezone,"),
tr( "Cannot open /etc/timezone for writing"));
QTextStream out(&timezoneFile);
out << m_region << '/' << m_zone << "\n";
timezoneFile.close();
}
return Calamares::JobResult::ok();
}