Hello,
I'd like to create a diff/delta file between two rootfs images. I
thought it would be as easy as using diff / rsync with some options,
but it doesn't seem to be possible with just that, at least I couldn't
manage it. So I wrote my own tool and it works, but it requires root
to manipulate the files owned by other UIDs and GIDs (especially
root).

I know there's fakeroot, but my images have files owned by root and
another ordinary users, so I cannot just make everything be owned by
root. Here's the breakdown of my program and what I tried. I'd like
any suggestion on how to achieve this easier and without sudo / root
account.

Oh and btw I am using ext4 images because I am using Mender (the over
the air update software - https://mender.io/ ) and their final "mender
artifact" is just the ext4 rootfs image with some extra metadata. I'd
like to make a system that can produce a delta between these images.
But if that's not possible I can just use the tarball created by Yocto
(I'd just need to keep both or maybe Mender can be configured to use
tarballs... not sure).

Mount ext4 images at dir1 and dir2 (can be done without root
using fuse2fs, but in that case no files can be listed when using
sudo... strange)

For all files in dir1 check if it exists in dir2, if not, write its name
to ".deleted" file

For all files in dir2 check if file exists in dir1. If not, copy it to
output-dir

If both files exist compare them (size, uid, guid, st_mode, finally
calculate and compare a hash)

if any of the above is different, copy it (using cp -a, which preserves
all attributes). Also make all the directories for that file (mkdir -p).

For all directories in output-dir check if it exists in dir2, if yes
then copy all its attributes (stat -> chmod + chown).
This is needed for all the directories we created using mkdir -p

This leaves us with all the files that were different in output-dir
and a list of files to be removed.

Here's what I thought of doing:
Do this in a docker image as a root (without the docker itself having
any privileges). Can't make it work with ext4 being mounted, docker
container can't access it (mountpoint is owned by root).
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#63611): https://lists.yoctoproject.org/g/yocto/message/63611
Mute This Topic: https://lists.yoctoproject.org/mt/107633647/21656
Mute #toolchain:https://lists.yoctoproject.org/g/yocto/mutehashtag/toolchain
Mute #yocto:https://lists.yoctoproject.org/g/yocto/mutehashtag/yocto
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to