Generate entry for subvolume @swap

This commit is contained in:
Chrysostomus 2020-12-07 22:39:21 +02:00
parent 3f0612b4ad
commit 80a538665e

View file

@ -183,7 +183,7 @@ class FstabGenerator(object):
print(FSTAB_HEADER, file=fstab_file)
for partition in self.partitions:
# Special treatment for a btrfs root with @ and @home
# Special treatment for a btrfs root with @, @home and @swap
# subvolumes
if (partition["fs"] == "btrfs"
and partition["mountPoint"] == "/"):
@ -206,6 +206,13 @@ class FstabGenerator(object):
dct = self.generate_fstab_line_info(home_entry)
if dct:
self.print_fstab_line(dct, file=fstab_file)
elif line.endswith(b'path @swap'):
swap_part_entry = partition
swap_part_entry["mountPoint"] = "/swap"
swap_part_entry["subvol"] = "@swap"
dct = self.generate_fstab_line_info(swap_part_entry)
if dct:
self.print_fstab_line(dct, file=fstab_file)
else:
dct = self.generate_fstab_line_info(partition)