1#include <libdnf5/base/base.hpp>
2
3// Create a new Base object.
4libdnf5::Base base;
5
6// Optionally set installroot.
7//
8// Installroot is set to '/' when we're working with the system, but we can set
9// it to a different location. The Base instance will then work with the
10// installroot directory tree as its root for the rest of its lifetime.
11base.get_config().get_installroot_option().set(installroot);
12
13// Optionally load configuration from the config files.
14//
15// The Base's config is initialized with default values, one of which is
16// "config_file_path". This contains the default path to the config file
17// ("/etc/dnf/dnf.conf"). If the file does not exist the distribution config file
18// is loaded. Function also loads configuration files from distribution and
19// user ("/etc/dnf/libdnf5.conf.d") drop-in directories.
20// Optionally set a custom value to "config_file_path" before calling this method
21// to load configuration from a anoher configuration file.
22base.load_config();
23
24// Load vars and do other initialization (of libsolv pool, etc.) based on the
25// configuration. Locks the installroot and varsdir configuration values so
26// that they can't be changed.
27base.setup();