r18:
[carnet-upgrade.git] / functions.sh
index e625d51..5bb7ae6 100644 (file)
@@ -223,8 +223,12 @@ ${CP_NOTICE}----------"
 cp_safe_file_replace () {
   [ "$CP_SCRIPT_DEBUG" ] && set -vx
   local new old
-  new=$1
-  old=$2
+  if [ -z "$2" ]; then
+    echo "Usage: cp_safe_file_replace <new-file> <target-file>" 1>&2
+    return 1
+  fi
+  new="$1"
+  old="$2"
   if [ -e "$old" ]; then
     chown --reference "$old" "$new"
     chmod --reference "$old" "$new"