security: Move backports notice to security page

Move get_backports_in_use to upgrades.

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:42:29 -07:00
1 parent d042c3c60c
commit f41cc116a1
5 files changed
+34 -32

No files matched your search

@@ -74,17 +74,4 @@
{% endblocktrans %}
{% endif %}
</p>
{% if backports_in_use %}
<h3>{% trans "Security Notice" %}</h3>
<p>
{% blocktrans trimmed %}
You are using packages from Debian backports. Please note that these
packages do not have security support from Debian. However, they are
maintained on a best-effort basis by contributors in Debian and
FreedomBox community.
{% endblocktrans %}
</p>
{% endif %}
{% endblock %}
-15
View File
@@ -6,7 +6,6 @@ Help app for FreedomBox.
import mimetypes
import os
import pathlib
import subprocess
from apt.cache import Cache
from django.core.files.base import File
@@ -52,7 +51,6 @@ def about(request):
'version': __version__,
'new_version': not freedombox.candidate.is_installed,
'os_release': get_os_release(),
'backports_in_use': get_backports_in_use(),
}
return TemplateResponse(request, 'help_about.html', context)
@@ -134,16 +132,3 @@ def get_os_release():
line = line.split('=')
output = line[1]
return output
def get_backports_in_use():
"""Return whether backports packages are installed."""
# Only freedombox package is set to be installed from backports currently.
output = subprocess.check_output(['apt-cache', 'policy', 'freedombox'])
for line in output.decode().split('\n'):
if 'Installed:' in line:
version = line.strip().split(': ')[1]
if 'bpo' in version:
return True
return False