Comment 1 for bug 377697

Revision history for this message
Peter Cordes (peter-cordes) wrote :

That's a good idea. It might be good if this was at a low enough level in apt that aptitude, and even apt-get, could prompt, too. (or just warn if non-interactive).

 Download speed is very hard to predict, and could take a _really_ long time. So it would be smart to check battery status after download but before install. Alway warn at that point if you're on batteries, but if there is lots of battery left and few updates, don't hold up the process by waiting for user input.

 A good heuristic might be: Get time until battery-critical shutdown (from ACPI on PC hardware...). Estimate update install time very conservatively (in case of slow discs and/or competing I/O load) as 5s per package + 10s per uncompressed MB. (made-up numbers, not based on any measurements.) Some packages have time-consuming post-install scripts; another reason for a conservative estimate.

  If install time > (battery - 10min), wait for user confirmation. This is after download. But always warn when on battery before starting to download, in case the user goes away right after starting the download.

 The extra heuristics for forcing user confirmation before actually installing when on battery may be excessive, but a forced shutdown during an update could cause a really big problem. (most laptops support suspend or hibernate, but some may resort to shutdown -h now.)