I'm writing the software upgrade functionality for a piece of embedded equipment. Currently the root file system is upgraded by taking a new rootfs.tar.gz file and unpacking it to the root file system (overwriting existing files and adding new ones). But this doesn't delete files that aren't in the new package.
So now I'm going to have to rm -rf all of the existing files, then unpack the new rootfs tar file. This seems like a lot of work, and takes a lot of time, and maybe the only thing that changed was one config file.
Instead, I'd like to be able to rsync the contents of a .tar.gz file to a directory. Is this doable without going through some sort of intermediary (meaning, without unpacking the tar to a temp directory then doing the rsync)?