26 __attribute__((section(
".fim_reserved_offset"), used))
27 uint32_t FIM_RESERVED_OFFSET = 0;
45 return_if(fim ==
nullptr, Error(
"E::Failed to initialize configuration"));
69 or std::string_view{argv[1]} ==
"fim-exec"
70 or std::string_view{argv[1]} ==
"fim-root"
71 or not std::string_view{argv[1]}.starts_with(
"fim-"))
87int main(
int argc,
char** argv)
93 ns_env::set(
"FIM_VERSION", FIM_VERSION, ns_env::Replace::Y);
94 ns_env::set(
"FIM_COMMIT", FIM_COMMIT, ns_env::Replace::Y);
95 ns_env::set(
"FIM_DIST", FIM_DIST, ns_env::Replace::Y);
96 ns_env::set(
"FIM_TIMESTAMP", FIM_TIMESTAMP, ns_env::Replace::Y);
102 return Pop(
boot(argc, argv),
"C::The program exited with an error");
void set_logger_level(int argc, char **argv)
Set the logger level.
Value< int > boot(int argc, char **argv)
Boots the main flatimage program and the portal process.
FlatImage configuration object.
Executes parsed FlatImage commands.
Enhanced error handling framework built on std::expected.
constexpr auto __expected_fn
Lambda helper for Pop macro error returns.
A library for manipulating environment variables.
A library with helpers for linux operations.
A library for file logging.
Value< std::shared_ptr< FlatImage > > config()
Factory method that makes a FlatImage configuration object.
Value< Dispatcher > deserialize(std::string_view str_raw_json) noexcept
Deserializes a json string into a Dispatcher class.
bool exists(std::string_view name, std::string_view value)
Checks if variable exists and equals value.
void set(T &&name, U &&value, Replace replace)
Sets an environment variable.
Value< bool > module_check(std::string_view str_name)
Checks if the linux kernel has a module loaded that matches the input name.
void set_level(Level level)
Sets the logging verbosity (CRITICAL,ERROR,INFO,DEBUG)
void set_sink_file(fs::path const &path_file_sink)
Sets the sink file of the logger.
Value< int > execute_command(ns_config::FlatImage &fim, int argc, char **argv)
Executes a parsed FlatImage command.
Value< void > relocate(char **argv, int32_t offset)
Calls the implementation of relocate.
int main()
Entry point for the portal daemon.
Used to copy execve the flatimage program.
Enhanced expected type with integrated logging capabilities.