--- embedaddon/rsync/testsuite/chown.test 2012/02/17 15:09:30 1.1.1.1 +++ embedaddon/rsync/testsuite/chown.test 2021/03/17 00:32:36 1.1.1.3 @@ -15,17 +15,35 @@ case $0 in *fake*) - $RSYNC --version | grep ", xattrs" >/dev/null || test_skipped "Rsync needs xattrs for fake device tests" + $RSYNC --version | grep "[, ] xattrs" >/dev/null || test_skipped "Rsync needs xattrs for fake device tests" RSYNC="$RSYNC --fake-super" TLS_ARGS="$TLS_ARGS --fake-super" - case "`xattr 2>&1`" in - *--list:*) + case "$HOST_OS" in + darwin*) chown() { own=$1 shift xattr -s 'rsync.%stat' "100644 0,0 $own" "${@}" } ;; + solaris*) + chown() { + own=$1 + shift + for fn in "${@}"; do + runat "$fn" "$SHELL_PATH" < rsync.%stat +EOF + done + } + ;; + freebsd*) + chown() { + own=$1 + shift + setextattr -h user "rsync.%stat" "100644 0,0 $own" "${@}" + } + ;; *) chown() { own=$1 @@ -37,15 +55,16 @@ case $0 in ;; *) RSYNC="$RSYNC --super" - case `get_testuid` in - '') ;; # If "id" failed, try to continue... - 0) ;; - *) if [ -f /usr/bin/fakeroot ]; then + my_uid=`get_testuid` + root_uid=`get_rootuid` + if test x"$my_uid" = x; then + : # If "id" failed, try to continue... + elif test x"$my_uid" != x"$root_uid"; then + if [ -e "$FAKEROOT_PATH" ]; then echo "Let's try re-running the script under fakeroot..." - exec /usr/bin/fakeroot /bin/sh "$0" + exec "$FAKEROOT_PATH" "$SHELL_PATH" "$0" fi - ;; - esac + fi ;; esac