瀏覽代碼

bind-dirs: copy from ro only if bind target doesn't exists

f4d367a6 dropped the check if the bind target exists and added
"--no-clobber" to the cp call. For directories this does not work as
desired: cp checks per (recursive) file instead of once for the
specified directory.
HW42 7 年之前
父節點
當前提交
be0e8a250f
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      vm-systemd/bind-dirs.sh

+ 3 - 1
vm-systemd/bind-dirs.sh

@@ -95,7 +95,9 @@ bind_dirs() {
 
       # Initially copy over data directories to /rw if rw directory does not exist.
       if [ -d "$fso_ro" ] || [ -f "$fso_ro" ]; then
-         cp --verbose --no-clobber --archive --recursive --parents "$fso_ro" "$rw_dest_dir"
+         if ! [ -d "$fso_rw" -o -f "$fso_rw" ]; then
+            cp --verbose --archive --recursive --parents "$fso_ro" "$rw_dest_dir"
+         fi
       else
          true "$fso_ro is neither a directory nor a file or does not exist, skipping."
          continue