From c1607f538559a0b7a1d3f9dc01e88190e543053d Mon Sep 17 00:00:00 2001 From: Nathan Pratta Teodosio Date: Tue, 17 Feb 2026 10:42:13 +0100 Subject: Prevent sleep while running dpkg. As long as we are running dpkg, keep an inhibitor that blocks us from sleeping. --- apt-pkg/deb/dpkgpm.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'apt-pkg/deb/dpkgpm.cc') 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() { -- cgit v1.2.3-70-g09d2