Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • applications/mhwd
  • johann-koebbe/mhwd
  • yochananmarqos1/mhwd
3 results
Show changes
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
* Copyright (C) 2012 - 2016 Manjaro (http://manjaro.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
* Copyright (C) 2012 - 2016 Manjaro (http://manjaro.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
* Copyright (C) 2012 - 2016 Manjaro (http://manjaro.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
This diff is collapsed.
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
* Copyright (C) 2012 - 2016 Manjaro (http://manjaro.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -35,18 +38,19 @@
#include "Config.hpp"
#include "const.h"
#include "ConsoleWriter.hpp"
#include "Data.hpp"
#include "Device.hpp"
#include "Enums.hpp"
#include "Printer.hpp"
#include "vita/string.hpp"
#include "Transaction.hpp"
class Mhwd
{
public:
Mhwd();
Mhwd() = default;
~Mhwd() = default;
void setVersionMhwd(std::string versionOfSoftware, std::string yearCopyright);
int launch(int argc, char *argv[]);
private:
......@@ -67,21 +71,18 @@ private:
} arguments_;
std::shared_ptr<Config> config_;
Data data_;
Printer printer_;
ConsoleWriter consoleWriter_;
std::vector<std::string> configs_;
std::string version_, year_;
bool performTransaction(std::shared_ptr<Config> config, MHWD::TRANSACTIONTYPE type);
bool isUserRoot() const;
std::string checkEnvironment();
void printDeviceDetails(std::string type, FILE *f = stdout);
std::vector<std::string> checkEnvironment() const;
std::shared_ptr<Config> getInstalledConfig(const std::string& configName, const std::string& configType);
std::shared_ptr<Config> getDatabaseConfig(const std::string& configName, const std::string& configType);
std::shared_ptr<Config> getAvailableConfig(const std::string& configName, const std::string& configType);
std::vector<Config*> getAllLocalRequirements(Config *config);
MHWD::STATUS performTransaction(const Transaction& transaction);
bool proceedWithInstallation(const std::string& input) const;
......@@ -89,16 +90,17 @@ private:
bool copyFile(const std::string& source, const std::string destination, const mode_t mode =
S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IROTH);
bool removeDirectory(const std::string& directory);
bool dirExists(const std::string& path);
bool dirExists(const std::string& path) const;
bool createDir(const std::string& path, const mode_t mode =
S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IROTH | S_IXGRP | S_IXOTH);
MHWD::STATUS installConfig(std::shared_ptr<Config> config);
MHWD::STATUS uninstallConfig(Config *config);
bool runScript(std::shared_ptr<Config> config, MHWD::TRANSACTIONTYPE operationType);
void tryToParseCmdLineOptions(int argc, char* argv[], bool& autoConfigureNonFreeDriver,
std::string& operationType, std::string& autoConfigureClassID);
bool optionsDontInterfereWithEachOther() const;
void tryToParseCmdLineOptions(int argc, char* argv[], bool& autoConfigureNonFreeDriver,
std::string& operationType, std::string& autoConfigureClassID);
bool optionsDontInterfereWithEachOther() const;
std::string gatherConfigContent(const std::vector<std::shared_ptr<Config>> & config) const;
};
#endif /* MHWD_HPP_ */
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
* Copyright (C) 2012 - 2016 Manjaro (http://manjaro.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
* Copyright (C) 2012 - 2016 Manjaro (http://manjaro.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -33,7 +36,7 @@ class Transaction
public:
Transaction() = delete;
Transaction(Data data, std::shared_ptr<Config> config, MHWD::TRANSACTIONTYPE type,
bool allowReinstallation);
bool allowReinstallation);
bool isAllowedToReinstall() const;
std::shared_ptr<Config> config_;
......
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
* Oscar Forner Martinez <oscar.forner.martinez@gmail.com>
*
* Copyright (C) 2012 - 2016 Manjaro (http://manjaro.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MHWDUTILS_HPP_
#define MHWDUTILS_HPP_
#include <string>
#include <cstdint>
namespace MhwdUtils
{
typedef std::uint64_t hash_t;
// Hardcoded values for the prime and the basis to calculate hash values.
constexpr hash_t prime = 0x100000001B3ull;
constexpr hash_t basis = 0xCBF29CE484222325ull;
constexpr hash_t hash_compile_time(char const* str, hash_t last_value = basis)
{
return *str ? hash_compile_time(str+1, (*str ^ last_value) * prime) : last_value;
}
hash_t hash(char const* str)
{
hash_t ret{basis};
while(*str){
ret ^= *str;
ret *= prime;
str++;
}
return ret;
}
}; // End namespace
#endif /* MHWDUTILS_HPP_ */
/*
* This file is part of the mhwd - Manjaro Hardware Detection project
*
* mhwd - Manjaro Hardware Detection
* Roland Singer <roland@manjaro.org>
* Philip Müller <philm@manjaro.org>
* Łukasz Matysiak <december0123@gmail.com>
* Filipe Marques <eagle.software3@gmail.com>
*
* Copyright (C) 2007 Free Software Foundation, Inc.
* Copyright (C) 2012 - 2024 Manjaro (http://manjaro.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -19,20 +23,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Mhwd.hpp"
#include <iostream>
#include "Mhwd.hpp"
int main(int argc, char *argv[])
{
try
{
Mhwd mhwd;
return mhwd.launch(argc, argv);
Mhwd mhwd;
mhwd.setVersionMhwd("0.6.6","2012-2024");
return mhwd.launch(argc, argv);
}
catch(...)
{
std::cerr << "Unknown errors occured...";
return -1;
std::cerr << "Unknown errors occured...";
return -1;
}
}