| 86 | } |
| 87 | |
| 88 | bool Sys::main_lsb_info(Sys::LsbInfo & out) |
| 89 | { |
| 90 | int status=0; |
| 91 | QProcess lsbProcess; |
| 92 | QStringList arguments; |
| 93 | arguments << "-a"; |
| 94 | lsbProcess.start("lsb_release", arguments); |
| 95 | lsbProcess.waitForFinished(); |
| 96 | status = lsbProcess.exitStatus(); |
| 97 | QString output = lsbProcess.readAllStandardOutput(); |
| 98 | qDebug() << output; |
| 99 | lsbProcess.close(); |
| 100 | if(status == 0) |
| 101 | { |
| 102 | auto lines = output.split('\n'); |
| 103 | for(auto line:lines) |
| 104 | { |
| 105 | int index = line.indexOf(':'); |
| 106 | auto key = line.left(index).trimmed(); |
| 107 | auto value = line.mid(index + 1).toLower().trimmed(); |
| 108 | if(key == "Distributor ID") |
| 109 | out.distributor = value; |
| 110 | else if(key == "Release") |
| 111 | out.version = value; |
| 112 | else if(key == "Description") |
| 113 | out.description = value; |
| 114 | else if(key == "Codename") |
| 115 | out.codename = value; |
| 116 | } |
| 117 | return !out.distributor.isEmpty(); |
| 118 | } |
| 119 | return false; |
| 120 | } |
| 121 | |
| 122 | bool Sys::fallback_lsb_info(Sys::LsbInfo & out) |
| 123 | { |