summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/dpkgpm.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 3c707e220..ffa880df2 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -1463,6 +1463,21 @@ bool pkgDPkgPM::ExpandPendingCalls(std::vector<Item> &List, pkgDepCache &Cache)
}
bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
{
+ struct Inhibitor
+ {
+ int Fd = -1;
+ Inhibitor()
+ {
+ if (_config->FindB("DPkg::Inhibit-Shutdown", true))
+ Fd = Inhibit("shutdown", "APT", "APT is installing or removing packages", "block");
+ }
+ ~Inhibitor()
+ {
+ if (Fd > 0)
+ close(Fd);
+ }
+ } inhibitor;
+
// explicitly remove&configure everything for hookscripts and progress building
// we need them only temporarily through, so keep the length and erase afterwards
decltype(List)::const_iterator::difference_type explicitIdx =