run-as com.example.app tar -cf - . | cat >backup.tar
cat backup.tar | run-as com.example.app tar -xf -
run-as: Usage:
run-as <package-name> [--user <uid>] <command> [<args>]
usage: tar -[cxtzhmvO] [-X FILE] [-T FILE] [-f TARFILE] [-C DIR]
Create, extract, or list files from a tar file
Operation:
c Create
f Name of TARFILE ('-' for stdin/out)
h Follow symlinks
m Don't restore mtime
t List
v Verbose
x Extract
z (De)compress using gzip
C Change to DIR before operation
O Extract to stdout
exclude=FILE File to exclude
X File with names to exclude
T File with names to include