summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/dpkgpm.cc
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/deb/dpkgpm.cc')
-rw-r--r--apt-pkg/deb/dpkgpm.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 7a3d1d1f4..05bee9286 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -1232,6 +1232,22 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
return (I.Pkg->Flags & pkgCache::Flag::Essential) != 0;
};
+ 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;
+
+
pkgPackageManager::SigINTStop = false;
d->progress = progress;