#include <stddef.h>
#include <algorithm>
+#include <fstream>
#include <iostream>
#include <string>
#include <vector>
int const &statusfd, int fd[2], std::string const &key)
{
#define EINTERNAL 111
- std::string const aptkey = _config->Find("Dir::Bin::apt-key", "/usr/bin/apt-key");
+ std::string const aptkey = _config->Find("Dir::Bin::apt-key", CMAKE_INSTALL_FULL_BINDIR "/apt-key");
bool const Debug = _config->FindB("Debug::Acquire::gpgv", false);
struct exiter {
std::vector<std::string> dataHeader;
char * sig = NULL;
char * data = NULL;
+ char * conf = nullptr;
+
+ // Dump the configuration so apt-key picks up the correct Dir values
+ {
+ conf = GenerateTemporaryFileTemplate("apt.conf");
+ if (conf == nullptr) {
+ ioprintf(std::cerr, "Couldn't create tempfile names for passing config to apt-key");
+ local_exit(EINTERNAL);
+ }
+ int confFd = mkstemp(conf);
+ if (confFd == -1) {
+ ioprintf(std::cerr, "Couldn't create temporary file %s for passing config to apt-key", conf);
+ local_exit(EINTERNAL);
+ }
+ local_exit.files.push_back(conf);
+
+ std::ofstream confStream(conf);
+ close(confFd);
+ _config->Dump(confStream);
+ confStream.close();
+ setenv("APT_CONFIG", conf, 1);
+ }
if (releaseSignature == DETACHED)
{