From 7ce6b0d76572a26cff61c18653d7d14e7ebc96e2 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Tue, 14 Mar 2017 08:06:38 +0100 Subject: [PATCH 1/3] Use subdirectory in SNAP_USER_COMMON for our application data --- scripts/snap-wrapper.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/snap-wrapper.sh b/scripts/snap-wrapper.sh index 9e45e91..0122ad3 100755 --- a/scripts/snap-wrapper.sh +++ b/scripts/snap-wrapper.sh @@ -33,6 +33,6 @@ export LD_LIBRARY_PATH="$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH" # create all our application launchers in. The system application launcher will # be configured by our installer to look into this directory for available # launchers. -export XDG_DATA_HOME="$SNAP_USER_COMMON" +export XDG_DATA_HOME="$SNAP_USER_COMMON/app-data" exec $SNAP/usr/bin/anbox $@ From 4863d25e2c76ff3c9dc031b5cd3e67572eeb3894 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Tue, 14 Mar 2017 08:06:58 +0100 Subject: [PATCH 2/3] Use correct path for the anbox binary when running from within a snap --- src/anbox/application/launcher_storage.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/anbox/application/launcher_storage.cpp b/src/anbox/application/launcher_storage.cpp index cb8f5f1..a94602d 100644 --- a/src/anbox/application/launcher_storage.cpp +++ b/src/anbox/application/launcher_storage.cpp @@ -25,6 +25,12 @@ namespace fs = boost::filesystem; +namespace { +// This will always point us to the right executable when we're running within +// a snap environment. +constexpr const char *snap_exe_path{"/snap/bin/anbox"}; +} + namespace anbox { namespace application { LauncherStorage::LauncherStorage(const fs::path &path, @@ -62,7 +68,11 @@ void LauncherStorage::add_or_update(const Item &item) { auto package_name = item.package; std::replace(package_name.begin(), package_name.end(), '.', '-'); - std::string exec = utils::string_format("%s launch ", utils::process_get_exe_path(getpid())); + auto exe_path = utils::process_get_exe_path(getpid()); + if (utils::get_env_value("SNAP").length() > 0) + exe_path = snap_exe_path; + + std::string exec = utils::string_format("%s launch ", exe_path); if (!item.launch_intent.action.empty()) exec += utils::string_format("--action=%s ", item.launch_intent.action); From 11aea9c6814f3b30db7958017eca0c458d042750 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Tue, 14 Mar 2017 08:07:09 +0100 Subject: [PATCH 3/3] Drop unused parameter --- src/anbox/cmds/system_info.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/anbox/cmds/system_info.cpp b/src/anbox/cmds/system_info.cpp index 372bc0a..421f11c 100644 --- a/src/anbox/cmds/system_info.cpp +++ b/src/anbox/cmds/system_info.cpp @@ -195,7 +195,7 @@ anbox::cmds::SystemInfo::SystemInfo() : CommandWithFlagsAndAction{ cli::Name{"system-info"}, cli::Usage{"system-info"}, cli::Description{"Print various information about the system we're running on"}} { - action([](const cli::Command::Context& ctxt) { + action([](const cli::Command::Context&) { SystemInformation si; std::cout << si; return EXIT_SUCCESS;