[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Deb package update in depth



Quoting Kirill Proskurin (oloremo@gmail.com):
> Hello.
> 
> I'm trying to understand how deb package update happens in details.
> Is it transaction of some kind? Atomic? Temp dirs and move? And so
> on. I cant find any info about this in official docs and in Google
> in general.
> 
> I want to package our in house php code in deb and deploy it in
> production servers. But nature of this code implies what there is
> shouldn't be any race of mix of old\new files.

Simple-mindedly, it's done with links:

ln -s tree-of-old-software production-link

(before you start the software which you reference through the link).

Build your new tree:

ln -s tree-of-updated-software newlink

ls -l
    production-link -> tree-of-old-software/...
    newlink -> tree-of-updated-software/...

Now switch them:

mv -T newlink production-link

ls -l
    production-link -> tree-of-updated-software/...

Restart software if necessary.

Yes, mv -T (ie rename) is atomic.

I assume that's why /lib and /usr/lib are stuffed with links.

Cheers,
David.


Reply to: