mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
help: Show security notice when backports are in use
Closes #1611. Signed-off-by: James Valleroy <jvalleroy@mailbox.org> [sunil@medhas.org: Fixed incorrect HTML nesting and inline styling] Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
9d39225098
commit
a0837be410
@ -20,6 +20,7 @@ Help app for FreedomBox.
|
|||||||
|
|
||||||
import mimetypes
|
import mimetypes
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from apt.cache import Cache
|
from apt.cache import Cache
|
||||||
from django.core.files.base import File
|
from django.core.files.base import File
|
||||||
@ -83,7 +84,8 @@ def about(request):
|
|||||||
'title': _('About {box_name}').format(box_name=_(cfg.box_name)),
|
'title': _('About {box_name}').format(box_name=_(cfg.box_name)),
|
||||||
'version': __version__,
|
'version': __version__,
|
||||||
'new_version': not freedombox.candidate.is_installed,
|
'new_version': not freedombox.candidate.is_installed,
|
||||||
'os_release': get_os_release()
|
'os_release': get_os_release(),
|
||||||
|
'backports_in_use': get_backports_in_use(),
|
||||||
}
|
}
|
||||||
return TemplateResponse(request, 'help_about.html', context)
|
return TemplateResponse(request, 'help_about.html', context)
|
||||||
|
|
||||||
@ -143,3 +145,16 @@ def get_os_release():
|
|||||||
line = line.split('=')
|
line = line.split('=')
|
||||||
output = line[1]
|
output = line[1]
|
||||||
return output
|
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
|
||||||
|
|||||||
@ -90,4 +90,16 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</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 %}
|
{% endblock %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user