Skip to content

Commit

Permalink
fix(lsinitrd.sh): handle /etc/machine-id empty or uninitialized
Browse files Browse the repository at this point in the history
Handle the case where the user tries to query the initrd content after
explicitly resetting the /etc/machine-id file.
  • Loading branch information
aafeijoo-suse authored and johannbg committed Apr 26, 2023
1 parent 97fe097 commit 971b302
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lsinitrd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ if [[ $1 ]]; then
else
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 971b302

Please sign in to comment.