Blame 0048-remove-the-incomplete-.img-file.patch

Harald Hoyer bb31e7
From 7eeaa4ab146907eb56bc03d4aeba1feea8357c1e Mon Sep 17 00:00:00 2001
Harald Hoyer bb31e7
From: Chao Fan <cfan@redhat.com>
Harald Hoyer bb31e7
Date: Tue, 21 Jul 2015 17:18:42 +0800
Harald Hoyer bb31e7
Subject: [PATCH] remove the incomplete .img file
Harald Hoyer bb31e7
Harald Hoyer bb31e7
If the directory where the .img file is saved has no enough space, or in
Harald Hoyer bb31e7
other wrong conditions, dracut will get an incomplete file xxx.img. But
Harald Hoyer bb31e7
sometimes this .img file will be loaded when rebooting the system. And then
Harald Hoyer bb31e7
some bugs will happen because this .img file is wrong.
Harald Hoyer bb31e7
Harald Hoyer bb31e7
So I think dracut should remove the incomplete file because this .img file
Harald Hoyer bb31e7
with problems was made by dracut. And then the wrong file will not be loaded
Harald Hoyer bb31e7
anymore.
Harald Hoyer bb31e7
Harald Hoyer bb31e7
Signed-off-by: Chao Fan <cfan@redhat.com>
Harald Hoyer bb31e7
---
Harald Hoyer bb31e7
 dracut.sh | 1 +
Harald Hoyer bb31e7
 1 file changed, 1 insertion(+)
Harald Hoyer bb31e7
Harald Hoyer bb31e7
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer bb31e7
index ee0a039..122ae0c 100755
Harald Hoyer bb31e7
--- a/dracut.sh
Harald Hoyer bb31e7
+++ b/dracut.sh
Harald Hoyer bb31e7
@@ -1651,6 +1651,7 @@ if ! (
Harald Hoyer bb31e7
             | $compress >> "$outfile"
Harald Hoyer bb31e7
     ); then
Harald Hoyer bb31e7
     dfatal "dracut: creation of $outfile failed"
Harald Hoyer bb31e7
+	rm -f $outfile
Harald Hoyer bb31e7
     exit 1
Harald Hoyer bb31e7
 fi
Harald Hoyer bb31e7
 dinfo "*** Creating initrd image file '$outfile' done ***"