diff --git a/scripts/container-manager.sh b/scripts/container-manager.sh index 993a150..440f7ea 100755 --- a/scripts/container-manager.sh +++ b/scripts/container-manager.sh @@ -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() { diff --git a/src/anbox/cmds/container_manager.cpp b/src/anbox/cmds/container_manager.cpp index 4716303..dffd6dc 100644 --- a/src/anbox/cmds/container_manager.cpp +++ b/src/anbox/cmds/container_manager.cpp @@ -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 (!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("or 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 (getuid() != 0) { - ERROR("You're not running the container-manager as root. Generally you don't"); + 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; diff --git a/src/anbox/cmds/container_manager.h b/src/anbox/cmds/container_manager.h index 4525756..679c802 100644 --- a/src/anbox/cmds/container_manager.h +++ b/src/anbox/cmds/container_manager.h @@ -42,6 +42,7 @@ class ContainerManager : public cli::CommandWithFlagsAndAction { std::shared_ptr android_img_loop_dev_; std::vector> mounts_; bool privileged_ = false; + bool daemon_ = false; }; } // namespace cmds } // namespace anbox