[fstab] Be more careful in setting up btrfs swap
- do not use subprocess module in Python bits, - do +C (no-CoW) after turning compression off
This commit is contained in:
parent
72f25f24ef
commit
f4e5e08aa8
@ -173,7 +173,6 @@ class FstabGenerator(object):
|
||||
for p in self.partitions]):
|
||||
password = "none"
|
||||
crypttab_options = ""
|
||||
|
||||
|
||||
return dict(
|
||||
name=mapper_name,
|
||||
@ -342,10 +341,8 @@ def create_swapfile(root_mount_point, root_btrfs):
|
||||
swapfile_path = os.path.join(root_mount_point, "swap/swapfile")
|
||||
with open(swapfile_path, "wb") as f:
|
||||
pass
|
||||
o = subprocess.check_output(["chattr", "+C", swapfile_path])
|
||||
libcalamares.utils.debug("swapfile attributes: {!s}".format(o))
|
||||
o = subprocess.check_output(["btrfs", "property", "set", swapfile_path, "compression", "none"])
|
||||
libcalamares.utils.debug("swapfile compression: {!s}".format(o))
|
||||
libcalamares.utils.host_env_process_output(["btrfs", "property", "set", swapfile_path, "compression", "none"])
|
||||
libcalamares.utils.host_env_process_output(["chattr", "+C", swapfile_path]) # No Copy-on-Write
|
||||
else:
|
||||
swapfile_path = os.path.join(root_mount_point, "swapfile")
|
||||
with open(swapfile_path, "wb") as f:
|
||||
@ -363,8 +360,7 @@ def create_swapfile(root_mount_point, root_btrfs):
|
||||
libcalamares.job.setprogress(0.2 + 0.3 * ( total / desired_size ) )
|
||||
total += chunk
|
||||
os.chmod(swapfile_path, 0o600)
|
||||
o = subprocess.check_output(["mkswap", swapfile_path])
|
||||
libcalamares.utils.debug("swapfile mkswap: {!s}".format(o))
|
||||
libcalamares.utils.host_env_process_output(["mkswap", swapfile_path])
|
||||
libcalamares.job.setprogress(0.5)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user