Hi,

On Tue, 20 Aug 2013, Bastien ROUCARIES wrote:
> > A possible way to do this could be:
> > * Move the directory away in preinst (<dir>.dpkg-backup), put in place a 
> > symlink
> >   pointing to the renamed directory
> ok this is easy
> > * In postinst, move remaining files from the temporary directory to
> >   the directory pointed by the symlink (except if there's already a new
> >   file at the expected location, in that case warn about the conflict
> >   and leave the file).
> 
> How can I do this ? mv -n is not portable, and if I use find how to
> handle symlink ?

mymove() {
    local origin=$1
    local target=$2
    while read path; do
        # do the work for each file here
    done
}

find $origin | mymove $origin $target

You can use compute the relative path names by stripping $origin from the
stard and you can do whatever checks you want with "test".

> Should I check if md5sum are the same in case of conflicts and
> override in this case ?

I would not override but it's interesting to compare the files
yes. That way we can avoid complaining about a conflict when in fact
both files are identical. And we can silently drop our copy.

Cheers,
-- 
Raphaël Hertzog ◈ Debian Developer

Discover the Debian Administrator's Handbook:
→ http://debian-handbook.info/get/


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to