Merge pull request #34 from morphis/feature/minor-fixes
A few minor fixes to clean things up a bit
This commit is contained in:
commit
d12aad5c01
6 changed files with 22 additions and 28 deletions
|
|
@ -95,7 +95,7 @@ start() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure FUSE support for user namespaces is enabled
|
# Ensure FUSE support for user namespaces is enabled
|
||||||
echo Y > /sys/module/fuse/parameters/userns_mounts
|
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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,6 @@ parts:
|
||||||
# FIXME: Anbox currently has some paths with hard coded prefixes. Once
|
# FIXME: Anbox currently has some paths with hard coded prefixes. Once
|
||||||
# that is fixed we can avoid using a prefix here.
|
# that is fixed we can avoid using a prefix here.
|
||||||
- -DCMAKE_INSTALL_PREFIX:PATH=/usr
|
- -DCMAKE_INSTALL_PREFIX:PATH=/usr
|
||||||
# FIXME: When building in release mode we get a lot of error which cause
|
|
||||||
# the build to fail.
|
|
||||||
- -DCMAKE_BUILD_TYPE=debug
|
|
||||||
build-packages:
|
build-packages:
|
||||||
- build-essential
|
- build-essential
|
||||||
- cmake
|
- cmake
|
||||||
|
|
@ -104,6 +101,7 @@ parts:
|
||||||
- libboost-iostreams-dev
|
- libboost-iostreams-dev
|
||||||
- libboost-program-options-dev
|
- libboost-program-options-dev
|
||||||
- libboost-system-dev
|
- libboost-system-dev
|
||||||
|
- libboost-test-dev
|
||||||
- libboost-thread-dev
|
- libboost-thread-dev
|
||||||
- libcap-dev
|
- libcap-dev
|
||||||
- libdbus-1-dev
|
- libdbus-1-dev
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,8 @@ void LauncherStorage::add(const Item &item) {
|
||||||
auto package_name = item.package;
|
auto package_name = item.package;
|
||||||
std::replace(package_name.begin(), package_name.end(), '.', '-');
|
std::replace(package_name.begin(), package_name.end(), '.', '-');
|
||||||
|
|
||||||
const auto item_path =
|
const auto item_path = path_ / utils::string_format("anbox-%s.desktop", package_name);
|
||||||
path_ / utils::string_format("anbox-%s.desktop", package_name);
|
const auto item_icon_path = icon_path_ / utils::string_format("anbox-%s.png", package_name);
|
||||||
const auto item_icon_path =
|
|
||||||
icon_path_ / utils::string_format("anbox-%s.png", package_name);
|
|
||||||
|
|
||||||
std::string exec = utils::string_format("%s launch ", utils::process_get_exe_path(getpid()));
|
std::string exec = utils::string_format("%s launch ", utils::process_get_exe_path(getpid()));
|
||||||
|
|
||||||
|
|
@ -68,21 +66,23 @@ void LauncherStorage::add(const Item &item) {
|
||||||
exec += utils::string_format("--package=%s ", item.launch_intent.package);
|
exec += utils::string_format("--package=%s ", item.launch_intent.package);
|
||||||
|
|
||||||
if (!item.launch_intent.component.empty())
|
if (!item.launch_intent.component.empty())
|
||||||
exec +=
|
exec += utils::string_format("--component=%s ", item.launch_intent.component);
|
||||||
utils::string_format("--component=%s ", item.launch_intent.component);
|
|
||||||
|
|
||||||
std::ofstream f(item_path.string());
|
if (auto desktop_item = std::ofstream(item_path.string())) {
|
||||||
f << "[Desktop Entry]" << std::endl
|
desktop_item << "[Desktop Entry]" << std::endl
|
||||||
<< "Name=" << item.package << std::endl
|
<< "Name=" << item.package << std::endl
|
||||||
<< "Exec=" << exec << std::endl
|
<< "Exec=" << exec << std::endl
|
||||||
<< "Terminal=false" << std::endl
|
<< "Terminal=false" << std::endl
|
||||||
<< "Type=Application" << std::endl
|
<< "Type=Application" << std::endl
|
||||||
<< "Icon=" << item_icon_path.string() << std::endl;
|
<< "Icon=" << item_icon_path.string() << std::endl;
|
||||||
f.close();
|
} else {
|
||||||
|
BOOST_THROW_EXCEPTION(std::runtime_error("Failed to create desktop item"));
|
||||||
|
}
|
||||||
|
|
||||||
f = std::ofstream(item_icon_path.string());
|
if (auto icon = std::ofstream(item_icon_path.string()))
|
||||||
f.write(item.icon.data(), item.icon.size());
|
icon.write(item.icon.data(), item.icon.size());
|
||||||
f.close();
|
else
|
||||||
|
BOOST_THROW_EXCEPTION(std::runtime_error("Failed to write icon"));
|
||||||
}
|
}
|
||||||
} // namespace application
|
} // namespace application
|
||||||
} // namespace anbox
|
} // namespace anbox
|
||||||
|
|
|
||||||
|
|
@ -81,9 +81,6 @@ anbox::cmds::Run::Run(const BusFactory &bus_factory)
|
||||||
flag(cli::make_flag(cli::Name{"desktop_file_hint"},
|
flag(cli::make_flag(cli::Name{"desktop_file_hint"},
|
||||||
cli::Description{"Desktop file hint for QtMir/Unity8"},
|
cli::Description{"Desktop file hint for QtMir/Unity8"},
|
||||||
desktop_file_hint_));
|
desktop_file_hint_));
|
||||||
flag(cli::make_flag(cli::Name{"icon"},
|
|
||||||
cli::Description{"Icon of the application to run"},
|
|
||||||
icon_));
|
|
||||||
|
|
||||||
action([this](const cli::Command::Context &) {
|
action([this](const cli::Command::Context &) {
|
||||||
auto trap = core::posix::trap_signals_for_process(
|
auto trap = core::posix::trap_signals_for_process(
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ class Run : public cli::CommandWithFlagsAndAction {
|
||||||
private:
|
private:
|
||||||
BusFactory bus_factory_;
|
BusFactory bus_factory_;
|
||||||
std::string desktop_file_hint_;
|
std::string desktop_file_hint_;
|
||||||
std::string icon_;
|
|
||||||
};
|
};
|
||||||
} // namespace cmds
|
} // namespace cmds
|
||||||
} // namespace anbox
|
} // namespace anbox
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ TEST(BufferedIOStream, CommitBufferWritesOutToMessenger) {
|
||||||
auto messenger = std::make_shared<MockSocketMessenger>();
|
auto messenger = std::make_shared<MockSocketMessenger>();
|
||||||
BufferedIOStream stream(messenger);
|
BufferedIOStream stream(messenger);
|
||||||
|
|
||||||
const auto buffer_size{1000};
|
const size_t buffer_size{1000};
|
||||||
// We will write out the data we get in two junks of half the size
|
// We will write out the data we get in two junks of half the size
|
||||||
// the original buffer has.
|
// the original buffer has.
|
||||||
EXPECT_CALL(*messenger, send_raw(_, buffer_size))
|
EXPECT_CALL(*messenger, send_raw(_, buffer_size))
|
||||||
|
|
@ -75,8 +75,8 @@ TEST(BufferedIOStream, WriterContinuesWhenSocketIsBusy) {
|
||||||
auto messenger = std::make_shared<MockSocketMessenger>();
|
auto messenger = std::make_shared<MockSocketMessenger>();
|
||||||
BufferedIOStream stream(messenger);
|
BufferedIOStream stream(messenger);
|
||||||
|
|
||||||
const auto buffer_size{1000};
|
const size_t buffer_size{1000};
|
||||||
const auto first_chunk_size{100};
|
const size_t first_chunk_size{100};
|
||||||
// The writer will check the error code of the send function
|
// The writer will check the error code of the send function
|
||||||
// and will retry writing the next chunk when it doesn't get
|
// and will retry writing the next chunk when it doesn't get
|
||||||
// EAGAIN anymore from the sender.
|
// EAGAIN anymore from the sender.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue