From f4d367a6a7eb70f3658e28f5ae5841b2fff3b1c9 Mon Sep 17 00:00:00 2001 From: Patrick Schleizer Date: Fri, 8 Jan 2016 00:36:26 +0000 Subject: [PATCH] refactoring / code simplification Thanks to @marmarek for the suggestion! --- vm-systemd/bind-dirs.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/vm-systemd/bind-dirs.sh b/vm-systemd/bind-dirs.sh index adbfc95..3c9a7b5 100755 --- a/vm-systemd/bind-dirs.sh +++ b/vm-systemd/bind-dirs.sh @@ -94,14 +94,8 @@ bind_dirs() { fi # Initially copy over data directories to /rw if rw directory does not exist. - if [ -d "$fso_ro" ]; then - if [ ! -d "$fso_rw" ]; then - cp --archive --recursive --parents "$fso_ro" "$rw_dest_dir" - fi - elif [ -f "$fso_ro" ]; then - if [ ! -f "$fso_rw" ]; then - cp --archive --recursive --parents "$fso_ro" "$rw_dest_dir" - fi + if [ -d "$fso_ro" ] || [ -f "$fso_ro" ]; then + cp --verbose --no-clobber --archive --recursive --parents "$fso_ro" "$rw_dest_dir" else true "$fso_ro is neither a directory nor a file or does not exist, skipping." continue