mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 09:05:59 +01:00
hyprpm: err out on missing runtime deps
This commit is contained in:
parent
9a66514e26
commit
eeca50e3dc
2 changed files with 22 additions and 0 deletions
|
@ -95,6 +95,11 @@ SHyprlandVersion CPluginManager::getHyprlandVersion() {
|
||||||
bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string& rev) {
|
bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string& rev) {
|
||||||
const auto HLVER = getHyprlandVersion();
|
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)) {
|
if (DataState::pluginRepoExists(url)) {
|
||||||
std::cerr << "\n" << Colors::RED << "✖" << Colors::RESET << " Could not clone the plugin repository. Repository already installed.\n";
|
std::cerr << "\n" << Colors::RED << "✖" << Colors::RESET << " Could not clone the plugin repository. Repository already installed.\n";
|
||||||
return false;
|
return false;
|
||||||
|
@ -378,6 +383,11 @@ bool CPluginManager::updateHeaders(bool force) {
|
||||||
|
|
||||||
const auto HLVER = getHyprlandVersion();
|
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")) {
|
if (!std::filesystem::exists("/tmp/hyprpm")) {
|
||||||
std::filesystem::create_directory("/tmp/hyprpm");
|
std::filesystem::create_directory("/tmp/hyprpm");
|
||||||
std::filesystem::permissions("/tmp/hyprpm", std::filesystem::perms::all, std::filesystem::perm_options::replace);
|
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";
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,8 @@ class CPluginManager {
|
||||||
|
|
||||||
void notify(const eNotifyIcons icon, uint32_t color, int durationMs, const std::string& message);
|
void notify(const eNotifyIcons icon, uint32_t color, int durationMs, const std::string& message);
|
||||||
|
|
||||||
|
bool hasDeps();
|
||||||
|
|
||||||
bool m_bVerbose = false;
|
bool m_bVerbose = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue