Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/sets Write to a temporary file and mv to real name t...



details:   https://anonhg.NetBSD.org/src/rev/efdfb7e61d1e
branches:  trunk
changeset: 565712:efdfb7e61d1e
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sun Apr 18 19:52:32 2004 +0000

description:
Write to a temporary file and mv to real name to avoid getting a
truncated file if/when interrupted.

diffstat:

 distrib/sets/maketars |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r 2beeebe8e663 -r efdfb7e61d1e distrib/sets/maketars
--- a/distrib/sets/maketars     Sun Apr 18 19:50:34 2004 +0000
+++ b/distrib/sets/maketars     Sun Apr 18 19:52:32 2004 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: maketars,v 1.52 2004/02/19 02:54:51 dyoung Exp $
+# $NetBSD: maketars,v 1.53 2004/04/18 19:52:32 dsl Exp $
 #
 # Make release tar files for some or all lists.  Usage:
 # maketars [-b] [-x] [-i installdir] [-a arch] [-m machine] [-s setsdir]
@@ -178,16 +178,18 @@
                echo "Copying set $setname"
                ( cd $dest ; \
                    ${PAX} -O -rwpe -d -N${etcdir} ${metalog:+-M} \
-                   ${installdir} < ${setlistdir}/set.${setname} )
+                       ${installdir} < ${setlistdir}/set.${setname} )
        else
                if [ -n "$metalog" -a $tars/$out -nt "$metalog" ]; then
                        echo "$out is up to date"
                        continue
                fi
                echo "Creating $out"
+               rm -f ${tars}/$out
                ( cd $dest ; \
                    ${PAX} -O -w -d -z -N${etcdir} ${metalog:+-M} \
-                   < ${setlistdir}/set.${setname} ) > ${tars}/$out
+                       < ${setlistdir}/set.${setname} ) > ${tars}/$out.tmp &&
+               mv ${tars}/$out.tmp ${tars}/$out
        fi
        es=$(($es + $?))
 done



Home | Main Index | Thread Index | Old Index