UAdded automatic enabling of swap partition before installation starts.

Mainly to suppress installer stoppages caused by oom killer.
This commit is contained in:
Masato TOYOSHIMA 2023-02-26 02:04:37 +09:00 committed by Masato Toyoshima
parent 719c6f2ff1
commit 0038751106
No known key found for this signature in database
GPG Key ID: 536487F1470D7187

View File

@ -307,12 +307,23 @@ def mount_partition(root_mount_point, partition, partitions, mount_options, moun
mount_option) != 0:
libcalamares.utils.warning("Cannot mount {}".format(device))
<<<<<<< ours
def enable_swap_partitions(swap_partitions):
try:
for swap_device in swap_partitions:
libcalamares.utils.host_env_process_output(["swapon", swap_device])
except subprocess.CalledProcessError:
libcalamares.utils.warning("Failed to swapon " + swap_device)
||||||| base
=======
def enable_swap_partition(swap_device):
try:
for d in swap_device:
subprocess.check_call(["swapon", d])
except subprocess.CalledProcessError:
raise Exception(_("Failed to swapon " + swap_device))
>>>>>>> theirs
def run():
"""
@ -327,11 +338,19 @@ def run():
return (_("Configuration Error"),
_("No partitions are defined for <pre>{!s}</pre> to use.").format("mount"))
<<<<<<< ours
# swap
swap_partitions = [p['device'] for p in partitions if p['fs'] == 'linuxswap' ]
swap_partitions = [p['device'] for p in partitions if ( p['fs'] == 'linuxswap' and p.get("claimed", None) )]
if ( swap_partitions != [] ):
enable_swap_partition(swap_partitions)
||||||| base
=======
swap_partitions = [p['device'] for p in partitions if ( p['fs'] == 'linuxswap' and p['claimed'] == True ) ]
if swap_partitions != [] :
enable_swap_partition(swap_partitions)
>>>>>>> theirs
root_mount_point = tempfile.mkdtemp(prefix="calamares-root-")
# Get the mountOptions, if this is None, that is OK and will be handled later