pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/scripts - if the mv of the temporary cache file to ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e255de09a616
branches:  trunk
changeset: 494090:e255de09a616
user:      dmcmahill <dmcmahill%pkgsrc.org@localhost>
date:      Thu May 19 03:58:40 2005 +0000

description:
- if the mv of the temporary cache file to the real one fails, usually
  due to a directory permissions error, then error out.

- when the master cache has just been newly created, don't also report
  that the master cache is up to date.

Both were suggested by Christian Hattemer.

diffstat:

 mk/scripts/binpkg-cache |  22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diffs (49 lines):

diff -r bcf5032a55dc -r e255de09a616 mk/scripts/binpkg-cache
--- a/mk/scripts/binpkg-cache   Thu May 19 03:52:23 2005 +0000
+++ b/mk/scripts/binpkg-cache   Thu May 19 03:58:40 2005 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: binpkg-cache,v 1.1 2005/05/17 21:46:59 dmcmahill Exp $
+# $NetBSD: binpkg-cache,v 1.2 2005/05/19 03:58:40 dmcmahill Exp $
 #
 # Script for generating a cache file with information about
 # all binary packages contained in a directory.
@@ -191,6 +191,11 @@
                        echo "pkgcache_end ${fn}" >> ${tmpd}/${cachefile}
                done
                mv ${tmpd}/${cachefile} ${d}/${cachefile}
+               if test $? -ne 0 ; then
+                       echo "move of ${tmpd}/${cachefile} to ${d}/${cachefile} failed!"
+                       echo "Perhaps you do not have write permissions to ${d}?"
+                       clean_and_exit1
+               fi
        fi
 
 
@@ -206,13 +211,22 @@
        fi
        if test ! -f ${PACKAGES}/${cachefile} ; then
                echo "${tab}Creating master cache file ${PACKAGES}/${cachefile}"
-               cp ${tmpd}/${cachefile} ${PACKAGES}/${cachefile}
-       fi
-       if ${CMP} -s ${tmpd}/${cachefile} ${PACKAGES}/${cachefile} ; then
+               mv ${tmpd}/${cachefile} ${PACKAGES}/${cachefile}
+               if test $? -ne 0 ; then
+                       echo "move of ${tmpd}/${cachefile} to ${PACKAGES}/${cachefile} failed!"
+                       echo "Perhaps you do not have write permissions to ${PACKAGES}?"
+                       clean_and_exit1
+               fi
+       elif ${CMP} -s ${tmpd}/${cachefile} ${PACKAGES}/${cachefile} ; then
                echo "${tab}Master cache file ${PACKAGES}/${cachefile} is up to date"
        else
                echo "${tab}Updating master cache file ${PACKAGES}/${cachefile}"
                mv ${tmpd}/${cachefile} ${PACKAGES}/${cachefile}
+               if test $? -ne 0 ; then
+                       echo "move of ${tmpd}/${cachefile} to ${PACKAGES}/${cachefile} failed!"
+                       echo "Perhaps you do not have write permissions to ${PACKAGES}?"
+                       clean_and_exit1
+               fi
        fi
 }
 



Home | Main Index | Thread Index | Old Index