From 9cbfd200a1ee08a59610245b8f8b0764bf43427e Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 1 Oct 2019 16:01:10 +0200 Subject: [PATCH] [machineid] Keep the paths unsullied - keep the rootMountPoint and the path-with-random-data separate instead of concatenating them at the beginning. Then we can use the "clean" names also within the host system. --- src/modules/machineid/MachineIdJob.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/machineid/MachineIdJob.cpp b/src/modules/machineid/MachineIdJob.cpp index b8fc3334a..0edf8a4da 100644 --- a/src/modules/machineid/MachineIdJob.cpp +++ b/src/modules/machineid/MachineIdJob.cpp @@ -47,9 +47,9 @@ MachineIdJob::prettyName() const // might need to use a helper to remove the file static void -removeFile( const QString& fileName ) +removeFile( const QString& rootMountPoint, const QString& fileName ) { - QFile::remove( fileName ); + QFile::remove( rootMountPoint + fileName ); } Calamares::JobResult @@ -70,22 +70,22 @@ MachineIdJob::exec() Calamares::JobResult::InvalidConfiguration ); } - QString target_systemd_machineid_file = root + QStringLiteral( "/etc/machine-id" ); - QString target_dbus_machineid_file = root + QStringLiteral( "/var/lib/dbus/machine-id" ); - QString target_entropy_file = root + QStringLiteral( "/var/lib/urandom/random-seed" ); + QString target_systemd_machineid_file = QStringLiteral( "/etc/machine-id" ); + QString target_dbus_machineid_file = QStringLiteral( "/var/lib/dbus/machine-id" ); + QString target_entropy_file = QStringLiteral( "/var/lib/urandom/random-seed" ); // Clear existing files if ( m_entropy ) { - removeFile( target_entropy_file ); + removeFile( root, target_entropy_file ); } if ( m_dbus ) { - removeFile( target_dbus_machineid_file ); + removeFile( root, target_dbus_machineid_file ); } if ( m_systemd ) { - removeFile( target_systemd_machineid_file ); + removeFile( root, target_systemd_machineid_file ); } return Calamares::JobResult::ok();