From 648859bda2ecf1ed112277b05adc1430c72747c1 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 18 Mar 2005 02:07:25 +0000 Subject: [PATCH] If we're not root and the "fakeroot" command is available, use it to re-run the script while pretending to be root. --- testsuite/chown.test | 9 +++++++++ testsuite/devices.test | 8 ++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) 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 -- 2.34.1