* @brief Reads the BSD host id, falling back to the SMBIOS system UUID. */
| 165 | * @brief Reads the BSD host id, falling back to the SMBIOS system UUID. |
| 166 | */ |
| 167 | static QString readBsdId(bool& complete) |
| 168 | { |
| 169 | QProcess process; |
| 170 | const auto catTool = resolveSystemTool({"/bin/cat", "/usr/bin/cat"}, "cat"); |
| 171 | const auto kenvTool = resolveSystemTool({"/sbin/kenv", "/usr/sbin/kenv"}, "kenv"); |
| 172 | process.start(catTool, {"/etc/hostid"}); |
| 173 | awaitTool(process); |
| 174 | QString id = process.readAllStandardOutput().trimmed(); |
| 175 | |
| 176 | if (id.isEmpty()) { |
| 177 | process.start(kenvTool, {"-q", "smbios.system.uuid"}); |
| 178 | awaitTool(process); |
| 179 | id = process.readAllStandardOutput().trimmed(); |
| 180 | } |
| 181 | |
| 182 | complete = !id.isEmpty(); |
| 183 | return id; |
| 184 | } |
| 185 | #endif |
| 186 | |
| 187 | /** |
no test coverage detected