Use writable and persistent bind mounts for data, cache and storage
This commit is contained in:
parent
09ec800efd
commit
f59a768b5f
4 changed files with 38 additions and 10 deletions
|
|
@ -160,11 +160,9 @@ anbox::cmds::Run::Run(const BusFactory& bus_factory)
|
||||||
// A place where we can exchange files with the container
|
// A place where we can exchange files with the container
|
||||||
spec.bind_paths.insert({config::host_share_path(), config::container_share_path()});
|
spec.bind_paths.insert({config::host_share_path(), config::container_share_path()});
|
||||||
|
|
||||||
// FIXME(morphis): those directories should be really somewhere on our
|
spec.bind_paths.insert({ config::host_android_data_path(), "/data" });
|
||||||
// persistent data directory so we keep any runtime data accross restarts.
|
spec.bind_paths.insert({ config::host_android_cache_path(), "/cache" });
|
||||||
spec.temporary_dirs.push_back("/data");
|
spec.bind_paths.insert({ config::host_android_storage_path(), "/storage" });
|
||||||
spec.temporary_dirs.push_back("/cache");
|
|
||||||
spec.temporary_dirs.push_back("/storage");
|
|
||||||
|
|
||||||
spec.temporary_dirs.push_back("/dev/input");
|
spec.temporary_dirs.push_back("/dev/input");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,5 +46,26 @@ std::string host_share_path() {
|
||||||
std::string container_share_path() {
|
std::string container_share_path() {
|
||||||
return "/data/anbox-share";
|
return "/data/anbox-share";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string host_android_data_path() {
|
||||||
|
static std::string path;
|
||||||
|
if (path.length() == 0)
|
||||||
|
path = utils::string_format("%s/android-data", data_path());
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string host_android_cache_path() {
|
||||||
|
static std::string path;
|
||||||
|
if (path.length() == 0)
|
||||||
|
path = utils::string_format("%s/android-cache", data_path());
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string host_android_storage_path() {
|
||||||
|
static std::string path;
|
||||||
|
if (path.length() == 0)
|
||||||
|
path = utils::string_format("%s/android-storage", data_path());
|
||||||
|
return path;
|
||||||
|
}
|
||||||
} // namespace config
|
} // namespace config
|
||||||
} // namespace anbox
|
} // namespace anbox
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,9 @@ namespace config {
|
||||||
std::string data_path();
|
std::string data_path();
|
||||||
std::string host_share_path();
|
std::string host_share_path();
|
||||||
std::string container_share_path();
|
std::string container_share_path();
|
||||||
|
std::string host_android_data_path();
|
||||||
|
std::string host_android_cache_path();
|
||||||
|
std::string host_android_storage_path();
|
||||||
} // namespace config
|
} // namespace config
|
||||||
} // namespace anbox
|
} // namespace anbox
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,17 @@ catch(std::exception &err) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Daemon::ensure_data_path() {
|
void Daemon::ensure_data_path() {
|
||||||
if (!fs::is_directory(fs::path(config::data_path())))
|
std::vector<std::string> paths = {
|
||||||
fs::create_directories(fs::path(config::data_path()));
|
config::data_path(),
|
||||||
|
config::host_share_path(),
|
||||||
|
config::host_android_data_path(),
|
||||||
|
config::host_android_cache_path(),
|
||||||
|
config::host_android_storage_path()
|
||||||
|
};
|
||||||
|
|
||||||
if (!fs::is_directory(fs::path(config::host_share_path())))
|
for (const auto &path: paths) {
|
||||||
|
if (!fs::is_directory(fs::path(path)))
|
||||||
fs::create_directories(fs::path(config::host_share_path()));
|
fs::create_directories(fs::path(config::host_share_path()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} // namespace anbox
|
} // namespace anbox
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue