Mount @swap to /swap when needed
This commit is contained in:
parent
b180cbd47d
commit
727f7859b7
@ -87,6 +87,12 @@ def mount_partition(root_mount_point, partition, partitions):
|
|||||||
if p["mountPoint"] == "/home":
|
if p["mountPoint"] == "/home":
|
||||||
has_home_mount_point = True
|
has_home_mount_point = True
|
||||||
break
|
break
|
||||||
|
needs_swap_subvolume = False
|
||||||
|
swap_choice = global_storage.value( "partitionChoices" )
|
||||||
|
if swap_choice:
|
||||||
|
swap_choice = swap_choice.get( "swap", None )
|
||||||
|
if swap_choice and swap_choice == "file":
|
||||||
|
needs_swap_subvolume = True
|
||||||
|
|
||||||
subprocess.check_call(['btrfs', 'subvolume', 'create',
|
subprocess.check_call(['btrfs', 'subvolume', 'create',
|
||||||
root_mount_point + '/@'])
|
root_mount_point + '/@'])
|
||||||
@ -94,12 +100,8 @@ def mount_partition(root_mount_point, partition, partitions):
|
|||||||
if not has_home_mount_point:
|
if not has_home_mount_point:
|
||||||
subprocess.check_call(['btrfs', 'subvolume', 'create',
|
subprocess.check_call(['btrfs', 'subvolume', 'create',
|
||||||
root_mount_point + '/@home'])
|
root_mount_point + '/@home'])
|
||||||
|
if needs_swap_subvolume:
|
||||||
swap_choice = global_storage.value( "partitionChoices" )
|
subprocess.check_call(['btrfs', 'subvolume', 'create',
|
||||||
if swap_choice:
|
|
||||||
swap_choice = swap_choice.get( "swap", None )
|
|
||||||
if swap_choice and swap_choice == "file":
|
|
||||||
subprocess.check_call(['btrfs', 'subvolume', 'create',
|
|
||||||
root_mount_point + '/@swap'])
|
root_mount_point + '/@swap'])
|
||||||
|
|
||||||
subprocess.check_call(["umount", "-v", root_mount_point])
|
subprocess.check_call(["umount", "-v", root_mount_point])
|
||||||
@ -121,6 +123,13 @@ def mount_partition(root_mount_point, partition, partitions):
|
|||||||
fstype,
|
fstype,
|
||||||
",".join(["subvol=@home", partition.get("options", "")])) != 0:
|
",".join(["subvol=@home", partition.get("options", "")])) != 0:
|
||||||
libcalamares.utils.warning("Cannot mount {}".format(device))
|
libcalamares.utils.warning("Cannot mount {}".format(device))
|
||||||
|
|
||||||
|
if needs_swap_subvolume:
|
||||||
|
if libcalamares.utils.mount(device,
|
||||||
|
root_mount_point + "/swap",
|
||||||
|
fstype,
|
||||||
|
",".join(["subvol=@swap", partition.get("options", "")])) != 0:
|
||||||
|
libcalamares.utils.warning("Cannot mount {}".format(device))
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
|
Loading…
Reference in New Issue
Block a user