From: Rob Browning Date: Fri, 28 Jan 2011 03:31:40 +0000 (-0600) Subject: t/test-meta.sh: detect and handle fakeroot. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=51b0ff5120d1639f86a46fdbce56c3200effee2b;p=packages%2Fb%2Fbup.git t/test-meta.sh: detect and handle fakeroot. Signed-off-by: Rob Browning --- diff --git a/t/test-meta.sh b/t/test-meta.sh index 4fdd1f9..c0dd89a 100755 --- a/t/test-meta.sh +++ b/t/test-meta.sh @@ -25,9 +25,14 @@ genstat() ) } +actually-root() +{ + test "$(whoami)" == root -a -z "${FAKEROOTKEY}" +} + force-delete() { - if test "$(whoami)" != root + if ! actually-root then rm -rf "$@" else @@ -67,7 +72,7 @@ test-src-create-extract() ) } -if test "$(whoami)" == root +if actually-root then umount "${TOP}/bupmeta.tmp/testfs" || true fi @@ -91,7 +96,7 @@ WVSTART 'meta - general' ) # Root-only tests: ACLs, Linux attr, Linux xattr, etc. -if test "$(whoami)" == root +if actually-root then ( cleanup_at_exit() @@ -116,7 +121,7 @@ then cp -a src testfs/src (cd testfs && test-src-create-extract) - WVSTART 'meta - atime' + WVSTART 'meta - atime (as root)' force-delete testfs/src mkdir testfs/src (