Skip to content

Commit 1157143

Browse files
pvalenajohannbg
authored andcommitted
feat(dracut.sh): populate uefi_cmdline if no other cmdline is given
When creating uefi image in hostonly mode (with using --hostonly-cmdline), it makes sense to copy current kernel commandline from /proc/cmdline, in case there are no other options specified. Usually, the cmdline.d/*.conf file is generated by module rootfs-block (or other modules), but it might, not handle all cases correctly, and specifying --kernel-cmdline every time is not much user-friendly.
1 parent 23684e4 commit 1157143

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

dracut.sh

+10-6
Original file line numberDiff line numberDiff line change
@@ -2598,14 +2598,18 @@ umask 077
25982598
if [[ $uefi == yes ]]; then
25992599
if [[ $kernel_cmdline ]]; then
26002600
echo -n "$kernel_cmdline" > "$uefi_outdir/cmdline.txt"
2601-
elif [[ $hostonly_cmdline == yes ]] && [ -d "$initdir/etc/cmdline.d" ]; then
2602-
for conf in "$initdir"/etc/cmdline.d/*.conf; do
2603-
[ -e "$conf" ] || continue
2604-
printf "%s " "$(< "$conf")" >> "$uefi_outdir/cmdline.txt"
2605-
done
2601+
elif [[ $hostonly_cmdline == yes ]]; then
2602+
if [ -d "$initdir/etc/cmdline.d" ]; then
2603+
for conf in "$initdir"/etc/cmdline.d/*.conf; do
2604+
[ -e "$conf" ] || continue
2605+
printf "%s " "$(< "$conf")" >> "$uefi_outdir/cmdline.txt"
2606+
done
2607+
elif [ -e "/proc/cmdline" ]; then
2608+
printf "%s " "$(< "/proc/cmdline")" > "$uefi_outdir/cmdline.txt"
2609+
fi
26062610
fi
26072611
2608-
if [[ $kernel_cmdline ]] || [[ $hostonly_cmdline == yes && -d "$initdir/etc/cmdline.d" ]]; then
2612+
if [[ $kernel_cmdline ]] || [[ $hostonly_cmdline == yes && -e "${uefi_outdir}/cmdline.txt" ]]; then
26092613
echo -ne "\x00" >> "$uefi_outdir/cmdline.txt"
26102614
dinfo "Using UEFI kernel cmdline:"
26112615
dinfo "$(tr -d '\000' < "$uefi_outdir/cmdline.txt")"

0 commit comments

Comments
 (0)