mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-03 10:50:20 +00:00
storage: Do not show an eject button on /boot partitions
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
f7f3b2d8a3
commit
6c28884995
@ -77,7 +77,7 @@ def get_disks():
|
||||
combined_list.append(disk_from_df)
|
||||
|
||||
for disk in combined_list:
|
||||
disk['is_root_device'] = is_root_device(disk)
|
||||
disk['is_removable'] = is_removable_device(disk)
|
||||
|
||||
return combined_list
|
||||
|
||||
@ -162,16 +162,26 @@ def get_disk_info(mount_point):
|
||||
def get_root_device(disks):
|
||||
"""Return the root partition's device from list of partitions."""
|
||||
for disk in disks:
|
||||
if is_root_device(disk):
|
||||
if is_root_partition(disk):
|
||||
return disk['dev_kname']
|
||||
return None
|
||||
|
||||
|
||||
def is_root_device(disk):
|
||||
"""Return whether a given disk is a root device or not."""
|
||||
def is_removable_device(disk):
|
||||
"""Return whether a given disk is a removable device or not."""
|
||||
return not (is_root_partition(disk) or is_boot_partition(disk))
|
||||
|
||||
|
||||
def is_root_partition(disk):
|
||||
"""Returns whether this disk is mounted at /."""
|
||||
return disk['mountpoint'] == '/' and disk['type'] == 'part'
|
||||
|
||||
|
||||
def is_boot_partition(disk):
|
||||
"""Returns whether this disk is mounted at /boot."""
|
||||
return disk['mountpoint'] == '/boot' and disk['type'] == 'part'
|
||||
|
||||
|
||||
def is_expandable(device):
|
||||
"""Return the list of partitions that can be expanded."""
|
||||
if not device:
|
||||
|
||||
@ -88,7 +88,7 @@
|
||||
<div>{{ disk.used_str }} / {{ disk.size_str }}</div>
|
||||
</td>
|
||||
<td>
|
||||
{% if not disk.is_root_device %}
|
||||
{% if disk.is_removable %}
|
||||
<form class="form" method="post"
|
||||
action="{% url 'storage:eject' disk.dev_kname|urlencode:'' %}">
|
||||
{% csrf_token %}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user