Blame SOURCES/0128-dracut.sh-write-directly-to-the-output-file.patch

712866
From 6381b9445980aae6c8533fe74603c902a9125fc5 Mon Sep 17 00:00:00 2001
712866
From: Harald Hoyer <harald@redhat.com>
712866
Date: Wed, 19 Feb 2014 15:22:39 +0100
712866
Subject: [PATCH] dracut.sh: write directly to the output file
712866
712866
Because we already remove the output file before writing to it, we don't
712866
have to play games and write to a temporary file first.
712866
---
712866
 dracut.sh | 9 +++------
712866
 1 file changed, 3 insertions(+), 6 deletions(-)
712866
712866
diff --git a/dracut.sh b/dracut.sh
5c6c2a
index 89df9cd8..c4bf4ebc 100755
712866
--- a/dracut.sh
712866
+++ b/dracut.sh
712866
@@ -729,7 +729,6 @@ fi
712866
 # clean up after ourselves no matter how we die.
712866
 trap '
712866
     ret=$?;
712866
-    [[ $outfile ]] && [[ -f $outfile.$$ ]] && rm -f -- "$outfile.$$";
712866
     [[ $keep ]] && echo "Not removing $initdir." >&2 || { [[ $initdir ]] && rm -rf -- "$initdir"; };
712866
     [[ $keep ]] && echo "Not removing $early_cpio_dir." >&2 || { [[ $early_cpio_dir ]] && rm -Rf -- "$early_cpio_dir"; };
712866
     [[ $_dlogdir ]] && rm -Rf -- "$_dlogdir";
712866
@@ -1383,15 +1382,13 @@ dinfo "*** Creating image file ***"
712866
 if [[ $create_early_cpio = yes ]]; then
712866
     echo 1 > "$early_cpio_dir/d/early_cpio"
712866
     # The microcode blob is _before_ the initramfs blob, not after
712866
-    (cd "$early_cpio_dir/d";     find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet >../early.cpio)
712866
-    mv $early_cpio_dir/early.cpio $outfile.$$
712866
+    (cd "$early_cpio_dir/d";     find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet > $outfile)
712866
 fi
712866
 if ! ( umask 077; cd "$initdir"; find . -print0 | cpio --null $cpio_owner_root -H newc -o --quiet | \
712866
-    $compress >> "$outfile.$$"; ); then
712866
-    dfatal "dracut: creation of $outfile.$$ failed"
712866
+    $compress >> "$outfile"; ); then
712866
+    dfatal "dracut: creation of $outfile failed"
712866
     exit 1
712866
 fi
712866
-mv -- "$outfile.$$" "$outfile"
712866
 dinfo "*** Creating image file done ***"
712866
 
712866
 if (( maxloglvl >= 5 )); then