提交 a21233cb 编写于 作者: S Simon Fels 提交者: GitHub

Merge pull request #252 from morphis/f/warn-on-cm-start

Print warning if user starts container manager manually
......@@ -37,7 +37,8 @@ start() {
exec $AA_EXEC $SNAP/bin/anbox-wrapper.sh container-manager \
--data-path=$DATA_PATH \
--android-image=$ANDROID_IMG
--android-image=$ANDROID_IMG \
--daemon
}
stop() {
......
......@@ -48,11 +48,22 @@ anbox::cmds::ContainerManager::ContainerManager()
flag(cli::make_flag(cli::Name{"privileged"},
cli::Description{"Run Android container in privileged mode"},
privileged_));
flag(cli::make_flag(cli::Name{"daemon"},
cli::Description{"Mark service as being started as systemd daemon"},
daemon_));
action([&](const cli::Command::Context&) {
try {
if (getuid() != 0) {
ERROR("You're not running the container-manager as root. Generally you don't");
if (!daemon_) {
WARNING("You are running the container manager manually which is most likely not");
WARNING("what you want. The container manager is normally started by systemd or");
WARNING("another init system. If you still want to run the container-manager");
WARNING("you can get rid of this warning by starting with the --daemon option.");
WARNING("");
}
if (geteuid() != 0) {
ERROR("You are not running the container-manager as root. Generally you don't");
ERROR("want to run the container-manager manually unless you're a developer");
ERROR("as it is started by the init system of your operating system.");
return EXIT_FAILURE;
......
......@@ -42,6 +42,7 @@ class ContainerManager : public cli::CommandWithFlagsAndAction {
std::shared_ptr<common::LoopDevice> android_img_loop_dev_;
std::vector<std::shared_ptr<common::MountEntry>> mounts_;
bool privileged_ = false;
bool daemon_ = false;
};
} // namespace cmds
} // namespace anbox
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册