From a998995f36b124091d35196cf0799867ec27e0be Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 7 Oct 2024 05:40:32 -0700 Subject: [PATCH] upgrades: Remove step upgrade during first setup - Remove the first setup wizard step to run security upgrades. At the time of its introduction, it was felt that this is very important. Some things have changed since then: - We have mechanism for queuing package operations. Users can now trigger software updates and start installing apps before that is completed. Or vice versa. Earlier if the software updates were running, app install used to fail with an error. - There were no notifications. Since then we have added 'first setup' notification for important topics such as Privacy. This step can be replaced with a notification. - Automatic diagnostics and a diagnostic to notify of updated packages also helps bring attention to software updates if they are missed during first setup. - A proposed change will re-introduce an advice to run updates in the 'Next steps' wizard step along with a button trigger it right there. - The new notification for software updates will bring more attention to running updates as part of first setup. - It would be nice not be stuck in the first setup wizard for a long period and make it look simple. It improves the fun factor of setting up FreedomBox. - It would present an opportunity to utilize the parallel installation of apps/updates to the full extent. Although this can also be done by skipping the progress step after updates are run. - First wizard steps tend to get less testing. Tests: - Run the first setup wizard by removing /var/lib/plinth/plinth.sqlite3 and running the service. Notice that the software update step is not shown and wizard completes successfully. - On stable container, backports step is shown as expected (if not already enabled). Signed-off-by: Sunil Mohan Adapa Reviewed-by: Veiko Aasa --- plinth/modules/upgrades/__init__.py | 5 --- plinth/modules/upgrades/forms.py | 6 --- .../templates/update-firstboot-progress.html | 42 ------------------ .../upgrades/templates/update-firstboot.html | 36 --------------- plinth/modules/upgrades/urls.py | 5 --- plinth/modules/upgrades/views.py | 44 +------------------ plinth/tests/functional/__init__.py | 4 -- 7 files changed, 1 insertion(+), 141 deletions(-) delete mode 100644 plinth/modules/upgrades/templates/update-firstboot-progress.html delete mode 100644 plinth/modules/upgrades/templates/update-firstboot.html diff --git a/plinth/modules/upgrades/__init__.py b/plinth/modules/upgrades/__init__.py index e0e9ba80a..34bb13dd0 100644 --- a/plinth/modules/upgrades/__init__.py +++ b/plinth/modules/upgrades/__init__.py @@ -27,11 +27,6 @@ first_boot_steps = [ 'url': 'upgrades:backports-firstboot', 'order': 5, }, - { - 'id': 'initial_update', - 'url': 'upgrades:update-firstboot', - 'order': 6, - }, ] _description = [ diff --git a/plinth/modules/upgrades/forms.py b/plinth/modules/upgrades/forms.py index c97688a43..390963512 100644 --- a/plinth/modules/upgrades/forms.py +++ b/plinth/modules/upgrades/forms.py @@ -33,9 +33,3 @@ class BackportsFirstbootForm(forms.Form): backports_enabled = forms.BooleanField( label=_('Activate frequent feature updates (recommended)'), required=False, initial=True) - - -class UpdateFirstbootForm(forms.Form): - """Form to run or skip initial update during first boot wizard.""" - update_now = forms.BooleanField(label=_('Update now (recommended)'), - required=False, initial=True) diff --git a/plinth/modules/upgrades/templates/update-firstboot-progress.html b/plinth/modules/upgrades/templates/update-firstboot-progress.html deleted file mode 100644 index 1082ebc46..000000000 --- a/plinth/modules/upgrades/templates/update-firstboot-progress.html +++ /dev/null @@ -1,42 +0,0 @@ -{% extends "base_firstboot.html" %} -{% comment %} -# SPDX-License-Identifier: AGPL-3.0-or-later -{% endcomment %} - -{% load bootstrap %} -{% load i18n %} -{% load static %} - -{% block content %} -

{% trans "Software Update" %}

- - {% if is_busy %} -
-
- -
-

- {% trans "Updating, please wait..." %} -

-

- {% blocktrans trimmed %} - This may take a long time to complete. During - an update, this web interface may be temporarily unavailable and - show an error. In that case, refresh the page to continue. - {% endblocktrans %} -

-
- {% else %} -

- {% blocktrans %} - {{ box_name }} is up to date. Press Next to continue. - {% endblocktrans %} -

- - {% trans 'Next' %} - - {% endif %} - -{% endblock %} diff --git a/plinth/modules/upgrades/templates/update-firstboot.html b/plinth/modules/upgrades/templates/update-firstboot.html deleted file mode 100644 index 374c6bf95..000000000 --- a/plinth/modules/upgrades/templates/update-firstboot.html +++ /dev/null @@ -1,36 +0,0 @@ -{% extends "base_firstboot.html" %} -{% comment %} -# SPDX-License-Identifier: AGPL-3.0-or-later -{% endcomment %} - -{% load bootstrap %} -{% load i18n %} -{% load static %} - -{% block content %} -

{% trans "Software Update" %}

- -

- {% blocktrans trimmed %} - Check for and apply the latest software and security updates. - {% endblocktrans %} -

- -

- {% blocktrans trimmed %} - This may take a long time to complete. During - an update, this web interface may be temporarily unavailable and - show an error. In that case, refresh the page to continue. - {% endblocktrans %} -

- -
- {% csrf_token %} - - {{ form|bootstrap }} - - -
- -{% endblock %} diff --git a/plinth/modules/upgrades/urls.py b/plinth/modules/upgrades/urls.py index 807ebb328..15955bd91 100644 --- a/plinth/modules/upgrades/urls.py +++ b/plinth/modules/upgrades/urls.py @@ -15,11 +15,6 @@ urlpatterns = [ re_path(r'^sys/upgrades/firstboot/backports/$', views.BackportsFirstbootView.as_view(), name='backports-firstboot'), - re_path(r'^sys/upgrades/firstboot/update/$', - views.UpdateFirstbootView.as_view(), name='update-firstboot'), - re_path(r'^sys/upgrades/firstboot/update/progress/$', - views.UpdateFirstbootProgressView.as_view(), - name='update-firstboot-progress'), re_path(r'^sys/upgrades/upgrade/$', views.upgrade, name='upgrade'), re_path(r'^sys/upgrades/test-dist-upgrade/$', views.test_dist_upgrade, name='test-dist-upgrade'), diff --git a/plinth/modules/upgrades/views.py b/plinth/modules/upgrades/views.py index fc1d919c8..7488827b6 100644 --- a/plinth/modules/upgrades/views.py +++ b/plinth/modules/upgrades/views.py @@ -9,7 +9,6 @@ from django.http import HttpResponseRedirect from django.shortcuts import redirect from django.urls import reverse_lazy from django.utils.translation import gettext as _ -from django.views.generic import TemplateView from django.views.generic.edit import FormView from plinth import __version__ @@ -18,7 +17,7 @@ from plinth.privileged import packages as packages_privileged from plinth.views import AppView, messages_error from . import privileged -from .forms import BackportsFirstbootForm, ConfigureForm, UpdateFirstbootForm +from .forms import BackportsFirstbootForm, ConfigureForm class UpgradesConfigurationView(AppView): @@ -170,47 +169,6 @@ class BackportsFirstbootView(FormView): return super().form_valid(form) -class UpdateFirstbootView(FormView): - """View to run initial update during first boot wizard.""" - - template_name = 'update-firstboot.html' - form_class = UpdateFirstbootForm - - def __init__(self): - """Define instance attribute.""" - self.update = True - - def get_success_url(self): - """Return next firstboot step.""" - if self.update: - return reverse_lazy('upgrades:update-firstboot-progress') - - return reverse_lazy(first_boot.next_step()) - - def form_valid(self, form): - """Run update if selected, and mark step as done.""" - self.update = form.cleaned_data['update_now'] - if self.update: - privileged.run() - - first_boot.mark_step_done('initial_update') - return super().form_valid(form) - - -class UpdateFirstbootProgressView(TemplateView): - """View to show initial update progress.""" - - template_name = 'update-firstboot-progress.html' - - def get_context_data(self, *args, **kwargs): - context = super().get_context_data(*args, **kwargs) - context['is_busy'] = (_is_updating() - or packages_privileged.is_package_manager_busy()) - context['next_step'] = first_boot.next_step() - context['refresh_page_sec'] = 3 if context['is_busy'] else None - return context - - def test_dist_upgrade(request): """Test dist-upgrade from stable to testing.""" if request.method == 'POST': diff --git a/plinth/tests/functional/__init__.py b/plinth/tests/functional/__init__.py index 0eee46ef2..57ed0a91e 100644 --- a/plinth/tests/functional/__init__.py +++ b/plinth/tests/functional/__init__.py @@ -354,10 +354,6 @@ def login_with_account(browser, url, username, password=None): if '/firstboot/backports' in browser.url: submit(browser, element=browser.find_by_name('next')[0]) - if '/firstboot/update' in browser.url: - browser.find_by_id('id_update_now').uncheck() - submit(browser, element=browser.find_by_name('next')[0]) - def logout(browser): """Log out of the FreedomBox interface."""