Commit dbef0b91 authored by Florian Pritz's avatar Florian Pritz Committed by Pierre Schmitz
Browse files

Fix ownership when copying files from chroot to system



Previously files were always owned by nobody which means trying to write
to them directly would fail because only the owner has +w.

Signed-off-by: default avatarFlorian Pritz <bluewind@xinu.at>
Signed-off-by: default avatarPierre Schmitz <pierre@archlinux.de>
parent 499f2007
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ passeddir=
default_copy=$USER
[[ -n $SUDO_USER ]] && default_copy=$SUDO_USER
[[ -z $default_copy || $default_copy = root ]] && default_copy=copy
src_owner=${SUDO_USER:-$USER}

usage() {
	echo "usage ${0##*/} [options] -r <chrootdir> [--] [makepkg args]"
@@ -292,10 +293,12 @@ if mkarchroot -r "/chrootbuild" "$copydir"; then
			popd >/dev/null
		fi

		chown "$src_owner" "$pkgfile"
		mv "$pkgfile" "$PKGDEST"
	done

	for l in "$copydir"/build/*-{build,check,namcap,package,package_*}.log; do
		chown "$src_owner" "$l"
		[[ -f $l ]] && mv "$l" .
	done
else
@@ -304,6 +307,7 @@ else
fi

for f in "$copydir"/srcdest/*; do
	chown "$src_owner" "$f"
	mv "$f" "$SRCDEST"
done