Add command line option to use system dbus
This commit is contained in:
parent
7fc8bb46d2
commit
15a27ec8b6
2 changed files with 11 additions and 15 deletions
|
|
@ -85,16 +85,9 @@ std::istream& operator>>(std::istream& in, anbox::graphics::GLRendererServer::Co
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
anbox::cmds::SessionManager::BusFactory anbox::cmds::SessionManager::session_bus_factory() {
|
anbox::cmds::SessionManager::SessionManager()
|
||||||
return []() {
|
|
||||||
return std::make_shared<core::dbus::Bus>(core::dbus::WellKnownBus::session);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory)
|
|
||||||
: CommandWithFlagsAndAction{cli::Name{"session-manager"}, cli::Usage{"session-manager"},
|
: CommandWithFlagsAndAction{cli::Name{"session-manager"}, cli::Usage{"session-manager"},
|
||||||
cli::Description{"Run the the anbox session manager"}},
|
cli::Description{"Run the the anbox session manager"}},
|
||||||
bus_factory_(bus_factory),
|
|
||||||
window_size_(default_single_window_size) {
|
window_size_(default_single_window_size) {
|
||||||
// Just for the purpose to allow QtMir (or unity8) to find this on our
|
// Just for the purpose to allow QtMir (or unity8) to find this on our
|
||||||
// /proc/*/cmdline
|
// /proc/*/cmdline
|
||||||
|
|
@ -117,6 +110,9 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory)
|
||||||
flag(cli::make_flag(cli::Name{"experimental"},
|
flag(cli::make_flag(cli::Name{"experimental"},
|
||||||
cli::Description{"Allows users to use experimental features"},
|
cli::Description{"Allows users to use experimental features"},
|
||||||
experimental_));
|
experimental_));
|
||||||
|
flag(cli::make_flag(cli::Name{"use-system-dbus"},
|
||||||
|
cli::Description{"Use system instead of session DBus"},
|
||||||
|
use_system_dbus_));
|
||||||
|
|
||||||
action([this](const cli::Command::Context &) {
|
action([this](const cli::Command::Context &) {
|
||||||
auto trap = core::posix::trap_signals_for_process(
|
auto trap = core::posix::trap_signals_for_process(
|
||||||
|
|
@ -248,7 +244,11 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory)
|
||||||
dispatcher->dispatch([&]() { container_->start(container_configuration); });
|
dispatcher->dispatch([&]() { container_->start(container_configuration); });
|
||||||
}
|
}
|
||||||
|
|
||||||
auto bus = bus_factory_();
|
auto bus_type = core::dbus::WellKnownBus::session;
|
||||||
|
if (use_system_dbus_)
|
||||||
|
bus_type = core::dbus::WellKnownBus::system;
|
||||||
|
|
||||||
|
auto bus = std::make_shared<core::dbus::Bus>(bus_type);
|
||||||
bus->install_executor(core::dbus::asio::make_executor(bus, rt->service()));
|
bus->install_executor(core::dbus::asio::make_executor(bus, rt->service()));
|
||||||
|
|
||||||
auto skeleton = anbox::dbus::skeleton::Service::create_for_bus(bus, app_manager);
|
auto skeleton = anbox::dbus::skeleton::Service::create_for_bus(bus, app_manager);
|
||||||
|
|
|
||||||
|
|
@ -36,21 +36,17 @@ class Client;
|
||||||
namespace cmds {
|
namespace cmds {
|
||||||
class SessionManager : public cli::CommandWithFlagsAndAction {
|
class SessionManager : public cli::CommandWithFlagsAndAction {
|
||||||
public:
|
public:
|
||||||
typedef std::function<core::dbus::Bus::Ptr()> BusFactory;
|
SessionManager();
|
||||||
|
|
||||||
static BusFactory session_bus_factory();
|
|
||||||
|
|
||||||
SessionManager(const BusFactory& bus_factory = session_bus_factory());
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<container::Client> container_;
|
std::shared_ptr<container::Client> container_;
|
||||||
BusFactory bus_factory_;
|
|
||||||
std::string desktop_file_hint_;
|
std::string desktop_file_hint_;
|
||||||
graphics::GLRendererServer::Config::Driver gles_driver_;
|
graphics::GLRendererServer::Config::Driver gles_driver_;
|
||||||
bool single_window_ = false;
|
bool single_window_ = false;
|
||||||
graphics::Rect window_size_;
|
graphics::Rect window_size_;
|
||||||
bool standalone_ = false;
|
bool standalone_ = false;
|
||||||
bool experimental_ = false;
|
bool experimental_ = false;
|
||||||
|
bool use_system_dbus_ = false;
|
||||||
};
|
};
|
||||||
} // namespace cmds
|
} // namespace cmds
|
||||||
} // namespace anbox
|
} // namespace anbox
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue