Source-Changes-HG archive

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

[src/trunk]: src/etc rm -f target file before cp -f.



details:   https://anonhg.NetBSD.org/src/rev/0e3b99a22be4
branches:  trunk
changeset: 543241:0e3b99a22be4
user:      lukem <lukem%NetBSD.org@localhost>
date:      Thu Feb 20 12:47:29 2003 +0000

description:
rm -f target file before cp -f.

diffstat:

 etc/postinstall |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r 5633ab1d7bb8 -r 0e3b99a22be4 etc/postinstall
--- a/etc/postinstall   Thu Feb 20 12:24:05 2003 +0000
+++ b/etc/postinstall   Thu Feb 20 12:47:29 2003 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.51 2003/02/20 11:40:28 lukem Exp $
+# $NetBSD: postinstall,v 1.52 2003/02/20 12:47:29 lukem Exp $
 #
 # Copyright (c) 2002-2003 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -50,7 +50,6 @@
 #      - support quiet/verbose mode ?
 #      - differentiate between failures caused by missing source
 #        and real failures
-#      - rm files before cp -f (incase of symlink)?
 #
 
 #
@@ -191,7 +190,8 @@
                if [ "${_op}" = "check" ]; then
                        msg ${_error}
                        _cmpdir_rv=1
-               elif ! cp -f ${fs} ${fd}; then
+               elif ! rm -f ${fd} ||
+                    ! cp -f ${fs} ${fd}; then
                        msg "Can't copy ${fs} to ${fd}"
                        _cmpdir_rv=1
                elif ! chmod ${_mode} ${fd}; then
@@ -507,7 +507,8 @@
                        if [ "${op}" = "check" ]; then
                                msg "${sshdconf} needs the following changes:"
                                failed=1
-                       elif ! cp -f ${SCRATCHDIR}/sshd_config ${sshdconf}; then
+                       elif ! rm -f ${sshdconf} ||
+                            ! cp -f ${SCRATCHDIR}/sshd_config ${sshdconf}; then
                                msg "${sshdconf} changes not applied:"
                                failed=1
                        else



Home | Main Index | Thread Index | Old Index