I am attempting to tar up the contents of a root file system, located at
$rootfs. The problem is, when I try to
tar -c $rootfs > $dest, the directories between my current directory and the actual file system remain. So instead of
etc/fstab, I have
rootfs=fun/rootfs/path, for every single file.
I know about
--strip, but the problem is that
$rootfs is a relative-path variable, so I don't know how many directories are between the file system and my current directory. I can't
cd for a similar reason;
$dest is a relative-path variable and I have to stay in the current directory to create the archive in the proper location.
Is there a way I can ignore the
rootfs path when creating the archive?