From: Antonio Alvarez Feijoo Date: Mon, 20 Mar 2023 13:09:43 +0000 (+0100) Subject: fix(lsinitrd.sh): handle /etc/machine-id empty or uninitialized X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=971b302d70fbbfac3b6047654b7dc7ceeb1c17e7;p=thirdparty%2Fdracut.git fix(lsinitrd.sh): handle /etc/machine-id empty or uninitialized Handle the case where the user tries to query the initrd content after explicitly resetting the /etc/machine-id file. --- diff --git a/lsinitrd.sh b/lsinitrd.sh index 987a6bfc3..ada6cf516 100755 --- a/lsinitrd.sh +++ b/lsinitrd.sh @@ -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