upgrades: Check that backports is for current release

- If backports is for older release, then it can be activated again to
  upgrade to latest release. (Plan is to make this automatic, but
  leave the manual option as a fallback.)

- Security notice still shown if older backports are enabled.

Tests:

- On Buster system, change distribution in
  /etc/apt/sources.list.d/freedombox2.list to
  stretch-backports. Updates page shows button to activate backports
  again. Activate and check the source list to confirm that it has
  buster-backports again.

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy authored and Sunil Mohan Adapa committed 2020-07-13 14:44:16 -07:00
1 parent 6b0744c1c7
commit ca91120fdc
2 files changed
+19 -3

No files matched your search

+2 -2
View File
@@ -13,7 +13,7 @@ import sys
from plinth.action_utils import run_apt_command
from plinth.modules.apache.components import check_url
from plinth.modules.upgrades import is_backports_enabled, SOURCES_LIST
from plinth.modules.upgrades import is_backports_current, SOURCES_LIST
AUTO_CONF_FILE = '/etc/apt/apt.conf.d/20auto-upgrades'
LOG_FILE = '/var/log/unattended-upgrades/unattended-upgrades.log'
@@ -193,7 +193,7 @@ def _check_and_backports_sources():
if os.path.exists(old_sources_list):
os.remove(old_sources_list)
if is_backports_enabled():
if is_backports_current():
print('Repositories list up-to-date. Skipping update.')
return