summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2026-02-17 10:34:54 +0000
committerJulian Andres Klode <jak@debian.org>2026-02-17 10:34:54 +0000
commitbed35523705eb21a6a2e5bfa45dcabd91d50ef21 (patch)
treef9af332ce9d5d44b20d0a5a328793e2419ec1bca /apt-pkg
parenta33e3e3db6adcc7f324081afbb7e2510aec2002c (diff)
parentc1607f538559a0b7a1d3f9dc01e88190e543053d (diff)
Merge branch 'main' into 'main'
Prevent sleep while running dpkg. See merge request apt-team/apt!554
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/dpkgpm.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 09f3e4783..0f2467607 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -1516,8 +1516,15 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
int Fd = -1;
Inhibitor()
{
- if (_config->FindB("DPkg::Inhibit-Shutdown", true))
- Fd = Inhibit("shutdown", "APT", "APT is installing or removing packages", "block");
+ std::string to_inhibit;
+ if (_config->FindB("DPkg::Inhibit-Shutdown", true))
+ to_inhibit.append("shutdown:");
+ if (_config->FindB("DPkg::Inhibit-Sleep", true))
+ to_inhibit.append("sleep:");
+ // Remove trailing : separator
+ if (to_inhibit.length() > 0)
+ to_inhibit.pop_back();
+ Fd = Inhibit(to_inhibit.c_str(), "APT", "APT is installing or removing packages", "block");
}
~Inhibitor()
{