diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2018-10-05 12:29:39 +0200 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2018-10-09 11:36:47 +0200 |
commit | 02f6a9b4e5f8239e0dfa64ba79e426005a5dec56 (patch) | |
tree | 9201ee3401ad7c3cf7ab51ef5eea9363b17597ce /apt-pkg/contrib/fileutl.cc | |
parent | 1a9a1a4a753bb5aa118188b842d7a10abe4d27b6 (diff) |
Set DPKG_FRONTEND_LOCKED when running {pre,post}-invoke scripts
Some post-invoke scripts install packages, which fails because
the environment variable is not set. This sets the variable for
all three kinds of scripts {pre,post-}invoke and pre-install-pkgs,
but we will only allow post-invoke at a later time.
Gbp-Dch: full
(cherry picked from commit 6675601c81de85b40dc89772c1d6d17f1811c5ba)
LP: #1796808
(cherry picked from commit 0ce6bc5ec70ff84eb2829f91f286a93687e77a46)
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index b53277577..5d283bdf5 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -26,6 +26,7 @@ #include <apt-pkg/aptconfiguration.h> #include <apt-pkg/configuration.h> #include <apt-pkg/macros.h> +#include <apt-pkg/pkgsystem.h> #include <ctype.h> #include <stdarg.h> @@ -97,6 +98,8 @@ bool RunScripts(const char *Cnf) // This is the child if (Child == 0) { + if (_system != nullptr && _system->IsLocked() == true && (stringcasecmp(Cnf, "dpkg::post-invoke") == 0 || stringcasecmp(Cnf, "dpkg::pre-invoke") == 0)) + setenv("DPKG_FRONTEND_LOCKED", "true", 1); if (_config->FindDir("DPkg::Chroot-Directory","/") != "/") { std::cerr << "Chrooting into " |