重命名函数并更新命令以获取KPM版本信息
This commit is contained in:
@@ -528,9 +528,9 @@ fun controlKpmModule(name: String, args: String? = null): String {
|
||||
return result
|
||||
}
|
||||
|
||||
fun printKpmModules(): String {
|
||||
fun getKpmVersion(): String {
|
||||
val shell = getRootShell()
|
||||
val cmd = "${getKpmmgrPath()} print"
|
||||
val cmd = "${getKpmmgrPath()} version"
|
||||
val result = ShellUtils.fastCmd(shell, cmd)
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -50,21 +50,16 @@ class KpmViewModel : ViewModel() {
|
||||
|
||||
val modules = parseModuleList(moduleInfo)
|
||||
moduleList = modules
|
||||
|
||||
// 获取 KPM 版本信息
|
||||
val kpmVersion = getKpmVersion()
|
||||
Log.d("KsuCli", "KPM Version: $kpmVersion")
|
||||
} finally {
|
||||
isRefreshing = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getInstalledKernelPatches(): List<ModuleInfo> {
|
||||
return try {
|
||||
val output = printKpmModules()
|
||||
parseModuleList(output)
|
||||
} catch (e: Exception) {
|
||||
emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
private fun parseModuleList(output: String): List<ModuleInfo> {
|
||||
return output.split("\n").mapNotNull { line ->
|
||||
if (line.isBlank()) return@mapNotNull null
|
||||
|
||||
Reference in New Issue
Block a user