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.
This commit is contained in:
parent
c97251d741
commit
38f32bfd56
@ -45,6 +45,7 @@ SetTimezoneJob::prettyName() const
|
|||||||
Calamares::JobResult
|
Calamares::JobResult
|
||||||
SetTimezoneJob::exec()
|
SetTimezoneJob::exec()
|
||||||
{
|
{
|
||||||
|
QString localtimeSlink( "/etc/localtime" );
|
||||||
QString zoneinfoPath( "/usr/share/zoneinfo" );
|
QString zoneinfoPath( "/usr/share/zoneinfo" );
|
||||||
zoneinfoPath.append( QDir::separator() + m_region );
|
zoneinfoPath.append( QDir::separator() + m_region );
|
||||||
zoneinfoPath.append( QDir::separator() + m_zone );
|
zoneinfoPath.append( QDir::separator() + m_zone );
|
||||||
@ -55,10 +56,15 @@ SetTimezoneJob::exec()
|
|||||||
return Calamares::JobResult::error( tr( "Cannot access selected timezone path." ),
|
return Calamares::JobResult::error( tr( "Cannot access selected timezone path." ),
|
||||||
tr( "Bad path: %1" ).arg( zoneFile.absolutePath() ) );
|
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",
|
int ec = CalamaresUtils::chrootCall( { "ln",
|
||||||
"-s",
|
"-s",
|
||||||
zoneinfoPath,
|
zoneinfoPath,
|
||||||
"/etc/localtime" } );
|
localtimeSlink } );
|
||||||
if ( ec )
|
if ( ec )
|
||||||
return Calamares::JobResult::error( tr( "Cannot set timezone." ),
|
return Calamares::JobResult::error( tr( "Cannot set timezone." ),
|
||||||
tr( "Link creation failed, target: %1; link name: %2" )
|
tr( "Link creation failed, target: %1; link name: %2" )
|
||||||
|
Loading…
Reference in New Issue
Block a user