Message ID | 20170714100428.5109-1-list@eworm.de |
---|---|
State | Rejected |
Headers | show |
Series | [devtools,1/1] makechrootpkg: try to copy with hard links | expand |
On Fri, Jul 14, 2017 at 12:04 PM Christian Hesse <list@eworm.de> wrote: > Using rsync for a fresh copy double the amount of used memory. Instead > use cp with hard links. > This seems rather unsafe. Changes to files in the copydir contaminate the rootdir. <div dir="ltr">On Fri, Jul 14, 2017 at 12:04 PM Christian Hesse <<a href="mailto:list@eworm.de">list@eworm.de</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> Using rsync for a fresh copy double the amount of used memory. Instead<br> use cp with hard links.<br></blockquote><div><br></div><div>This seems rather unsafe. Changes to files in the copydir contaminate the rootdir.<br></div></div></div>
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