1 #ifndef PACKAGE_MANAGER_PACKAGEMANAGERCONFIG_H_ 2 #define PACKAGE_MANAGER_PACKAGEMANAGERCONFIG_H_ 4 #include <boost/filesystem.hpp> 5 #include <boost/property_tree/ptree_fwd.hpp> 8 #include "utilities/config_utils.h" 10 enum class PackageManager { kNone = 0, kOstree, kDebian };
13 PackageManager type{PackageManager::kOstree};
15 boost::filesystem::path sysroot;
16 std::string ostree_server;
17 boost::filesystem::path packages_file{
"/usr/package.manifest"};
19 void updateFromPropertyTree(
const boost::property_tree::ptree& pt);
20 void writeToStream(std::ostream& out_stream)
const;
24 inline void CopyFromConfig(PackageManager& dest,
const std::string& option_name,
25 const boost::property_tree::ptree& pt) {
26 boost::optional<std::string> value = pt.get_optional<std::string>(option_name);
27 if (value.is_initialized()) {
28 std::string pm_type{StripQuotesFromStrings(value.get())};
29 if (pm_type ==
"ostree") {
30 dest = PackageManager::kOstree;
31 }
else if (pm_type ==
"debian") {
32 dest = PackageManager::kDebian;
34 dest = PackageManager::kNone;
39 #endif // PACKAGE_MANAGER_PACKAGEMANAGERCONFIG_H_