diff options
author | Lars R. Damerow <lars@pixar.com> | 2013-02-21 13:40:23 -0800 |
---|---|---|
committer | Harald Hoyer <harald@redhat.com> | 2013-02-22 11:05:29 +0100 |
commit | 9a9c6e1256c7185630fa94bb63ac0bb666a5af34 (patch) | |
tree | 07363c4a653728d2fb0d1aa5b93fe474cbd6922e /dracut.sh | |
parent | 9c65c125a919756844fdec0a44d3a80b14ef36ae (diff) | |
download | dracut-9a9c6e1256c7185630fa94bb63ac0bb666a5af34.tar.gz dracut-9a9c6e1256c7185630fa94bb63ac0bb666a5af34.tar.bz2 dracut-9a9c6e1256c7185630fa94bb63ac0bb666a5af34.zip |
dracut: write initramfs to temp file then move into place
We've been finding cases where multiple instances of dracut can be launched
simultaneously, resulting in a corrupted initramfs file. This patch makes
dracut write the initramfs to a new file, then move it into place atomically.
Diffstat (limited to 'dracut.sh')
-rwxr-xr-x | dracut.sh | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1103,10 +1103,11 @@ fi rm -f "$outfile" dinfo "*** Creating image file ***" if ! ( umask 077; cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \ - $compress > "$outfile"; ); then - dfatal "dracut: creation of $outfile failed" + $compress > "$outfile.$$"; ); then + dfatal "dracut: creation of $outfile.$$ failed" exit 1 fi +mv $outfile.$$ $outfile dinfo "*** Creating image file done ***" dinfo "Wrote $outfile:" |