diff --git a/src/modules/dracut/dracut.conf b/src/modules/dracut/dracut.conf index ba1a7b08c..190933bcd 100644 --- a/src/modules/dracut/dracut.conf +++ b/src/modules/dracut/dracut.conf @@ -8,3 +8,7 @@ # set a custom name, including the path # initramfsName: /boot/initramfs-freebsd.img + +# Optional: define a list of strings to be passed as arguments to Dracut +# By default, -f is always included +options: [ "-f" ] diff --git a/src/modules/dracut/dracut.schema.yaml b/src/modules/dracut/dracut.schema.yaml index d6008e1bf..de1114ccc 100644 --- a/src/modules/dracut/dracut.schema.yaml +++ b/src/modules/dracut/dracut.schema.yaml @@ -7,3 +7,4 @@ additionalProperties: false type: object properties: initramfsName: { type: string } + options: { type: array, items: { type: string } } diff --git a/src/modules/dracut/main.py b/src/modules/dracut/main.py index 85e6f3e7f..9e2bc318f 100644 --- a/src/modules/dracut/main.py +++ b/src/modules/dracut/main.py @@ -35,15 +35,15 @@ def run_dracut(): :return: """ + # Fetch the job configuration + initramfs_name = libcalamares.job.configuration.get('initramfsName', None) + dracut_options = libcalamares.job.configuration.get('options', ['-f']) + + if initramfs_name: + dracut_options.append(initramfs_name) + try: - initramfs_name = libcalamares.job.configuration['initramfsName'] - target_env_process_output(['dracut', '-f', initramfs_name]) - except KeyError: - try: - target_env_process_output(['dracut', '-f']) - except subprocess.CalledProcessError as cpe: - libcalamares.utils.warning(f"Dracut failed with output: {cpe.output}") - return cpe.returncode + target_env_process_output(['dracut'] + dracut_options) except subprocess.CalledProcessError as cpe: libcalamares.utils.warning(f"Dracut failed with output: {cpe.output}") return cpe.returncode