summaryrefslogtreecommitdiffstats
path: root/src/utils/fstab.py
Commit message (Collapse)AuthorAgeFilesLines
* src: isolate libfdisk operations to enable mount operationsv1.3.2-20Alejandro Sirgo Rica9 days1-3/+3
| | | | | | | | | | python-libfdisk does not close file descriptor until the cxt object goes out of scope. Define get_partition_data and get_disk_data functions to isolate the python-libfdisk logic and return the data as an object. Improve error handling of libfdisk operaions in refresh.
* utils: replace the legacy function ogConfigureFstabAlejandro Sirgo Rica2024-08-301-0/+213
Implement configure_fstab() as a replacement of ogConfigureFstab. Create src/utils/fstab.py to implement the main fstab configuration functions. Define two fstab helper classes, FstabBuilder and FstabEntry. FstabEntry Represents each line in the fstab file. Has the values: device, mountpoint, fstype, options, dump_code and pass_code. FstabBuilder Contains a list of FstabEntry. Handles loading of a preexisting fstab file and the serialization of multiple FstabEntry into a file. The fstab configuration has 3 main steps: Root partition: - Update the device field with the device where the new system is installed. Swap partition: - Preserve all the swapfile entries in every case. - If the filesystem has a swap partition: update the device field in the first fstab swap entry and remove the rest swap entries pointing to a swap partition. Only one swap partition is supported. Create a new fstab entry if no preexisting swap entry exists. - If the system has no swap partition remove every swap partition entry. EFI partition: - Update the device field of the EFI fstab entry if it exists. Create a new fstab entry if no preexisting EFI entry exists. Add get_filesystem_id to disk.py to obtain the UUID. Define every device field as a UUID. That method is more robust than a plain device path as it works after disks being added or removed.