* @brief Reads the GNU/Linux machine id from the dbus or systemd store. */
| 65 | * @brief Reads the GNU/Linux machine id from the dbus or systemd store. |
| 66 | */ |
| 67 | static QString readLinuxId(bool& complete) |
| 68 | { |
| 69 | QProcess process; |
| 70 | const auto catTool = resolveSystemTool({"/bin/cat", "/usr/bin/cat"}, "cat"); |
| 71 | process.start(catTool, {"/var/lib/dbus/machine-id"}); |
| 72 | awaitTool(process); |
| 73 | QString id = process.readAllStandardOutput().trimmed(); |
| 74 | |
| 75 | if (id.isEmpty()) { |
| 76 | process.start(catTool, {"/etc/machine-id"}); |
| 77 | awaitTool(process); |
| 78 | id = process.readAllStandardOutput().trimmed(); |
| 79 | } |
| 80 | |
| 81 | complete = !id.isEmpty(); |
| 82 | return id; |
| 83 | } |
| 84 | #endif |
| 85 | |
| 86 | #if defined(Q_OS_MAC) |
no test coverage detected