Skip to content

Commit

Permalink
feat(dracut): add option to disable automatic guessing of output file
Browse files Browse the repository at this point in the history
This patch allows forcing the input of the file path for the generated initramfs
image (disabling automatic guessing of the location) using a new configuration
option `force_output_file=yes`.
  • Loading branch information
aafeijoo-suse committed Mar 25, 2024
1 parent 5d2bda4 commit 9ca4b52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dracut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,13 @@ for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); d
[[ -e $f ]] && . "$f"
done

# check if automatic guessing of the output file is disabled.
if [[ $force_output_file == "yes" && -z $outfile ]]; then
printf "%s\n" "dracut[F]: dracut is configured with force_output_file=yes" >&2
printf "%s\n" "dracut[F]: so it is required to specify the file path of the generated initramfs image." >&2
exit 1
fi

# regenerate_all shouldn't be set in conf files
regenerate_all=$regenerate_all_l
if [[ $parallel_l == "yes" ]]; then
Expand Down
7 changes: 7 additions & 0 deletions man/dracut.conf.5.asc
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,13 @@ Logging levels:
If set to _yes_, try to execute tasks in parallel (currently only supported
for _--regenerate-all_).

*force_output_file=*"__{yes|no}__"::
If set to _yes_, require to specify a file path for the generated initramfs
image, disabling automatic guessing of the location (default=no).
In some complex scenarios, distribution owners may want to disable the logic
for guessing the location of the output file, to prevent users from calling
dracut directly to create useless initramfs that won't be used at boot.

Files
-----
_/etc/dracut.conf_::
Expand Down

0 comments on commit 9ca4b52

Please sign in to comment.