aboutsummaryrefslogtreecommitdiffhomepage
path: root/hyprpm
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-04-16 16:58:57 +0100
committerVaxry <[email protected]>2024-04-16 16:59:06 +0100
commiteeca50e3dcf472d92431f0f06151a76c453c865e (patch)
tree919f22a92bf5cfedfef7d82b60f09b83f9ddf30e /hyprpm
parent9a66514e26319e41c8661f57097a73b1c8579ccf (diff)
downloadHyprland-eeca50e3dcf472d92431f0f06151a76c453c865e.tar.gz
Hyprland-eeca50e3dcf472d92431f0f06151a76c453c865e.zip
hyprpm: err out on missing runtime deps
Diffstat (limited to 'hyprpm')
-rw-r--r--hyprpm/src/core/PluginManager.cpp20
-rw-r--r--hyprpm/src/core/PluginManager.hpp2
2 files changed, 22 insertions, 0 deletions
diff --git a/hyprpm/src/core/PluginManager.cpp b/hyprpm/src/core/PluginManager.cpp
index 459ee415..6ac5445e 100644
--- a/hyprpm/src/core/PluginManager.cpp
+++ b/hyprpm/src/core/PluginManager.cpp
@@ -95,6 +95,11 @@ SHyprlandVersion CPluginManager::getHyprlandVersion() {
bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string& rev) {
const auto HLVER = getHyprlandVersion();
+ if (!hasDeps()) {
+ std::cerr << "\n" << Colors::RED << "✖" << Colors::RESET << " Could not clone the plugin repository. Dependencies not satisfied. Hyprpm requires: cmake, meson, cpio\n";
+ return false;
+ }
+
if (DataState::pluginRepoExists(url)) {
std::cerr << "\n" << Colors::RED << "✖" << Colors::RESET << " Could not clone the plugin repository. Repository already installed.\n";
return false;
@@ -378,6 +383,11 @@ bool CPluginManager::updateHeaders(bool force) {
const auto HLVER = getHyprlandVersion();
+ if (!hasDeps()) {
+ std::cerr << "\n" << Colors::RED << "✖" << Colors::RESET << " Could not update. Dependencies not satisfied. Hyprpm requires: cmake, meson, cpio\n";
+ return false;
+ }
+
if (!std::filesystem::exists("/tmp/hyprpm")) {
std::filesystem::create_directory("/tmp/hyprpm");
std::filesystem::permissions("/tmp/hyprpm", std::filesystem::perms::all, std::filesystem::perm_options::replace);
@@ -833,3 +843,13 @@ std::string CPluginManager::headerError(const eHeadersErrors err) {
return std::string{Colors::RED} + "✖" + Colors::RESET + " Unknown header error. Please run hyprpm update to fix those.\n";
}
+
+bool CPluginManager::hasDeps() {
+ std::vector<std::string> deps = {"meson", "cpio", "cmake"};
+ for (auto& d : deps) {
+ if (!execAndGet("which " + d + " 2>&1").contains("/"))
+ return false;
+ }
+
+ return true;
+}
diff --git a/hyprpm/src/core/PluginManager.hpp b/hyprpm/src/core/PluginManager.hpp
index d0a592f1..f934d34a 100644
--- a/hyprpm/src/core/PluginManager.hpp
+++ b/hyprpm/src/core/PluginManager.hpp
@@ -56,6 +56,8 @@ class CPluginManager {
void notify(const eNotifyIcons icon, uint32_t color, int durationMs, const std::string& message);
+ bool hasDeps();
+
bool m_bVerbose = false;
private: