mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
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:
1 parent
6b0744c1c7
commit
ca91120fdc
2 files changed
+19
-3
No files matched your search
@@ -3,6 +3,7 @@
|
||||
FreedomBox app for upgrades.
|
||||
"""
|
||||
|
||||
from aptsources import sourceslist
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
@@ -143,9 +144,24 @@ def is_backports_enabled():
|
||||
return os.path.exists(SOURCES_LIST)
|
||||
|
||||
|
||||
def is_backports_current():
|
||||
"""Return whether backports are enabled for the current release."""
|
||||
if not is_backports_enabled:
|
||||
return False
|
||||
|
||||
dist = subprocess.check_output(['lsb_release', '--codename', '--short'
|
||||
]).decode().strip() + '-backports'
|
||||
sources = sourceslist.SourcesList()
|
||||
for source in sources:
|
||||
if source.dist == dist:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def can_activate_backports():
|
||||
"""Return whether backports can be activated."""
|
||||
if is_backports_enabled():
|
||||
if is_backports_current():
|
||||
return False
|
||||
|
||||
release = subprocess.check_output(['lsb_release', '--release',
|
||||
|
||||
Reference in new issue
Block a user