From: Wayne Davison Date: Fri, 18 Mar 2005 02:07:25 +0000 (+0000) Subject: If we're not root and the "fakeroot" command is available, use it X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/648859bda2ecf1ed112277b05adc1430c72747c1 If we're not root and the "fakeroot" command is available, use it to re-run the script while pretending to be root. --- diff --git a/testsuite/chown.test b/testsuite/chown.test index 755ffdf8..8f3a3e08 100644 --- a/testsuite/chown.test +++ b/testsuite/chown.test @@ -15,6 +15,15 @@ set -x +case `id -u` in +'') ;; # If "id" failed, try to continue... +0) ;; +*) if [ -f /usr/bin/fakeroot ]; then + exec /usr/bin/fakeroot /bin/sh "$0" + fi + ;; +esac + # Build some hardlinks mkdir "$fromdir" diff --git a/testsuite/devices.test b/testsuite/devices.test index 3e8f4077..4401572e 100644 --- a/testsuite/devices.test +++ b/testsuite/devices.test @@ -13,8 +13,12 @@ case `id -u` in '') ;; # If "id" failed, try to continue... -0) ;; -*) test_skipped "Rsync won't copy devices unless we're root" ;; +0) ;; +*) if [ -f /usr/bin/fakeroot ]; then + exec /usr/bin/fakeroot /bin/sh "$0" + fi + test_skipped "Rsync won't copy devices unless we're root" + ;; esac # TODO: Need to test whether hardlinks are possible on this OS/filesystem