How to update a software using xdeltal3 file

Hi, I want to update software offline, and I make a delta file by ‘xdelta3 -s telegram-desktop_637.snap telegram-desktop_617.snap telegram-desktop_637.snap.xdelta3’, I know I can just install the snap file, but I want to know is it possible to refresh the software with this xdelta3 file?

Thanks!

As I understand it, the command you’ve written gives you a delta for getting from 637 to 617, which I think is the reverse of what you want. I think the command you actually want is

xdelta3 -e -s telegram-desktop_617.snap telegram-desktop_637.snap tg_617_637.xdelta3

You’d copy the .xdelta3 file to the machine that you’re wanting to update, then

xdelta3 -d -s telegram-desktop_617.snap tg_617_637.xdelta3 telegram-desktop_637.snap

then you should check the files are the same,

snap info --verbose telegram-desktop_637.snap | grep ^sha3

if they are the same, then that worked! Next you should get the assertion copied over: if the 637 snap was the result of snap download, then simply copy that over and snap ack the .assert file. If the 637 snap is actually installed, and the machine you’re wanting to refresh already has telegram-desktop installed (but not at this revision), you can get the revision assertion from the machine that has it: first, find out the snap’s ID,

$ snap info telegram-desktop | grep ^snap-id
snap-id: jpdoHqMd90M39DdH2JSZbeQxipqHtwLo

and then ask snapd for the snap-revision assertion of that snap ID and revision,

$ snap known snap-revision snap-id=jpdoHqMd90M39DdH2JSZbeQxipqHtwLo snap-revision=637

copy that to where you copied the xdelta3, and snap ack it, and then snap install the .snap file, and everything should work.

Alternatively you can install it from the resulting .snap, and then ask snapd to fetch the assertion from the store itself (for which snapd needs to reach the internet),

snap install --dangerous telegram-desktop_637.snap
snap refresh --amend telegram-desktop

HTH, HAND.

2 Likes

Hi, chipaca, thank you for your detailed reply! :grin:

My understanding is that, as you said, I must have the telegram-desktop_617.snap in the offline computer to generate the new telegram-desktop_637.snap and then install it? If the old version telegram-desktop is actually installed, and there is no snap file in the offline meachine, can I reconstruct the xdelta file to the filesystem directly?

if you have the old version of telegram-desktop in the offline machine, that is, if you have 617 there, you have the snap. It will be stored in /var/lib/snapd/snaps/telegram-desktop_617.snap, and mounted (not extracted) on /snap/telegram-desktop/617/.

If the offline machine does not have revision 617, … then I don’t understand what you’re trying to do :slight_smile:

Thank you very much!:heart:

1 Like