Skip to content

Commit

Permalink
fix(dracut.sh): always check that MACHINE_ID is not empty
Browse files Browse the repository at this point in the history
On new installations, /etc/machine-id may exist and be empty, and
also /efi or /boot/efi may be a mount point, leading to an invalid
initramfs output file.
  • Loading branch information
aafeijoo-suse authored and johannbg committed May 3, 2022
1 parent 7f7dc91 commit 527fdfa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions dracut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1089,9 +1089,13 @@ if ! [[ $outfile ]]; then
outfile="$dracutsysrootdir/lib/modules/${kernel}/initrd"
elif [[ -e $dracutsysrootdir/boot/vmlinuz-${kernel} ]]; then
outfile="$dracutsysrootdir/boot/initramfs-${kernel}.img"
elif [[ -z $dracutsysrootdir ]] && mountpoint -q /efi; then
elif [[ -z $dracutsysrootdir ]] \
&& [[ $MACHINE_ID ]] \
&& mountpoint -q /efi; then
outfile="/efi/${MACHINE_ID}/${kernel}/initrd"
elif [[ -z $dracutsysrootdir ]] && mountpoint -q /boot/efi; then
elif [[ -z $dracutsysrootdir ]] \
&& [[ $MACHINE_ID ]] \
&& mountpoint -q /boot/efi; then
outfile="/boot/efi/${MACHINE_ID}/${kernel}/initrd"
else
outfile="$dracutsysrootdir/boot/initramfs-${kernel}.img"
Expand Down

0 comments on commit 527fdfa

Please sign in to comment.