Add $LINUXDEPLOY for input plugins

The input plugins can use this environment variable to call linuxdeploy themselves. This can be very handy to have it deploy additional dependencies on libraries they copy themselves.

An alternative approach is to simply use liblinuxdeploy inside the plugin, like the Qt plugin does.
This commit is contained in:
TheAssassin
2020-05-03 18:32:55 +02:00
parent 2af54304e2
commit f24c167722
+15 -1
View File
@@ -11,6 +11,7 @@
// local headers
#include "linuxdeploy/core/log.h"
#include "linuxdeploy/util/util.h"
#pragma once
@@ -136,8 +137,21 @@ namespace linuxdeploy {
}
log << std::endl;
auto process = subprocess::Popen(args, subprocess::output{subprocess::PIPE}, subprocess::error{subprocess::PIPE});
std::map<std::string, std::string> environmentVariables{};
if (this->pluginType() == PLUGIN_TYPE::INPUT_TYPE) {
// add $LINUXDEPLOY, which points to the current binary
// we do not need to pass $APPIMAGE or alike, since while linuxdeploy is running, the path in the
// temporary mountpoint of its AppImage will be valid anyway
environmentVariables["LINUXDEPLOY"] = linuxdeploy::util::getOwnExecutablePath();
}
auto process = subprocess::Popen(
args,
subprocess::output{subprocess::PIPE},
subprocess::error{subprocess::PIPE},
subprocess::environment{environmentVariables}
);
std::vector<pollfd> pfds(2);
auto* opfd = &pfds[0];