]> arthur.barton.de Git - ConfigScripts.git/commitdiff
Only try to make backups if the destination file already exists.
authorAlexander Barton <alex@barton.de>
Thu, 7 Aug 2008 16:55:42 +0000 (18:55 +0200)
committerAlexander Barton <alex@barton.de>
Thu, 7 Aug 2008 16:55:42 +0000 (18:55 +0200)
install.sh

index 62e695efa6c56f22ce4dc64395ee34b6ed2edbcc..6804f0bfae4f0740d0684cb6ce61f2eb911cc394 100755 (executable)
@@ -14,10 +14,12 @@ Abort() {
 Copy_File() {
        src="$1"; dst="$2"; own="$3"; perm="$4"
        echo "     $src -> $dst\c"
-       grep "alex@barton.de" "$dst" >/dev/null 2>&1
-       if [ $? -ne 0 ]; then
-               echo " (B)\c"
-               cp "$dst" "$dst.bak"
+       if [ -e "$dst" ]; then
+               grep "alex@barton.de" "$dst" >/dev/null 2>&1
+               if [ $? -ne 0 ]; then
+                       echo " (B)\c"
+                       cp "$dst" "$dst.bak"
+               fi
        fi
        echo " \c"
        cp "$src" "$dst" || Abort