Merge pull request #425 from jackwish/fix/determine-resource-dir
Correct resource directory
This commit is contained in:
commit
86cc5f1e37
20 changed files with 54 additions and 41 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -2,6 +2,8 @@ build*/
|
||||||
parts/
|
parts/
|
||||||
stage/
|
stage/
|
||||||
prime/
|
prime/
|
||||||
|
snap/
|
||||||
|
android-images/
|
||||||
*.snap
|
*.snap
|
||||||
CMakeLists.txt.user
|
CMakeLists.txt.user
|
||||||
*.o.cmd
|
*.o.cmd
|
||||||
|
|
@ -15,6 +17,7 @@ modules.order
|
||||||
.tmp_versions
|
.tmp_versions
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
|
|
||||||
debian/anbox-modules-dkms.debhelper.log
|
debian/anbox-modules-dkms.debhelper.log
|
||||||
debian/anbox-modules-dkms.substvars
|
debian/anbox-modules-dkms.substvars
|
||||||
debian/anbox-modules-dkms/
|
debian/anbox-modules-dkms/
|
||||||
|
|
|
||||||
|
|
@ -105,8 +105,11 @@ endif()
|
||||||
if (ANBOX_VERSION_SUFFIX)
|
if (ANBOX_VERSION_SUFFIX)
|
||||||
set(ANBOX_VERSION "${ANBOX_VERSION}-${ANBOX_VERSION_SUFFIX}")
|
set(ANBOX_VERSION "${ANBOX_VERSION}-${ANBOX_VERSION_SUFFIX}")
|
||||||
endif()
|
endif()
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/anbox/build/version.h.in
|
set(ANBOX_RESOURCE_DIR "${CMAKE_INSTALL_DATADIR}/anbox")
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/anbox/build/version.h)
|
set(ANBOX_RESOURCE_DIR_FULL "${CMAKE_INSTALL_FULL_DATADIR}/anbox")
|
||||||
|
set(ANBOX_STATEDIR_FULL "${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/anbox")
|
||||||
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/anbox/build/config.h.in
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/anbox/build/config.h)
|
||||||
|
|
||||||
add_subdirectory(external)
|
add_subdirectory(external)
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
@ -118,7 +121,7 @@ if (NOT "${HOST_CMAKE_C_COMPILER}" STREQUAL "")
|
||||||
message(STATUS "Host C compiler: ${HOST_CMAKE_CXX_COMPILER}")
|
message(STATUS "Host C compiler: ${HOST_CMAKE_CXX_COMPILER}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
install(FILES data/ui/loading-screen.png DESTINATION share/anbox/ui)
|
install(FILES data/ui/loading-screen.png DESTINATION ${ANBOX_RESOURCE_DIR}/ui)
|
||||||
|
|
||||||
# uninstall target
|
# uninstall target
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,10 @@ set(SOURCES
|
||||||
anbox/cli.cpp
|
anbox/cli.cpp
|
||||||
anbox/runtime.cpp
|
anbox/runtime.cpp
|
||||||
anbox/daemon.cpp
|
anbox/daemon.cpp
|
||||||
anbox/config.cpp
|
anbox/system_configuration.cpp
|
||||||
anbox/not_reachable.cpp
|
anbox/not_reachable.cpp
|
||||||
|
|
||||||
anbox/build/version.h.in
|
anbox/build/config.h.in
|
||||||
|
|
||||||
anbox/android/intent.cpp
|
anbox/android/intent.cpp
|
||||||
anbox/android/ip_config_builder.cpp
|
anbox/android/ip_config_builder.cpp
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include "anbox/application/database.h"
|
#include "anbox/application/database.h"
|
||||||
#include "anbox/application/launcher_storage.h"
|
#include "anbox/application/launcher_storage.h"
|
||||||
#include "anbox/config.h"
|
#include "anbox/system_configuration.h"
|
||||||
#include "anbox/logger.h"
|
#include "anbox/logger.h"
|
||||||
|
|
||||||
namespace anbox {
|
namespace anbox {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "anbox/network/local_socket_messenger.h"
|
#include "anbox/network/local_socket_messenger.h"
|
||||||
#include "anbox/network/message_processor.h"
|
#include "anbox/network/message_processor.h"
|
||||||
#include "anbox/common/type_traits.h"
|
#include "anbox/common/type_traits.h"
|
||||||
#include "anbox/config.h"
|
#include "anbox/system_configuration.h"
|
||||||
#include "anbox/utils.h"
|
#include "anbox/utils.h"
|
||||||
#include "anbox/logger.h"
|
#include "anbox/logger.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "anbox/bridge/android_api_stub.h"
|
#include "anbox/bridge/android_api_stub.h"
|
||||||
#include "anbox/config.h"
|
#include "anbox/system_configuration.h"
|
||||||
#include "anbox/logger.h"
|
#include "anbox/logger.h"
|
||||||
#include "anbox/rpc/channel.h"
|
#include "anbox/rpc/channel.h"
|
||||||
#include "anbox/utils.h"
|
#include "anbox/utils.h"
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ANBOX_VERSION_H_
|
#ifndef ANBOX_CONFIG_H_
|
||||||
#define ANBOX_VERSION_H_
|
#define ANBOX_CONFIG_H_
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
@ -27,7 +27,11 @@ namespace anbox {
|
||||||
namespace build {
|
namespace build {
|
||||||
/// @brief version marks the version
|
/// @brief version marks the version
|
||||||
static constexpr const char *version{"@ANBOX_VERSION@"};
|
static constexpr const char *version{"@ANBOX_VERSION@"};
|
||||||
|
|
||||||
|
// path for system configuration
|
||||||
|
static constexpr const char *default_resource_path{"@ANBOX_RESOURCE_DIR_FULL@"};
|
||||||
|
static constexpr const char *default_data_path{"@ANBOX_STATEDIR_FULL@"};
|
||||||
} // namespace build
|
} // namespace build
|
||||||
} // namespace anbox
|
} // namespace anbox
|
||||||
|
|
||||||
#endif // ANBOX_VERSION_H_
|
#endif // ANBOX_CONFIG_H_
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#include "anbox/common/loop_device_allocator.h"
|
#include "anbox/common/loop_device_allocator.h"
|
||||||
#include "anbox/logger.h"
|
#include "anbox/logger.h"
|
||||||
#include "anbox/runtime.h"
|
#include "anbox/runtime.h"
|
||||||
#include "anbox/config.h"
|
#include "anbox/system_configuration.h"
|
||||||
|
|
||||||
#include "core/posix/signal.h"
|
#include "core/posix/signal.h"
|
||||||
#include "core/posix/exec.h"
|
#include "core/posix/exec.h"
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#include "anbox/dbus/stub/application_manager.h"
|
#include "anbox/dbus/stub/application_manager.h"
|
||||||
#include "anbox/common/dispatcher.h"
|
#include "anbox/common/dispatcher.h"
|
||||||
#include "anbox/ui/splash_screen.h"
|
#include "anbox/ui/splash_screen.h"
|
||||||
#include "anbox/config.h"
|
#include "anbox/system_configuration.h"
|
||||||
#include "anbox/runtime.h"
|
#include "anbox/runtime.h"
|
||||||
#include "anbox/logger.h"
|
#include "anbox/logger.h"
|
||||||
|
|
||||||
|
|
@ -119,12 +119,6 @@ anbox::cmds::Launch::Launch()
|
||||||
auto bus = std::make_shared<core::dbus::Bus>(bus_type);
|
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()));
|
||||||
|
|
||||||
const auto snap_path = utils::get_env_value("SNAP");
|
|
||||||
if (!snap_path.empty()) {
|
|
||||||
const auto resource_path = fs::path(snap_path) / "usr" / "share" / "anbox";
|
|
||||||
SystemConfiguration::instance().set_resource_path(resource_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<ui::SplashScreen> ss;
|
std::shared_ptr<ui::SplashScreen> ss;
|
||||||
|
|
||||||
// Instead of relying on the user session init system to start our
|
// Instead of relying on the user session init system to start our
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ std::istream& operator>>(std::istream& in, anbox::graphics::GLRendererServer::Co
|
||||||
|
|
||||||
#include "anbox/cmds/session_manager.h"
|
#include "anbox/cmds/session_manager.h"
|
||||||
#include "anbox/common/dispatcher.h"
|
#include "anbox/common/dispatcher.h"
|
||||||
#include "anbox/config.h"
|
#include "anbox/system_configuration.h"
|
||||||
#include "anbox/container/client.h"
|
#include "anbox/container/client.h"
|
||||||
#include "anbox/dbus/skeleton/service.h"
|
#include "anbox/dbus/skeleton/service.h"
|
||||||
#include "anbox/input/manager.h"
|
#include "anbox/input/manager.h"
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "anbox/utils/environment_file.h"
|
#include "anbox/utils/environment_file.h"
|
||||||
#include "anbox/logger.h"
|
#include "anbox/logger.h"
|
||||||
|
|
||||||
#include "anbox/build/version.h"
|
#include "anbox/build/config.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "anbox/cmds/version.h"
|
#include "anbox/cmds/version.h"
|
||||||
#include "anbox/build/version.h"
|
#include "anbox/build/config.h"
|
||||||
#include "anbox/utils.h"
|
#include "anbox/utils.h"
|
||||||
|
|
||||||
anbox::cmds::Version::Version()
|
anbox::cmds::Version::Version()
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "anbox/container/client.h"
|
#include "anbox/container/client.h"
|
||||||
#include "anbox/config.h"
|
#include "anbox/system_configuration.h"
|
||||||
#include "anbox/container/management_api_stub.h"
|
#include "anbox/container/management_api_stub.h"
|
||||||
#include "anbox/logger.h"
|
#include "anbox/logger.h"
|
||||||
#include "anbox/network/local_socket_messenger.h"
|
#include "anbox/network/local_socket_messenger.h"
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include "anbox/android/ip_config_builder.h"
|
#include "anbox/android/ip_config_builder.h"
|
||||||
#include "anbox/container/lxc_container.h"
|
#include "anbox/container/lxc_container.h"
|
||||||
#include "anbox/config.h"
|
#include "anbox/system_configuration.h"
|
||||||
#include "anbox/logger.h"
|
#include "anbox/logger.h"
|
||||||
#include "anbox/utils.h"
|
#include "anbox/utils.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "anbox/container/service.h"
|
#include "anbox/container/service.h"
|
||||||
#include "anbox/config.h"
|
#include "anbox/system_configuration.h"
|
||||||
#include "anbox/container/lxc_container.h"
|
#include "anbox/container/lxc_container.h"
|
||||||
#include "anbox/container/management_api_message_processor.h"
|
#include "anbox/container/management_api_message_processor.h"
|
||||||
#include "anbox/container/management_api_skeleton.h"
|
#include "anbox/container/management_api_skeleton.h"
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/prctl.h>
|
#include <sys/prctl.h>
|
||||||
|
|
||||||
#include "anbox/config.h"
|
#include "anbox/system_configuration.h"
|
||||||
#include "anbox/daemon.h"
|
#include "anbox/daemon.h"
|
||||||
#include "anbox/logger.h"
|
#include "anbox/logger.h"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "anbox/input/manager.h"
|
#include "anbox/input/manager.h"
|
||||||
#include "anbox/config.h"
|
#include "anbox/system_configuration.h"
|
||||||
#include "anbox/input/device.h"
|
#include "anbox/input/device.h"
|
||||||
#include "anbox/runtime.h"
|
#include "anbox/runtime.h"
|
||||||
#include "anbox/utils.h"
|
#include "anbox/utils.h"
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "anbox/config.h"
|
#include "anbox/system_configuration.h"
|
||||||
#include "anbox/utils.h"
|
#include "anbox/utils.h"
|
||||||
|
#include "anbox/build/config.h"
|
||||||
|
|
||||||
#include "external/xdg/xdg.h"
|
#include "external/xdg/xdg.h"
|
||||||
|
|
||||||
|
|
@ -41,10 +42,6 @@ void anbox::SystemConfiguration::set_data_path(const std::string &path) {
|
||||||
data_path = path;
|
data_path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
void anbox::SystemConfiguration::set_resource_path(const fs::path &path) {
|
|
||||||
resource_path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
fs::path anbox::SystemConfiguration::data_dir() const {
|
fs::path anbox::SystemConfiguration::data_dir() const {
|
||||||
return data_path;
|
return data_path;
|
||||||
}
|
}
|
||||||
|
|
@ -88,3 +85,17 @@ anbox::SystemConfiguration& anbox::SystemConfiguration::instance() {
|
||||||
static SystemConfiguration config;
|
static SystemConfiguration config;
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
anbox::SystemConfiguration::SystemConfiguration() {
|
||||||
|
auto detect_resource_path = [] () -> fs::path {
|
||||||
|
const auto snap_path = utils::get_env_value("SNAP");
|
||||||
|
if (!snap_path.empty()) {
|
||||||
|
return fs::path(snap_path) / "usr" / "share" / "anbox";
|
||||||
|
} else {
|
||||||
|
return anbox::build::default_resource_path;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
resource_path = detect_resource_path();
|
||||||
|
data_path = anbox::build::default_data_path;
|
||||||
|
}
|
||||||
|
|
@ -15,8 +15,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ANBOX_CONFIG_H_
|
#ifndef ANBOX_SYSTEM_CONFIGURATION_H_
|
||||||
#define ANBOX_CONFIG_H_
|
#define ANBOX_SYSTEM_CONFIGURATION_H_
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
@ -31,7 +31,6 @@ class SystemConfiguration {
|
||||||
virtual ~SystemConfiguration() = default;
|
virtual ~SystemConfiguration() = default;
|
||||||
|
|
||||||
void set_data_path(const std::string &path);
|
void set_data_path(const std::string &path);
|
||||||
void set_resource_path(const boost::filesystem::path &path);
|
|
||||||
|
|
||||||
boost::filesystem::path data_dir() const;
|
boost::filesystem::path data_dir() const;
|
||||||
std::string rootfs_dir() const;
|
std::string rootfs_dir() const;
|
||||||
|
|
@ -44,12 +43,11 @@ class SystemConfiguration {
|
||||||
std::string resource_dir() const;
|
std::string resource_dir() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SystemConfiguration() = default;
|
SystemConfiguration();
|
||||||
|
|
||||||
boost::filesystem::path data_path = "/var/lib/anbox";
|
|
||||||
boost::filesystem::path resource_path = "/usr/share/anbox";
|
|
||||||
|
|
||||||
|
boost::filesystem::path data_path;
|
||||||
|
boost::filesystem::path resource_path;
|
||||||
};
|
};
|
||||||
} // namespace anbox
|
} // namespace anbox
|
||||||
|
|
||||||
#endif
|
#endif // ANBOX_SYSTEM_CONFIGURATION_H_
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "anbox/ui/splash_screen.h"
|
#include "anbox/ui/splash_screen.h"
|
||||||
#include "anbox/config.h"
|
#include "anbox/system_configuration.h"
|
||||||
#include "anbox/utils.h"
|
#include "anbox/utils.h"
|
||||||
#include "anbox/logger.h"
|
#include "anbox/logger.h"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue