diff options
| author | Nathan Pratta Teodosio <nathan.teodosio@canonical.com> | 2026-02-17 10:42:13 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2026-02-17 10:34:47 +0000 |
| commit | c1607f538559a0b7a1d3f9dc01e88190e543053d (patch) | |
| tree | f9af332ce9d5d44b20d0a5a328793e2419ec1bca /apt-pkg | |
| parent | a33e3e3db6adcc7f324081afbb7e2510aec2002c (diff) | |
Prevent sleep while running dpkg.
As long as we are running dpkg, keep an inhibitor that
blocks us from sleeping.
Diffstat (limited to 'apt-pkg')
| -rw-r--r-- | apt-pkg/deb/dpkgpm.cc | 11 |
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() { |
