diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-08-17 17:57:19 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-08-17 17:57:19 -0700 |
commit | 87a769bdab8e54c68260996026c87d3d7845d2e6 (patch) | |
tree | 677168a794f13ee8223dd1cee40a795e389e2db6 /misc | |
parent | emerge-delta-webrsync: support gpg verification (diff) | |
download | portage-87a769bdab8e54c68260996026c87d3d7845d2e6.tar.gz portage-87a769bdab8e54c68260996026c87d3d7845d2e6.tar.bz2 portage-87a769bdab8e54c68260996026c87d3d7845d2e6.zip |
emerge-delta-webrsync: handle FEATURES=usersync
Diffstat (limited to 'misc')
-rwxr-xr-x | misc/emerge-delta-webrsync | 22 |
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' \ |