X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fdaemon.cpp;fp=src%2Ftype3_AndroidCloud%2Fanbox-master%2Fsrc%2Fanbox%2Fdaemon.cpp;h=69feb2496f7531fd5806f82bca33556726bc6982;hb=e26c1ec581be598521517829adba8c8dd23a768f;hp=0000000000000000000000000000000000000000;hpb=6699c1aea74eeb0eb400e6299079f0c7576f716f;p=iec.git diff --git a/src/type3_AndroidCloud/anbox-master/src/anbox/daemon.cpp b/src/type3_AndroidCloud/anbox-master/src/anbox/daemon.cpp new file mode 100644 index 0000000..69feb24 --- /dev/null +++ b/src/type3_AndroidCloud/anbox-master/src/anbox/daemon.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2016 Simon Fels + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3, as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranties of + * MERCHANTABILITY, SATISFACTORY QUALITY, 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 . + * + */ + +#include +#include + +#include "anbox/system_configuration.h" +#include "anbox/daemon.h" +#include "anbox/logger.h" + +#include "anbox/cmds/container_manager.h" +#include "anbox/cmds/session_manager.h" +#include "anbox/cmds/system_info.h" +#include "anbox/cmds/launch.h" +#include "anbox/cmds/version.h" +#include "anbox/cmds/wait_ready.h" +#include "anbox/cmds/check_features.h" + +#include + +namespace fs = boost::filesystem; + +namespace anbox { +Daemon::Daemon() + : cmd{cli::Name{"anbox"}, cli::Usage{"anbox"}, + cli::Description{"The Android in a Box runtime"}} { + cmd.command(std::make_shared()) + .command(std::make_shared()) + .command(std::make_shared()) + .command(std::make_shared()) + .command(std::make_shared()) + .command(std::make_shared()) + .command(std::make_shared()); + + Log().Init(anbox::Logger::Severity::kWarning); + + const auto log_level = utils::get_env_value("ANBOX_LOG_LEVEL", ""); + if (!log_level.empty() && !Log().SetSeverityFromString(log_level)) + WARNING("Failed to set logging severity to '%s'", log_level); +} + +int Daemon::Run(const std::vector &arguments) try { + auto argv = arguments; + if (arguments.size() == 0) argv = {"help"}; + return cmd.run({std::cin, std::cout, argv}); +} catch (std::exception &err) { + ERROR("%s", err.what()); + + return EXIT_FAILURE; +} +} // namespace anbox