cmds: session_manager: Introduce an Experimental Mode flag

Some features which Anbox offer may be useful to users, but can not
be officially supported.  For example, the recently added Stand-Alone
Mode can be utilised to make use of different types of independent
containers where Anbox does not control the complete life cycle, but
since these types of setups can be widely varying and complex, it
would not be impossible to provide support.  Thus, when running in
these modes, it's important for the user to show knowledge that they
are operating in an experimental way.  This functionality provided
by issuing the --experimental flag when starting the Session Manager.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
Lee Jones 2017-05-12 11:47:24 +01:00
commit 157a2f9c13
2 changed files with 9 additions and 0 deletions

View file

@ -109,6 +109,9 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory)
flag(cli::make_flag(cli::Name{"standalone"},
cli::Description{"Prevents the Container Manager from starting the default container (Experimental)"},
standalone_));
flag(cli::make_flag(cli::Name{"experimental"},
cli::Description{"Allows users to use experimental features"},
experimental_));
action([this](const cli::Command::Context &) {
auto trap = core::posix::trap_signals_for_process(
@ -118,6 +121,11 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory)
trap->stop();
});
if (standalone_ && !experimental_) {
ERROR("Experimental features selected, but --experimental flag not set");
return EXIT_FAILURE;
}
if (!fs::exists("/dev/binder") || !fs::exists("/dev/ashmem")) {
ERROR("Failed to start as either binder or ashmem kernel drivers are not loaded");
return EXIT_FAILURE;

View file

@ -46,6 +46,7 @@ class SessionManager : public cli::CommandWithFlagsAndAction {
bool single_window_ = false;
graphics::Rect window_size_;
bool standalone_ = false;
bool experimental_ = false;
};
} // namespace cmds
} // namespace anbox