[dracut] Ensure the user can remove -f but it stays as the default

This commit is contained in:
Simon Quigley 2024-11-22 19:46:32 -06:00
parent 119f3fb4bd
commit 8ea29c271f

View File

@ -36,21 +36,14 @@ def run_dracut():
:return: :return:
""" """
# Fetch the job configuration # Fetch the job configuration
cli_options = ["-f"]
initramfs_name = libcalamares.job.configuration.get('initramfsName', None) initramfs_name = libcalamares.job.configuration.get('initramfsName', None)
dracut_options = libcalamares.job.configuration.get('options', []) dracut_options = libcalamares.job.configuration.get('options', ['-f'])
# Parse the custom options if there are any
for option in dracut_options:
# Deduplication check
if option not in cli_options:
cli_options.append(option)
if initramfs_name: if initramfs_name:
cli_options.append(initramfs_name) dracut_options.append(initramfs_name)
try: try:
target_env_process_output(['dracut'] + cli_options) target_env_process_output(['dracut'] + dracut_options)
except subprocess.CalledProcessError as cpe: except subprocess.CalledProcessError as cpe:
libcalamares.utils.warning(f"Dracut failed with output: {cpe.output}") libcalamares.utils.warning(f"Dracut failed with output: {cpe.output}")
return cpe.returncode return cpe.returncode