mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-04 08:13:38 +00:00
first-setup: Automatically expand root partition
- Show expansion option in the UI only if the partition expansion failed during first setup. Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
db5a66c1d0
commit
3940868f21
@ -27,7 +27,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from plinth import actions
|
||||
from plinth.menu import main_menu
|
||||
|
||||
version = 1
|
||||
version = 2
|
||||
|
||||
name = _('Storage')
|
||||
|
||||
@ -39,6 +39,8 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
manual_page = 'Storage'
|
||||
|
||||
is_essential = True
|
||||
|
||||
|
||||
def init():
|
||||
"""Intialize the module."""
|
||||
@ -164,3 +166,11 @@ def format_bytes(size):
|
||||
|
||||
size /= 1024**4
|
||||
return _('{disk_size:.1f} TiB').format(disk_size=size)
|
||||
|
||||
|
||||
def setup(helper, old_version=None):
|
||||
"""Expand root parition on first setup."""
|
||||
disks = get_disks()
|
||||
root_device = get_root_device(disks)
|
||||
if is_expandable(root_device):
|
||||
expand_partition(root_device)
|
||||
|
||||
@ -83,8 +83,8 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3>{% trans "Partition Expansion" %}</h3>
|
||||
{% if expandable_root_size %}
|
||||
<h3>{% trans "Partition Expansion" %}</h3>
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
There is {{ expandable_root_size }} of unallocated space
|
||||
@ -98,18 +98,6 @@
|
||||
role="button">
|
||||
{% trans "Expand Root Partition" %}</a>
|
||||
</p>
|
||||
{% else %}
|
||||
<p>
|
||||
{% blocktrans trimmed %}
|
||||
There is no unallocated space after your root partition.
|
||||
There is no need to expand it.
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
<p>
|
||||
<a class="btn btn-primary btn-md disabled"
|
||||
href="{% url 'storage:expand' %}" role="button">
|
||||
{% trans "Expand Root Partition" %}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user