From: Christian Hesse <[email protected]>

Using rsync for a fresh copy double the amount of used memory. Instead
use cp with hard links.

Signed-off-by: Christian Hesse <[email protected]>
---
 makechrootpkg.in | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/makechrootpkg.in b/makechrootpkg.in
index 8d8fd05..f711201 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -127,8 +127,11 @@ sync_chroot() {
                btrfs subvolume snapshot "$rootdir" "$copydir" >/dev/null ||
                        die "Unable to create subvolume %s" "$copydir"
        else
-               mkdir -p "$copydir"
-               rsync -a --delete -q -W -x "$rootdir/" "$copydir"
+               if [[ -e "$copydir" ]]; then
+                       rsync -a --delete -q -W -x "$rootdir/" "$copydir/"
+               else
+                       cp --archive --link "$rootdir/" "$copydir/"
+               fi
        fi
        stat_done
 

Reply via email to