]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(lsinitrd.sh): handle /etc/machine-id empty or uninitialized
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Mon, 20 Mar 2023 13:09:43 +0000 (14:09 +0100)
committerJóhann B. Guðmundsson <johannbg@gmail.com>
Wed, 26 Apr 2023 12:18:44 +0000 (12:18 +0000)
Handle the case where the user tries to query the initrd content after
explicitly resetting the /etc/machine-id file.

lsinitrd.sh

index 987a6bfc33b7c8dd4ff47301f50e3df1aa711a96..ada6cf516e6b7e455fa8e85edb629132f83c2648 100755 (executable)
@@ -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