[arch-projects] [devtools] [PATCH 1/1] makechrootpkg: try to copy with hard links

Christian Hesse list at eworm.de
Fri Jul 14 10:04:28 UTC 2017


From: Christian Hesse <mail at eworm.de>

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

Signed-off-by: Christian Hesse <mail at eworm.de>
---
 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
 


More information about the arch-projects mailing list