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 <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa 2024-10-07 05:40:32 -07:00 committed by Veiko Aasa
parent d0d53edce0
commit a998995f36
No known key found for this signature in database
GPG Key ID: 478539CAE680674E
7 changed files with 1 additions and 141 deletions

View File

@ -27,11 +27,6 @@ first_boot_steps = [
'url': 'upgrades:backports-firstboot',
'order': 5,
},
{
'id': 'initial_update',
'url': 'upgrades:update-firstboot',
'order': 6,
},
]
_description = [

View File

@ -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)

View File

@ -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 %}
<h2>{% trans "Software Update" %}</h2>
{% if is_busy %}
<div class="upgrades-status-frame clearfix">
<div class="upgrade-status-icon pull-left">
<span class="fa fa-refresh fa-spin fa-3x fa-pull-left processing"></span>
</div>
<p>
<strong>{% trans "Updating, please wait..." %}</strong>
</p>
<p>
{% blocktrans trimmed %}
<strong>This may take a long time to complete.</strong> During
an update, this web interface may be temporarily unavailable and
show an error. In that case, refresh the page to continue.
{% endblocktrans %}
</p>
</div>
{% else %}
<p>
{% blocktrans %}
{{ box_name }} is up to date. Press Next to continue.
{% endblocktrans %}
</p>
<a title="{% trans 'Next' %}"
role="button" class="btn btn-primary"
href={% url next_step %}>
{% trans 'Next' %}
</a>
{% endif %}
{% endblock %}

View File

@ -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 %}
<h2>{% trans "Software Update" %}</h2>
<p>
{% blocktrans trimmed %}
Check for and apply the latest software and security updates.
{% endblocktrans %}
</p>
<p>
{% blocktrans trimmed %}
<strong>This may take a long time to complete.</strong> During
an update, this web interface may be temporarily unavailable and
show an error. In that case, refresh the page to continue.
{% endblocktrans %}
</p>
<form class="form" method="post">
{% csrf_token %}
{{ form|bootstrap }}
<input type="submit" class="btn btn-primary" name="next"
value="{% trans "Next" %}"/>
</form>
{% endblock %}

View File

@ -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'),

View File

@ -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':

View File

@ -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."""