aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'misc/emerge-delta-webrsync')
-rwxr-xr-xmisc/emerge-delta-webrsync22
1 files changed, 19 insertions, 3 deletions
diff --git a/misc/emerge-delta-webrsync b/misc/emerge-delta-webrsync
index 2f73c9059..e23316a8e 100755
--- a/misc/emerge-delta-webrsync
+++ b/misc/emerge-delta-webrsync
@@ -221,9 +221,24 @@ sync_local() {
fi
echo Syncing local tree...
+
+ local ownership="portage:portage"
+ if has usersync ${FEATURES} ; then
+ case "${USERLAND}" in
+ BSD)
+ ownership=$(stat -f '%Su:%Sg' "${PORTDIR}")
+ ;;
+ *)
+ ownership=$(stat -c '%U:%G' "${PORTDIR}")
+ ;;
+ esac
+ fi
+
if type -p tarsync &> /dev/null; then
echo "apparently you have tarsync installed. using it."
- if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 -o portage -g portage -e /distfiles -e /packages -e /local; then
+ local chown_opts="-o ${ownership%:*} -g ${ownership#*:}"
+ chown ${ownership} "${PORTDIR}" > /dev/null 2>&1 || chown_opts=""
+ if ! tarsync "${FILE}" "${PORTDIR}" -v -s 1 ${chown_opts} -e /distfiles -e /packages -e /local; then
echo "ok, tarsync failed. that's teh suck :/"
exit 6
fi
@@ -238,8 +253,9 @@ sync_local() {
echo "Executed command: tar jxf $FILE"
exit 1
fi
- # Make sure user and group file ownership is root
- chown -R 0:0 portage
+ # Make sure user and group file ownership is appropriate
+ chown ${ownership} portage > /dev/null 2>&1 && \
+ chown -R ${ownership} portage
cd portage
rsync -av --progress --stats --delete --delete-after \
--exclude='/distfiles' --exclude='/packages' \