diff --git a/include/linuxdeploy/plugin/base_impl.h b/include/linuxdeploy/plugin/base_impl.h index e9b0861..fd9e92a 100644 --- a/include/linuxdeploy/plugin/base_impl.h +++ b/include/linuxdeploy/plugin/base_impl.h @@ -124,7 +124,7 @@ namespace linuxdeploy { auto log = linuxdeploy::core::log::ldLog(); log << "Running process:"; for (const auto& arg : args) { - log << arg; + log << "" << arg; } log << std::endl; diff --git a/src/core/main.cpp b/src/core/main.cpp index 0652075..10554e1 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -42,6 +42,7 @@ int main(int argc, char** argv) { args::ValueFlag customAppRunPath(parser, "AppRun path", "Path to custom AppRun script (linuxdeploy will not create a symlink but copy this file instead)", {"custom-apprun"}); args::Flag listPlugins(parser, "", "Search for plugins, print them to stdout and exit", {"list-plugins"}); + args::ValueFlagList outputPlugins(parser, "name", "Output plugins to run (check whether they are available with --list-plugins)", {'o', "output"}); try { parser.ParseCLI(argc, argv); @@ -235,5 +236,33 @@ int main(int argc, char** argv) { } } + if (outputPlugins) { + for (const auto& pluginName : outputPlugins.Get()) { + auto it = foundPlugins.find(std::string(pluginName)); + + if (it == foundPlugins.end()) { + ldLog() << LD_ERROR << "Could not find plugin:" << pluginName; + return 1; + } + + auto plugin = it->second; + + if (plugin->pluginType() != linuxdeploy::plugin::OUTPUT_TYPE) { + ldLog() << LD_ERROR << "Plugin" << pluginName << "has wrong type:" << plugin->pluginType() << std::endl; + return 1; + } + + ldLog() << std::endl << "-- Running output plugin:" << pluginName << "--" << std::endl; + + auto retcode = plugin->run(appDir.path()); + + if (retcode != 0) { + ldLog() << LD_ERROR << "Failed to run plugin:" << pluginName << std::endl; + ldLog() << LD_DEBUG << "Exited with return code:" << retcode << std::endl; + return 1; + } + } + } + return 0; }