From 971b302d70fbbfac3b6047654b7dc7ceeb1c17e7 Mon Sep 17 00:00:00 2001 From: Antonio Alvarez Feijoo Date: Mon, 20 Mar 2023 14:09:43 +0100 Subject: [PATCH] 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. --- lsinitrd.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- 2.47.2