Allow using a different data path for container setup
This commit is contained in:
parent
f51669d17b
commit
e0091c764b
3 changed files with 15 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ set -x
|
||||||
# Other than that nothing should ever modify the content of the
|
# Other than that nothing should ever modify the content of the
|
||||||
# rootfs.
|
# rootfs.
|
||||||
|
|
||||||
DATA_PATH=$SNAP_COMMON/var/lib/anbox
|
DATA_PATH=$SNAP_COMMON/
|
||||||
ROOTFS_PATH=$DATA_PATH/rootfs
|
ROOTFS_PATH=$DATA_PATH/rootfs
|
||||||
ANDROID_IMG=$SNAP/android.img
|
ANDROID_IMG=$SNAP/android.img
|
||||||
CONTAINER_BASE_UID=100000
|
CONTAINER_BASE_UID=100000
|
||||||
|
|
@ -62,7 +62,7 @@ start() {
|
||||||
# Ensure FUSE support for user namespaces is enabled
|
# Ensure FUSE support for user namespaces is enabled
|
||||||
echo Y | sudo tee /sys/module/fuse/parameters/userns_mounts || echo "WARNING: kernel doesn't support fuse in user namespaces"
|
echo Y | sudo tee /sys/module/fuse/parameters/userns_mounts || echo "WARNING: kernel doesn't support fuse in user namespaces"
|
||||||
|
|
||||||
exec $SNAP/usr/sbin/aa-exec -p unconfined -- $SNAP/bin/anbox-wrapper.sh container-manager
|
exec $SNAP/usr/sbin/aa-exec -p unconfined -- $SNAP/bin/anbox-wrapper.sh container-manager --data-path=$DATA_PATH
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
#include "anbox/container/service.h"
|
#include "anbox/container/service.h"
|
||||||
#include "anbox/logger.h"
|
#include "anbox/logger.h"
|
||||||
#include "anbox/runtime.h"
|
#include "anbox/runtime.h"
|
||||||
|
#include "anbox/config.h"
|
||||||
|
|
||||||
#include "core/posix/signal.h"
|
#include "core/posix/signal.h"
|
||||||
|
|
||||||
|
|
@ -26,7 +27,12 @@ anbox::cmds::ContainerManager::ContainerManager()
|
||||||
: CommandWithFlagsAndAction{
|
: CommandWithFlagsAndAction{
|
||||||
cli::Name{"container-manager"}, cli::Usage{"container-manager"},
|
cli::Name{"container-manager"}, cli::Usage{"container-manager"},
|
||||||
cli::Description{"Start the container manager service"}} {
|
cli::Description{"Start the container manager service"}} {
|
||||||
action([](const cli::Command::Context&) {
|
|
||||||
|
flag(cli::make_flag(cli::Name{"data-path"},
|
||||||
|
cli::Description{"Path where the container and its data is stored"},
|
||||||
|
data_path_));
|
||||||
|
|
||||||
|
action([&](const cli::Command::Context&) {
|
||||||
auto trap = core::posix::trap_signals_for_process(
|
auto trap = core::posix::trap_signals_for_process(
|
||||||
{core::posix::Signal::sig_term, core::posix::Signal::sig_int});
|
{core::posix::Signal::sig_term, core::posix::Signal::sig_int});
|
||||||
trap->signal_raised().connect([trap](const core::posix::Signal& signal) {
|
trap->signal_raised().connect([trap](const core::posix::Signal& signal) {
|
||||||
|
|
@ -34,6 +40,9 @@ anbox::cmds::ContainerManager::ContainerManager()
|
||||||
trap->stop();
|
trap->stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!data_path_.empty())
|
||||||
|
SystemConfiguration::instance().set_data_path(data_path_);
|
||||||
|
|
||||||
auto rt = Runtime::create();
|
auto rt = Runtime::create();
|
||||||
auto service = container::Service::create(rt);
|
auto service = container::Service::create(rt);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,9 @@ namespace cmds {
|
||||||
class ContainerManager : public cli::CommandWithFlagsAndAction {
|
class ContainerManager : public cli::CommandWithFlagsAndAction {
|
||||||
public:
|
public:
|
||||||
ContainerManager();
|
ContainerManager();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string data_path_;
|
||||||
};
|
};
|
||||||
} // namespace cmds
|
} // namespace cmds
|
||||||
} // namespace anbox
|
} // namespace anbox
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue