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
|
||||
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" )
|
||||
|
Loading…
Reference in New Issue
Block a user