]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(dracut-initramfs-restore.sh): handle /etc/machine-id empty or uninitialized
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Mon, 20 Mar 2023 13:10:35 +0000 (14:10 +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 debug the shutdown after explicitly
resetting the /etc/machine-id file.

dracut-initramfs-restore.sh

index 01d114b98b1ce4f2419684cb7b91d5134f65b849..412c3a827904bcbff08572c68b29edff084f855e 100755 (executable)
@@ -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