Skip to content

Commit

Permalink
fix(dracut-initramfs-restore.sh): handle /etc/machine-id empty or uni…
Browse files Browse the repository at this point in the history
…nitialized

Handle the case where the user tries to debug the shutdown after explicitly
resetting the /etc/machine-id file.
  • Loading branch information
aafeijoo-suse authored and johannbg committed Apr 26, 2023
1 parent 971b302 commit 260883d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dracut-initramfs-restore.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ SKIP="$dracutbasedir/skipcpio"

if [[ -d /efi/Default ]] || [[ -d /boot/Default ]] || [[ -d /boot/efi/Default ]]; then
MACHINE_ID="Default"
elif [[ -f /etc/machine-id ]]; then
elif [[ -s /etc/machine-id ]]; then
read -r MACHINE_ID < /etc/machine-id
[[ $MACHINE_ID == "uninitialized" ]] && MACHINE_ID="Default"
else
MACHINE_ID="Default"
fi
Expand Down

0 comments on commit 260883d

Please sign in to comment.