| 352 | } |
| 353 | |
| 354 | QString getDistroName() |
| 355 | { |
| 356 | QString distro; |
| 357 | |
| 358 | QFile osReleaseFile("/etc/os-release"); |
| 359 | if (osReleaseFile.open(QIODevice::ReadOnly)) { |
| 360 | QTextStream in(&osReleaseFile); |
| 361 | while (!in.atEnd()) { |
| 362 | QString line = in.readLine(); |
| 363 | if (line.startsWith("PRETTY_NAME=")) { |
| 364 | distro = line.mid(12).removeFirst().removeLast(); |
| 365 | } |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | if (distro.isEmpty()) { |
| 370 | return "Unknown"; |
| 371 | } |
| 372 | |
| 373 | return distro; |
| 374 | } |
| 375 | |
| 376 | bool isImmutableDistro() { |
| 377 | // There isn't a perfect way to do this, but one good hint is if either / or /usr is mounted read-only. |