Skip to content

Commit

Permalink
feat[#314]: Tell user about minimum partition sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
muhdsalm authored and taukakao committed Aug 1, 2024
1 parent 374a124 commit 1ac4d55
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
6 changes: 6 additions & 0 deletions recipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
},
"default_root_size": 12288,
"min_disk_size": 51200,
"min_partition_sizes": {
"/boot": 900,
"/boot/efi": 512,
"/": 21504,
"/var": 25600
},
"tour": {
"welcome": {
"resource": "/org/vanillaos/Installer/assets/welcome.png",
Expand Down
20 changes: 20 additions & 0 deletions vanilla_installer/defaults/disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ def __init__(self, parent, partitions, **kwargs):
super().__init__(**kwargs)
self.__parent = parent
self.__partitions = sorted(partitions)
self.__recipe = self.__parent.recipe

self.launch_gparted.connect("clicked", self.__on_launch_gparted)
self.use_swap_part.connect("state-set", self.__on_use_swap_toggled)
Expand Down Expand Up @@ -289,6 +290,8 @@ def __init__(self, parent, partitions, **kwargs):
)
self.__selected_partitions["swap_part_expand"]["fstype"] = "swap"

for widget in [self.boot_part, self.efi_part, self.root_part, self.var_part]:
widget.set_description(widget.get_description() + self.get_partition_size_string(widget) + ".")
self.update_apply_button_status()

def __on_launch_gparted(self, widget):
Expand Down Expand Up @@ -395,6 +398,22 @@ def check_selected_partitions_sizes(self):
self.bios_small_error.set_description(error_description)
self.bios_small_error.set_visible(True)

def get_partition_size_string(self, widget):
size = 0
if widget == self.boot_part:
size = self.__recipe["min_partition_sizes"]["/boot"]
if widget == self.efi_part:
size = self.__recipe["min_partition_sizes"]["/boot/efi"]
if widget == self.root_part:
size = self.__recipe["min_partition_sizes"]["/"]
if widget == self.var_part:
size = self.__recipe["min_partition_sizes"]["/var"]
if size > 1024:
return str(int(size/1024)) + "GiB"
else:
return str(size) + "MiB"


def __on_use_swap_toggled(self, widget, state):
if not state:
for child_row in self.__swap_part_rows:
Expand Down Expand Up @@ -474,6 +493,7 @@ def __init__(self, window, parent, disks, **kwargs):
self.__parent = parent
self.__disks = disks
self.set_transient_for(self.__window)
self.recipe = window.recipe

self.__partitions = []
for disk in self.__disks:
Expand Down
8 changes: 4 additions & 4 deletions vanilla_installer/gtk/widget-partition.ui
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<child>
<object class="AdwPreferencesGroup" id="boot_part">
<property name="title" translatable="yes">Boot Partition</property>
<property name="description" translatable="yes">The partition to mount under “/boot”. This directory stores files for booting into Vanilla OS.</property>
<property name="description" translatable="yes">The partition to mount under “/boot”. This directory stores files for booting into Vanilla OS. Minimum space required in the partition is </property>
<child>
<object class="AdwExpanderRow" id="boot_part_expand">
<property name="title" translatable="yes">No Partition Selected</property>
Expand All @@ -47,7 +47,7 @@
<child>
<object class="AdwPreferencesGroup" id="efi_part">
<property name="title" translatable="yes">EFI Partition</property>
<property name="description" translatable="yes">The partition to mount under “/boot/efi”. This directory stores files for booting in the bootloader.</property>
<property name="description" translatable="yes">The partition to mount under “/boot/efi”. This directory stores files for booting in the bootloader. Minimum space required in the partition is </property>
<child>
<object class="AdwExpanderRow" id="efi_part_expand">
<property name="title" translatable="yes">No Partition Selected</property>
Expand Down Expand Up @@ -100,7 +100,7 @@
<child>
<object class="AdwPreferencesGroup" id="root_part">
<property name="title" translatable="yes">Root Partition</property>
<property name="description" translatable="yes">The partition to mount under “/”. It will be automatically converted into an LVM thin pool during installation.</property>
<property name="description" translatable="yes">The partition to mount under “/”. It will be automatically converted into an LVM thin pool during installation. Minimum space required in the partition is </property>
<child>
<object class="AdwExpanderRow" id="root_part_expand">
<property name="title" translatable="yes">No Partition Selected</property>
Expand All @@ -120,7 +120,7 @@
<child>
<object class="AdwPreferencesGroup" id="var_part">
<property name="title" translatable="yes">Var Partition</property>
<property name="description" translatable="yes">The partition to mount under “/var”. This directory stores all user data like personal documents and system-wide configuration.</property>
<property name="description" translatable="yes">The partition to mount under “/var”. This directory stores all user data like personal documents and system-wide configuration. Minimum space required in the partition is </property>
<child>
<object class="AdwExpanderRow" id="var_part_expand">
<property name="title" translatable="yes">No Partition Selected</property>
Expand Down

0 comments on commit 1ac4d55

Please sign in to comment.