summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-extracttemplates.cc34
-rw-r--r--cmdline/apt-get.cc1
-rw-r--r--cmdline/apt.cc1
3 files changed, 13 insertions, 23 deletions
diff --git a/cmdline/apt-extracttemplates.cc b/cmdline/apt-extracttemplates.cc
index bd23453f3..bc8a27dbe 100644
--- a/cmdline/apt-extracttemplates.cc
+++ b/cmdline/apt-extracttemplates.cc
@@ -229,29 +229,13 @@ static bool ShowHelp(CommandLine &) /*{{{*/
/* */
static string WriteFile(const char *package, const char *prefix, const char *data)
{
- char fn[512];
-
- std::string tempdir = GetTempDir();
- snprintf(fn, sizeof(fn), "%s/%s.%s.XXXXXX",
- _config->Find("APT::ExtractTemplates::TempDir",
- tempdir.c_str()).c_str(),
- package, prefix);
- FileFd f;
- if (data == NULL)
- data = "";
- int fd = mkstemp(fn);
- if (fd < 0) {
- _error->Errno("ofstream::ofstream",_("Unable to mkstemp %s"),fn);
- return string();
- }
- if (!f.OpenDescriptor(fd, FileFd::WriteOnly, FileFd::None, true))
- {
- _error->Errno("ofstream::ofstream",_("Unable to write to %s"),fn);
- return string();
- }
- f.Write(data, strlen(data));
- f.Close();
- return fn;
+ FileFd f;
+ std::string tplname;
+ strprintf(tplname, "%s.%s", package, prefix);
+ GetTempFile(tplname, false, &f);
+ if (data != nullptr)
+ f.Write(data, strlen(data));
+ return f.Name();
}
/*}}}*/
// WriteConfig - write out the config data from a debian package file /*{{{*/
@@ -289,6 +273,10 @@ static bool Go(CommandLine &CmdL)
if (debconfver.empty() == true)
return _error->Error( _("Cannot get debconf version. Is debconf installed?"));
+ auto const tmpdir = _config->Find("APT::ExtractTemplates::TempDir");
+ if (tmpdir.empty() == false)
+ setenv("TMPDIR", tmpdir.c_str(), 1);
+
// Process each package passsed in
for (unsigned int I = 0; I != CmdL.FileSize(); I++)
{
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 6d25ed509..da18d2d19 100644
--- a/cmdline/apt-get.cc
+++ b/cmdline/apt-get.cc
@@ -405,6 +405,7 @@ static std::vector<aptDispatchWithHelp> GetCommands() /*{{{*/
{"update", &DoUpdate, _("Retrieve new lists of packages")},
{"upgrade", &DoUpgrade, _("Perform an upgrade")},
{"install", &DoInstall, _("Install new packages (pkg is libc6 not libc6.deb)")},
+ {"reinstall", &DoInstall, _("Reinstall packages (pkg is libc6 not libc6.deb)")},
{"remove", &DoInstall, _("Remove packages")},
{"purge", &DoInstall, _("Remove packages and config files")},
{"autoremove", &DoInstall, _("Remove automatically all unused packages")},
diff --git a/cmdline/apt.cc b/cmdline/apt.cc
index f508406d1..d388e4af4 100644
--- a/cmdline/apt.cc
+++ b/cmdline/apt.cc
@@ -63,6 +63,7 @@ static std::vector<aptDispatchWithHelp> GetCommands() /*{{{*/
// package stuff
{"install", &DoInstall, _("install packages")},
+ {"reinstall", &DoInstall, _("reinstall packages")},
{"remove", &DoInstall, _("remove packages")},
{"autoremove", &DoInstall, _("Remove automatically all unused packages")},
{"auto-remove", &DoInstall, nullptr},