fix(build): cmake
This commit is contained in:
1 parent
1242753962
commit
4a773c63ce
17 files changed
+80
-75
No files matched your search
@@ -227,7 +227,7 @@ public:
|
||||
for (auto& mgr : m_managers) {
|
||||
if (!mgr.available) continue;
|
||||
if (progressCallback) progressCallback("🔄 Mise à jour via " + mgr.name + "...");
|
||||
std::string cmd = "sudo " + mgr.updateCmd + " 2>&1";
|
||||
std::string cmd = "pkexec sh -c \"" + mgr.updateCmd + "\" 2>&1";
|
||||
exec(cmd.c_str());
|
||||
}
|
||||
// Flatpak
|
||||
@@ -238,7 +238,7 @@ public:
|
||||
// Snap
|
||||
if (m_hasSnap) {
|
||||
if (progressCallback) progressCallback("🔄 Mise à jour Snap...");
|
||||
exec("sudo snap refresh 2>&1");
|
||||
exec("pkexec snap refresh 2>&1");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -248,7 +248,7 @@ public:
|
||||
if (!mgr.available) continue;
|
||||
if (isInstalledWithManager(mgr, packageName)) {
|
||||
if (progressCallback) progressCallback("🔄 Mise à jour via " + mgr.name + "...");
|
||||
std::string cmd = "sudo " + mgr.installCmd + " " + packageName + " 2>&1";
|
||||
std::string cmd = "pkexec sh -c \"" + mgr.installCmd + " " + packageName + "\" 2>&1";
|
||||
exec(cmd.c_str());
|
||||
return true;
|
||||
}
|
||||
@@ -410,7 +410,14 @@ private:
|
||||
// Parse common formats: "name version - description" or "name version description"
|
||||
size_t spacePos = line.find(' ');
|
||||
if (spacePos != std::string::npos) {
|
||||
pkg.name = line.substr(0, spacePos);
|
||||
// Strip repository prefix (e.g. "extra/vlc" -> "vlc")
|
||||
std::string firstToken = line.substr(0, spacePos);
|
||||
size_t slashPos = firstToken.find('/');
|
||||
if (slashPos != std::string::npos) {
|
||||
pkg.name = firstToken.substr(slashPos + 1);
|
||||
} else {
|
||||
pkg.name = firstToken;
|
||||
}
|
||||
size_t nextSpace = line.find(' ', spacePos + 1);
|
||||
if (nextSpace != std::string::npos) {
|
||||
pkg.version = line.substr(spacePos + 1, nextSpace - spacePos - 1);
|
||||
@@ -430,7 +437,7 @@ private:
|
||||
|
||||
bool installWithManager(const DetectedManager& mgr, const std::string& pkg,
|
||||
std::function<void(const std::string&)> progressCallback) {
|
||||
std::string cmd = "sudo " + mgr.installCmd + " " + pkg + " 2>&1";
|
||||
std::string cmd = "pkexec sh -c \"" + mgr.installCmd + " " + pkg + "\" 2>&1";
|
||||
std::string output = exec(cmd.c_str());
|
||||
if (progressCallback) {
|
||||
std::istringstream iss(output);
|
||||
@@ -444,7 +451,7 @@ private:
|
||||
|
||||
bool removeWithManager(const DetectedManager& mgr, const std::string& pkg,
|
||||
std::function<void(const std::string&)> progressCallback) {
|
||||
std::string cmd = "sudo " + mgr.removeCmd + " " + pkg + " 2>&1";
|
||||
std::string cmd = "pkexec sh -c \"" + mgr.removeCmd + " " + pkg + "\" 2>&1";
|
||||
exec(cmd.c_str());
|
||||
return !isInstalledWithManager(mgr, pkg);
|
||||
}
|
||||
@@ -497,13 +504,19 @@ private:
|
||||
PackageInfo pkg;
|
||||
size_t tabPos = line.find('\t');
|
||||
if (tabPos != std::string::npos) {
|
||||
pkg.name = line.substr(0, tabPos);
|
||||
size_t nextTab = line.find('\t', tabPos + 1);
|
||||
if (nextTab != std::string::npos) {
|
||||
pkg.description = line.substr(tabPos + 1, nextTab - tabPos - 1);
|
||||
// Columns: Name, Description, Application ID, Version, Branch, Remote
|
||||
size_t descTab = line.find('\t', tabPos + 1);
|
||||
size_t idTab = line.find('\t', descTab + 1);
|
||||
if (descTab != std::string::npos && idTab != std::string::npos) {
|
||||
pkg.description = line.substr(tabPos + 1, descTab - tabPos - 1);
|
||||
pkg.name = line.substr(descTab + 1, idTab - descTab - 1); // App ID
|
||||
} else {
|
||||
pkg.name = line.substr(0, tabPos);
|
||||
}
|
||||
pkg.installed = isFlatpakInstalled(pkg.name);
|
||||
results.push_back(pkg);
|
||||
if (!pkg.name.empty()) {
|
||||
results.push_back(pkg);
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
@@ -583,14 +596,14 @@ private:
|
||||
bool installSnap(const std::string& pkg,
|
||||
std::function<void(const std::string&)> progressCallback) {
|
||||
if (progressCallback) progressCallback("📦 Installation Snap: " + pkg + "...");
|
||||
exec(("sudo snap install " + pkg + " 2>&1").c_str());
|
||||
exec(("pkexec snap install " + pkg + " 2>&1").c_str());
|
||||
return isSnapInstalled(pkg);
|
||||
}
|
||||
|
||||
bool removeSnap(const std::string& pkg,
|
||||
std::function<void(const std::string&)> progressCallback) {
|
||||
if (progressCallback) progressCallback("🗑️ Suppression Snap: " + pkg + "...");
|
||||
exec(("sudo snap remove " + pkg + " 2>&1").c_str());
|
||||
exec(("pkexec snap remove " + pkg + " 2>&1").c_str());
|
||||
return !isSnapInstalled(pkg);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user